api

package
v0.1.0-alpha.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Overview

Package api implements the REST handlers for environment-scoped resources (ADR-0006): /api/v1/environments and /api/v1/environments/{env}/...

Index

Constants

View Source
const (
	StatusConnected   = "connected"
	StatusUnavailable = "unavailable"
)

Environment statuses.

Variables

This section is empty.

Functions

func EnvFrom

func EnvFrom(ctx context.Context) *environment.Environment

EnvFrom returns the environment resolved from the {env} path parameter.

func Namespace

func Namespace(r *http.Request) (string, error)

Namespace returns the containerd namespace for the request: the "namespace" query parameter, or the environment's default. Invalid names are rejected (ADR-0006).

func ReadOnlyReason

func ReadOnlyReason(st runtime.NerdctlStatus) string

ReadOnlyReason explains why an environment is read-only.

Types

type BulkActionRequest

type BulkActionRequest struct {
	Action  runtime.Action `json:"action"`
	IDs     []string       `json:"ids"`
	Force   bool           `json:"force,omitempty"`
	Volumes bool           `json:"volumes,omitempty"`
}

BulkActionRequest is the body of POST /containers/actions. Keep in sync with api/openapi.yaml.

type BulkActionResult

type BulkActionResult struct {
	ID    string                `json:"id"`
	OK    bool                  `json:"ok"`
	Error *httpjson.ErrorDetail `json:"error,omitempty"`
}

BulkActionResult is the outcome for one container.

type Environment

type Environment struct {
	ID               string `json:"id"`
	Name             string `json:"name"`
	Kind             string `json:"kind"`
	DefaultNamespace string `json:"defaultNamespace"`
}

Environment is the API representation. Keep in sync with api/openapi.yaml.

type EnvironmentStatus

type EnvironmentStatus struct {
	Environment
	Status  string            `json:"status"` // connected | unavailable
	Error   string            `json:"error,omitempty"`
	Runtime *runtime.Versions `json:"runtime,omitempty"`
}

EnvironmentStatus adds live connectivity information.

type Handler

type Handler struct {
	Envs   *environment.Registry
	Logger *slog.Logger
}

Handler serves environment endpoints.

func (*Handler) Routes

func (h *Handler) Routes(r chi.Router, g *authz.Guard)

Routes registers the environment endpoints under the API root.

Directories

Path Synopsis
Package ws is the shared WebSocket layer for streams (ADR-0007): logs, stats, events, job progress and exec.
Package ws is the shared WebSocket layer for streams (ADR-0007): logs, stats, events, job progress and exec.

Jump to

Keyboard shortcuts

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