Documentation
¶
Overview ¶
Package api serves the Kiln HTTP surface. The control listener is the only place these routes exist.
Index ¶
Constants ¶
const ( CodeNotFound = "not_found" CodeInvalid = "invalid" CodeConflict = "conflict" CodeExhausted = "exhausted" CodeInternal = "internal" )
Error codes are stable and part of the API.
const TenantHeader = "X-Kiln-Tenant"
TenantHeader names the tenant of one call. The gateway sets it after it authenticates the caller. The host trusts the name and enforces what that tenant reaches.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct {
Store store.Store
Templates *template.Manager
Sandboxes *sandbox.Manager
Token string
// FirecrackerVersion is the pinned version GET /v1/health reports.
FirecrackerVersion string
// Root is the Kiln root, for the status page's disk use.
Root string
// Base is the lifetime context for asynchronous work.
Base context.Context
// Viewers holds the people who open team previews. Nil on a host that
// serves no preview.
Viewers ViewerStore
// SealKey seals a registry token before it reaches the database.
SealKey []byte
}
Server holds the API dependencies.
type ViewerStore ¶
type ViewerStore interface {
// Create adds one viewer of one tenant.
Create(ctx context.Context, tenant, address, password string) error
// Exists reports whether an address already holds a viewer.
Exists(ctx context.Context, address string) (bool, error)
// List returns the viewers of one tenant.
List(ctx context.Context, tenant string) ([]store.Viewer, error)
// Delete revokes one viewer of one tenant.
Delete(ctx context.Context, tenant, userID string) error
}
ViewerStore is the part of the viewer login the API touches. The ingress implements it; the interface keeps this package free of that import.