Documentation
¶
Overview ¶
Package sitesclient deploys sites over the API of internal/sites without importing the server. The runtime and the agent publish with it.
Index ¶
- Variables
- type Client
- func (c *Client) Claim(ctx context.Context, space, name, access, origin string) error
- func (c *Client) Deploy(ctx context.Context, space, name, source string, files []DeployFile) (Deployed, error)
- func (c *Client) FindByOrigin(ctx context.Context, space, origin string) (*Site, error)
- func (c *Client) SetAccess(ctx context.Context, space, name, access string) error
- type ClientError
- type DeployFile
- type Deployed
- type Site
Constants ¶
This section is empty.
Variables ¶
var ErrNameTaken = errors.New("the site name is taken")
ErrNameTaken: the name belongs to a site this caller did not make for this origin.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// Base is the server's address (https://hub.example.com), Token a deploy token, a publishing session or an
// administrator's token.
Base string
Token string
HTTP *http.Client
}
Client deploys sites to a server over the API (docs/hub/sites.md): the protocol of `harnessly site deploy`, for the code that has the files in memory, such as the runtime publishing a Sinopia project.
func (*Client) Claim ¶
Claim gets the site ready for a deployment of the thing named origin: it makes the site when there is none, and takes it over only when it was made for the same origin by this caller. A site of anybody else, or of another origin, is ErrNameTaken, and nothing of it is touched. access is used for a new site only.
func (*Client) Deploy ¶
func (c *Client) Deploy(ctx context.Context, space, name, source string, files []DeployFile) (Deployed, error)
Deploy sends the files as a new version of the site, which becomes the current one. Only the files the server does not have yet travel.
func (*Client) FindByOrigin ¶ added in v0.16.123
FindByOrigin is the caller's site made from origin (sinopia:<project>), or nil when there is none. The server lists a machine its own sites only.
type ClientError ¶
ClientError is a refusal of the server, with the words it gave.
func (*ClientError) Error ¶
func (e *ClientError) Error() string
type DeployFile ¶
DeployFile is one file of a deployment.