Documentation
¶
Index ¶
- Constants
- func RegisterRoutes(mux *http.ServeMux, h *Handler, mounts Mounts) ([]string, error)
- type Dependencies
- type Handler
- func (h *Handler) CompactMirrorsHandler(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetDeploymentRunHandler(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetDeploymentRunsHandler(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetProjectsApiHandler(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetScheduledJobsHandler(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetStacksApiHandler(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetSyncWindowsHandler(w http.ResponseWriter, r *http.Request)
- func (h *Handler) HealthCheckHandler(w http.ResponseWriter, _ *http.Request)
- func (h *Handler) ProjectActionApiHandler(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ProjectApiHandler(w http.ResponseWriter, r *http.Request)
- func (h *Handler) StackActionApiHandler(w http.ResponseWriter, r *http.Request)
- func (h *Handler) StackApiHandler(w http.ResponseWriter, r *http.Request)
- func (h *Handler) TriggerPollHandler(w http.ResponseWriter, r *http.Request)
- func (h *Handler) TriggerScheduledJobHandler(w http.ResponseWriter, r *http.Request)
- type HealthFailureReporter
- type Mounts
- type Operation
- type Route
- type RunOperations
Constants ¶
const ( // APIPath is the root path for authenticated REST operations. APIPath = "/v1/api" // WebhookPath is the root path for deployment webhooks. WebhookPath = "/v1/webhook" // HealthPath is the unauthenticated health endpoint. HealthPath = "/v1/health" // MCPPath is the stateless MCP transport endpoint. MCPPath = "/mcp" // OpenAPIRestPath serves the runtime-generated REST and health OpenAPI document. OpenAPIRestPath = "/openapi/rest.json" // OpenAPIWebhookPath serves the runtime-generated webhook OpenAPI document. OpenAPIWebhookPath = "/openapi/webhooks.json" // DocsPath serves the embedded Swagger UI for REST and health endpoints. DocsPath = "/docs/" // DocsWebhookPath serves the embedded Swagger UI for webhook endpoints. DocsWebhookPath = "/docs/webhooks/" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Dependencies ¶ added in v0.115.0
type Dependencies struct {
AppConfig *app.Config `validate:"required,nostructlevel"`
Logger *logger.Logger `validate:"required,nostructlevel"`
DockerCLI command.Cli `validate:"required,nostructlevel"`
Contexts *docker.ContextRegistry `validate:"required,nostructlevel"`
Runs RunOperations `validate:"required,nostructlevel"`
SecretProvider secretprovider.SecretProvider
HealthFailureReporter HealthFailureReporter `validate:"required"`
}
Dependencies contains the runtime services required by the REST API handlers.
type Handler ¶ added in v0.115.0
type Handler struct {
// contains filtered or unexported fields
}
Handler adapts REST requests to Docker and control-plane operations.
func NewHandler ¶ added in v0.115.0
func NewHandler(dependencies Dependencies) (*Handler, error)
NewHandler validates dependencies and constructs the REST API adapter.
func (*Handler) CompactMirrorsHandler ¶ added in v0.124.0
func (h *Handler) CompactMirrorsHandler(w http.ResponseWriter, r *http.Request)
CompactMirrorsHandler starts a compaction of the Git mirrors in the data directory. With wait it responds with the finished run.
func (*Handler) GetDeploymentRunHandler ¶ added in v0.115.0
func (h *Handler) GetDeploymentRunHandler(w http.ResponseWriter, r *http.Request)
GetDeploymentRunHandler returns one tracked deployment run by job ID.
func (*Handler) GetDeploymentRunsHandler ¶ added in v0.115.0
func (h *Handler) GetDeploymentRunsHandler(w http.ResponseWriter, r *http.Request)
GetDeploymentRunsHandler lists tracked deployment runs using optional filters.
func (*Handler) GetProjectsApiHandler ¶ added in v0.115.0
func (h *Handler) GetProjectsApiHandler(w http.ResponseWriter, r *http.Request)
GetProjectsApiHandler lists Compose projects in the requested Docker context.
func (*Handler) GetScheduledJobsHandler ¶ added in v0.115.0
func (h *Handler) GetScheduledJobsHandler(w http.ResponseWriter, r *http.Request)
GetScheduledJobsHandler lists scheduled jobs for an optional context and stack.
func (*Handler) GetStacksApiHandler ¶ added in v0.115.0
func (h *Handler) GetStacksApiHandler(w http.ResponseWriter, r *http.Request)
GetStacksApiHandler lists Swarm stacks in the requested Docker context.
func (*Handler) GetSyncWindowsHandler ¶ added in v0.123.0
func (h *Handler) GetSyncWindowsHandler(w http.ResponseWriter, r *http.Request)
GetSyncWindowsHandler reports the configured sync windows and, if the request names a target, whether a deployment of it is allowed now.
func (*Handler) HealthCheckHandler ¶ added in v0.115.0
func (h *Handler) HealthCheckHandler(w http.ResponseWriter, _ *http.Request)
HealthCheckHandler handles health check requests and reports Docker API availability.
func (*Handler) ProjectActionApiHandler ¶ added in v0.115.0
func (h *Handler) ProjectActionApiHandler(w http.ResponseWriter, r *http.Request)
ProjectActionApiHandler applies a lifecycle action to a Compose project.
func (*Handler) ProjectApiHandler ¶ added in v0.115.0
func (h *Handler) ProjectApiHandler(w http.ResponseWriter, r *http.Request)
ProjectApiHandler returns or removes a single Compose project.
func (*Handler) StackActionApiHandler ¶ added in v0.115.0
func (h *Handler) StackActionApiHandler(w http.ResponseWriter, r *http.Request)
StackActionApiHandler applies an action to matching services in a Swarm stack.
func (*Handler) StackApiHandler ¶ added in v0.115.0
func (h *Handler) StackApiHandler(w http.ResponseWriter, r *http.Request)
StackApiHandler returns or removes a single Swarm stack.
func (*Handler) TriggerPollHandler ¶ added in v0.115.0
func (h *Handler) TriggerPollHandler(w http.ResponseWriter, r *http.Request)
TriggerPollHandler validates and runs poll configurations from the request body.
func (*Handler) TriggerScheduledJobHandler ¶ added in v0.115.0
func (h *Handler) TriggerScheduledJobHandler(w http.ResponseWriter, r *http.Request)
TriggerScheduledJobHandler starts a scheduled job synchronously or asynchronously.
type HealthFailureReporter ¶ added in v0.115.0
type HealthFailureReporter func( w http.ResponseWriter, log *slog.Logger, jobID string, failureType error, cause error, )
HealthFailureReporter preserves application-level health failure reporting without coupling the API package to the webhook implementation.
type Operation ¶ added in v0.116.0
Operation binds an HTTP method to its OpenAPI operation metadata.
type Route ¶ added in v0.116.0
type Route struct {
Pattern string
Handler http.Handler
Enabled func(*app.Config) bool
Root string
Operations []Operation
}
Route is the shared source of truth for HTTP registration and OpenAPI generation.
type RunOperations ¶ added in v0.115.0
type RunOperations interface {
List(limit int, trigger, status string) []controlplane.Run
Get(jobID string) (controlplane.Run, bool)
ListScheduledJobs(ctx context.Context, contextName, stackName string) ([]controlplane.ScheduledJobInfo, error)
TriggerScheduledJob(ctx context.Context, jobID, contextName, jobName, stackName string, wait bool) (string, error)
TriggerPoll(ctx context.Context, configs []poll.Config, wait bool, log *slog.Logger) (string, error)
TriggerMirrorCompaction(ctx context.Context, jobID string, req controlplane.MirrorCompactionRequest, wait bool) (string, error)
}
RunOperations is the control-plane surface consumed by the REST API.