api

package
v0.115.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
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"
)

Variables

This section is empty.

Functions

func RegisterRoutes added in v0.115.0

func RegisterRoutes(mux *http.ServeMux, h *Handler, mounts Mounts) []string

RegisterRoutes registers endpoints based on the application configuration and returns all enabled endpoint roots in registration order.

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"`
	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) 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) 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 Mounts added in v0.115.0

type Mounts struct {
	Webhook http.Handler
	MCP     http.Handler
}

Mounts supplies protocol handlers owned outside the API package.

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) ([]scheduler.JobInfo, 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)
}

RunOperations is the control-plane surface consumed by the REST API.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL