Documentation
¶
Overview ¶
Package api is the controller's public HTTP API (§5.1). The dashboard, synctl and CI all use these same endpoints; there are no UI-only routes.
Index ¶
Constants ¶
const ( CredSession = "session" CredToken = "token" CredAccessKey = "access_key" // CredRole is an assumed role (sts); CredTemporary a device-login or // Cloud Shell credential acting as the user. CredRole = "role_session" CredTemporary = "temporary" )
Credential types a request can authenticate with (§7.1).
const ( CodeBadRequest = "bad_request" CodeForbidden = "forbidden" CodeNotFound = "not_found" CodeConflict = "conflict" CodeRateLimited = "rate_limited" CodeInternal = "internal" CodeInvalidOrigin = "invalid_origin" CodeMFARequired = "mfa_required" CodeQuotaExceeded = "quota_exceeded" // CodeLocked: the environment's deploys are locked (Phase 15d). CodeLocked = "locked" )
Error codes returned in {"error": {"code": …}}. Clients switch on these, not on messages.
const HeaderSessionToken = "X-Syncloud-Session-Token"
HeaderSessionToken carries the session token of temporary credentials.
const SettingRequireMFA = "iam.require_mfa"
SettingRequireMFA makes MFA mandatory for every person (not service accounts).
Variables ¶
var CLICommands func() map[string]string
CLICommands maps API operations to synctl commands (set by the controller, which links the CLI; the api package cannot import it).
var OpenAPISpec []byte
OpenAPISpec is the API contract, served at /api/v1/openapi.json. A test keeps it in sync with Routes.
Functions ¶
Types ¶
type ACMEInfo ¶
type ACMEInfo struct {
Enabled bool `json:"enabled"`
DirectoryURL string `json:"directoryUrl"`
Email string `json:"email"`
}
ACMEInfo describes the certificate issuer for the dashboard.
type Options ¶
type Options struct {
Store *store.Store
Secrets *secrets.Box
CA *pki.CA
Nodes *nodes.Registry
// GatewayAddr is the agent gateway address returned to joining nodes.
GatewayAddr string
// System reports platform components (system tasks); may be nil in tests.
System *system.Manager
// Registry issues Docker registry tokens; nil disables the token endpoint.
Registry *registry.Issuer
// Internal handlers are mounted as-is outside the public API (e.g. the
// Traefik config endpoint) and carry their own authentication.
Internal map[string]http.Handler
// Domains, Detector and Certs back the domain settings (§5.0.2); may be nil.
Domains *domain.Service
Detector *domain.Detector
Certs *certs.Manager
ACME ACMEInfo
// OnSetup runs after the root account is created.
OnSetup func()
// Backups manages S3 backups (§13); may be nil.
Backups *backup.Manager
// Mesh reports the private network (§8); may be nil.
Mesh *mesh.Manager
// DownloadsDir holds agent/CLI binaries served at /downloads/ ("" disables).
DownloadsDir string
// Workloads runs services (§5.2); may be nil.
Workloads *workload.Manager
// Databases runs managed Valkey (Phase 12); may be nil.
Databases *dbs.Manager
// Logs serves container logs (§9.2); may be nil.
Logs *logs.Store
// Exec relays interactive commands to tasks; may be nil.
Exec *execrelay.Relay
// Jobs runs one-off, scheduled and hook jobs (§5.11); may be nil.
Jobs *jobs.Manager
// Health is the central health monitor (§5.6); may be nil.
Health *health.Monitor
// RegistryBrowser reads repositories and images (§5.10); may be nil.
RegistryBrowser *registry.Browser
// Builds builds Git commits into images (§5.8); may be nil.
Builds *builds.Manager
// Metrics reads task resource usage (§9.1); may be nil.
Metrics *metrics.Store
// RegistryMaint applies lifecycle policies and runs GC (§5.10); may be nil.
RegistryMaint *regmaint.Manager
// RegistryStorage switches the registry between disk and S3 (Phase 19); may be nil.
RegistryStorage *regstorage.Manager
// Upstreams stores third-party registry credentials (§5.9); may be nil.
Upstreams *upstream.Manager
// RegistryHosts are the names images use for the private registry.
RegistryHosts func() []string
// Autoscaler runs target tracking policies (§5.5).
Autoscaler *autoscale.Manager
// Alerts evaluates alert rules and notifies channels (§9).
Alerts *alerts.Manager
// SecurityGroups is on when containers are isolated (§8.3);
// OnSecurityChange republishes the compiled policy.
SecurityGroups bool
OnSecurityChange func()
FirewallStats *fwstats.Stats
Quotas *quota.Manager
Shell *shell.Manager
Pools *nodepool.Manager
Edges *edge.Manager
Upgrades *upgrade.Service
S3 *s3.Manager
AgentRollout *rollout.Manager
Discovery *discovery.Manager
Traefik *traefik.Provider
TraefikExtras *traefik.Extras
GitConnections *gitconn.Manager
GitServer *gitserver.Manager
// OnTraefikSettings re-renders the Traefik replicas after the static
// settings changed.
OnTraefikSettings func()
// ControllerSchedulable lets ctl-0 run services from the moment it joins (D3).
ControllerSchedulable bool
Bus *events.Bus
Log *slog.Logger
Web fs.FS
// Branding is the workspace name, title and logo (Phase 21); may be nil.
Branding *branding.Manager
// Now is overridable for tests.
Now func() time.Time
}
type Principal ¶
type Principal struct {
User store.User
CredType string
CredID string // access key ID or token ID; empty for sessions
RoleID string // set for role sessions: the role's policies apply
MFA bool // the credential was obtained with a TOTP code
MFAEnabled bool // the user has MFA set up
Kind string // user | service
}
Principal is who is making a request and with which credential.
Source Files
¶
- alerts.go
- auth.go
- authn.go
- authz.go
- autoscale.go
- backups.go
- branding.go
- builds.go
- credentials.go
- databases.go
- deployments.go
- docs.go
- domains.go
- downloads.go
- envpolicy.go
- exec.go
- firewall.go
- iam.go
- imagewatch.go
- integrations.go
- ipam.go
- jobs.go
- logs.go
- metrics.go
- middleware.go
- middlewares.go
- nodepools.go
- nodes.go
- paging.go
- pgexplorer.go
- quotas.go
- ratelimit.go
- recoverykey.go
- regevents.go
- registry.go
- regmaint.go
- regstorage.go
- respond.go
- routing.go
- s3.go
- secgroups.go
- server.go
- service_domains.go
- shell.go
- smtp.go
- spa.go
- stream.go
- traffic.go
- upgrades.go
- upstreams.go
- workloads.go