Documentation
¶
Overview ¶
Package sitehttp assembles the serving layer for sites and browser pages (#2517, #2518) over the platform's mux: the Host-routing gateway the listener is wrapped in, the portal routes that hand a signed-in person to a page origin or a site's own address, and the REST routes of the portal's Sites section and its administration (#2559).
Index ¶
- func PortalRegistrar(d PortalDeps) func(*http.ServeMux)
- func Registrar(p *platform.Platform, resolver portal.PersonaResolver, ...) func(*http.ServeMux)
- type AccessList
- type AddressList
- type AdminDomainBody
- type ApplicationAddresses
- type CopyBody
- type DeploymentAddress
- type DeploymentList
- type DomainBody
- type EnvironmentBody
- type FormList
- type GrantBody
- type JobList
- type Layer
- type PortalDeps
- type PromoteBody
- type PublishBody
- type ReleaseDetail
- type ReleaseList
- type ReleaseView
- type RollbackBody
- type Sharer
- type SiteLimits
- type SiteList
- type SiteRequest
- type SiteSettings
- type SiteUpdate
- type SiteView
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PortalRegistrar ¶ added in v1.156.0
func PortalRegistrar(d PortalDeps) func(*http.ServeMux)
PortalRegistrar registers the portal's Sites routes; nil where the deployment has no sites.
func Registrar ¶ added in v1.156.0
func Registrar(p *platform.Platform, resolver portal.PersonaResolver, notify *notifydelivery.Handle) func(*http.ServeMux)
Registrar is the portal's Sites routes, nil where the deployment serves no sites (#2559).
Types ¶
type AccessList ¶ added in v1.156.0
type AccessList struct {
Owner string `json:"owner_email"`
InternalView bool `json:"internal_view"`
Grants []site.Grant `json:"grants"`
}
AccessList is who has access to a site, for someone who manages it.
type AddressList ¶ added in v1.156.0
type AddressList struct {
Addresses []DeploymentAddress `json:"addresses"`
}
AddressList is every site address and domain on the deployment.
type AdminDomainBody ¶ added in v1.156.0
type AdminDomainBody struct {
Hostname string `json:"hostname" example:"shop.example.com"`
Site string `json:"site,omitempty"`
Environment string `json:"environment,omitempty"`
RequiresApproval bool `json:"requires_approval,omitempty"`
Application string `json:"application,omitempty"`
}
AdminDomainBody maps a hostname to a site environment or an application.
type ApplicationAddresses ¶ added in v1.156.0
type ApplicationAddresses struct {
PageOrigin string `json:"page_origin"`
Domains []string `json:"domains"`
}
ApplicationAddresses is where an application answers.
type CopyBody ¶ added in v1.156.0
type CopyBody struct {
URL string `json:"url" example:"https://www.example.com"`
Environment string `json:"environment" example:"default"`
Note string `json:"note"`
MaxPages int `json:"max_pages,omitempty"`
MaxBytes int64 `json:"max_bytes,omitempty"`
// FormMap names, for a page path, the platform form that replaces its forms.
FormMap map[string]string `json:"form_map,omitempty"`
}
CopyBody names a site to copy into a release.
type DeploymentAddress ¶ added in v1.156.0
type DeploymentAddress struct {
Hostname string `json:"hostname" example:"marketing.pages.example.net"`
Kind string `json:"kind" example:"site_address"`
Site string `json:"site,omitempty" example:"marketing"`
Environment string `json:"environment,omitempty" example:"default"`
Application string `json:"application,omitempty"`
CreatedBy string `json:"created_by"`
CreatedAt string `json:"created_at"`
}
DeploymentAddress is one hostname the deployment answers on for a site or an application. Each needs an ingress rule, added by a system administrator.
type DeploymentList ¶ added in v1.156.0
type DeploymentList struct {
Deployments []site.Deployment `json:"deployments"`
}
DeploymentList is every move of a site's environments, newest first.
type DomainBody ¶ added in v1.156.0
type DomainBody struct {
Hostname string `json:"hostname" example:"dev.example.com"`
Environment string `json:"environment" example:"dev"`
RequiresApproval bool `json:"requires_approval,omitempty"`
}
DomainBody adds a domain to a site.
type EnvironmentBody ¶ added in v1.156.0
type EnvironmentBody struct {
RequiresApproval bool `json:"requires_approval"`
}
EnvironmentBody says whether an environment requires approval.
type FormList ¶ added in v1.156.0
type FormList struct {
Forms []string `json:"forms"`
}
FormList is the platform forms a copied page's forms can post to.
type GrantBody ¶ added in v1.156.0
type GrantBody struct {
Email string `json:"email" example:"pat@example.com"`
Level string `json:"level" example:"view"`
// Notify emails them the site's address.
Notify bool `json:"notify,omitempty"`
}
GrantBody gives a person access.
type Layer ¶
type Layer struct {
// contains filtered or unexported fields
}
Layer is the assembled serving layer; a nil one passes everything through.
func Build ¶
func Build(mux *http.ServeMux, p *platform.Platform, adminAuth func() func(http.Handler) http.Handler, author func(*http.Request) string) (*Layer, error)
Build assembles the layer, nil where the deployment has no sites.
type PortalDeps ¶ added in v1.156.0
type PortalDeps struct {
Runtime *sitewire.Runtime
// Persona is the caller's resolved persona, nil for none.
Persona func(roles []string) *portal.PersonaInfo
IsAdmin func(roles []string) bool
// Audit records each write; nil records none.
Audit audit.Logger
Sharer Sharer
// Forms lists the endpoints that are forms; nil offers none.
Forms func(ctx context.Context) ([]string, error)
}
PortalDeps is what the portal routes act through.
type PromoteBody ¶ added in v1.156.0
type PromoteBody struct {
From string `json:"from,omitempty" example:"stage"`
To string `json:"to" example:"prod"`
Release int `json:"release,omitempty"`
Reason string `json:"reason,omitempty"`
}
PromoteBody moves a release to an environment.
type PublishBody ¶ added in v1.156.0
type PublishBody struct {
Environment string `json:"environment" example:"default"`
Note string `json:"note"`
Archive string `json:"archive,omitempty"`
Folder string `json:"folder,omitempty"`
Scope string `json:"scope,omitempty"`
ScopeID string `json:"scope_id,omitempty"`
// Source is what the release says it came from, the file's name when
// given; only ever displayed.
Source string `json:"source,omitempty" example:"site-1108.zip"`
}
PublishBody names what to publish: a managed-resource archive or folder, read as the caller, so someone cannot publish a file they could not open.
type ReleaseDetail ¶ added in v1.156.0
type ReleaseDetail struct {
ReleaseView
Files []site.File `json:"files"`
}
ReleaseDetail is one release with its files and redirect map. A file's bytes are never read back through the portal origin.
type ReleaseList ¶ added in v1.156.0
type ReleaseList struct {
Releases []ReleaseView `json:"releases"`
}
ReleaseList is a site's releases and where each is served.
type ReleaseView ¶ added in v1.156.0
ReleaseView is a release and the environments serving it.
type RollbackBody ¶ added in v1.156.0
type RollbackBody struct {
Environment string `json:"environment" example:"prod"`
Release int `json:"release,omitempty"`
}
RollbackBody returns an environment to an earlier release.
type Sharer ¶ added in v1.156.0
type Sharer interface {
}
Sharer emails someone that a site was shared with them; nil sends nothing.
type SiteLimits ¶ added in v1.156.0
type SiteLimits struct {
MaxFiles int `json:"max_release_files" example:"20000"`
MaxFileBytes int64 `json:"max_file_bytes" example:"67108864"`
MaxReleaseBytes int64 `json:"max_release_bytes" example:"2147483648"`
CrawlMaxPages int `json:"crawl_max_pages" example:"2000"`
CrawlMaxBytes int64 `json:"crawl_max_bytes" example:"536870912"`
}
SiteLimits is what a release may hold, shown before an upload.
type SiteList ¶ added in v1.156.0
type SiteList struct {
Sites []SiteView `json:"sites"`
Total int `json:"total"`
// PagesDomain is "" when the deployment has none, so sites have no address
// of their own.
PagesDomain string `json:"pages_domain"`
Limits SiteLimits `json:"limits"`
// CanCreate is whether the caller's persona may create a site.
CanCreate bool `json:"can_create"`
// Admin is whether the caller is an administrator.
Admin bool `json:"admin"`
}
SiteList is the Sites page.
type SiteRequest ¶ added in v1.156.0
type SiteRequest struct {
Name string `json:"name" example:"careers"`
Description string `json:"description"`
}
SiteRequest creates a site.
type SiteSettings ¶ added in v1.156.0
type SiteSettings struct {
siteconfig.Settings
UpdatedBy string `json:"updated_by,omitempty"`
UpdatedAt string `json:"updated_at,omitempty"`
}
SiteSettings is the Sites section of the settings page.
type SiteUpdate ¶ added in v1.156.0
type SiteUpdate struct {
Description *string `json:"description,omitempty"`
Owner *string `json:"owner_email,omitempty"`
InternalView *bool `json:"internal_view,omitempty"`
}
SiteUpdate changes a site's record; a field left out is left alone.
type SiteView ¶ added in v1.156.0
type SiteView struct {
site.Site
// Address is the site's own address, "" with no pages domain.
Address string `json:"address"`
Domains []site.Domain `json:"domains"`
// Permissions is what the caller may do to this site.
Permissions sitesvc.Permissions `json:"permissions"`
}
SiteView is a site as the portal shows it.