134 lines
6.0 KiB
Go
134 lines
6.0 KiB
Go
// Code generated by ogen, DO NOT EDIT.
|
|
|
|
package api
|
|
|
|
import (
|
|
"context"
|
|
|
|
ht "github.com/ogen-go/ogen/http"
|
|
)
|
|
|
|
// UnimplementedHandler is no-op Handler which returns http.ErrNotImplemented.
|
|
type UnimplementedHandler struct{}
|
|
|
|
var _ Handler = UnimplementedHandler{}
|
|
|
|
// CheckLab implements CheckLab operation.
|
|
//
|
|
// The checker of the template connects from the host side of the lab management bridge to the nodes
|
|
// (SSH or the RouterOS API) and evaluates the criteria of the variant that the seed selected. It only
|
|
// reads the node state and never changes it, so a repeated call is harmless; the result is not stored
|
|
// by `labd`. The call is synchronous and bounded by the check timeout of the provisioner.
|
|
//
|
|
// The result is checker state for the backend only: the backend scores the lab answer with it and
|
|
// never forwards it to the candidate.
|
|
//
|
|
// A lab that is not `ready` answers 409 `state_conflict`. When the checker cannot reach a node or the
|
|
// template has no working checker, the provisioner answers 503 `lab_unavailable`: nothing was
|
|
// evaluated, and the outcome is never a failed check.
|
|
//
|
|
// POST /v1/labs/{lab_id}/check
|
|
func (UnimplementedHandler) CheckLab(ctx context.Context, params CheckLabParams) (r *LabCheckResult, _ error) {
|
|
return r, ht.ErrNotImplemented
|
|
}
|
|
|
|
// CreateLab implements CreateLab operation.
|
|
//
|
|
// Idempotent by `lab_id`:
|
|
//
|
|
// - a new ID that fits the capacity reserves it, stores the lab, and answers 202 with
|
|
// `state: provisioning`; the nodes are cloned and booted in the background;
|
|
// - the same ID with the same payload answers 200 with the current state of that lab, including
|
|
// `deleted` or `failed`, and never creates a second one;
|
|
// - the same ID with a different payload answers 422 `idempotency_key_reused` and changes nothing;
|
|
// - a new ID that does not fit the memory budget or the lab limit, or arrives while the provisioner
|
|
// is draining, answers 503 `lab_pool_busy` with Retry-After; nothing is stored, so the caller
|
|
// retries with the same ID.
|
|
//
|
|
// Payloads are compared by a SHA-256 fingerprint of the decoded request. An unknown template or
|
|
// template version, or a lifetime above the configured maximum, answers 400 `validation_failed` with a
|
|
// pointer such as `/template_id` or `/ttl_seconds`.
|
|
//
|
|
// The lab is deleted at `expires_at` = creation time + `ttl_seconds`, also when it is still
|
|
// provisioning. A lab that fails to provision or does not answer within the provisioning timeout
|
|
// becomes `failed` and its resources are deleted; its capacity returns when they are gone.
|
|
//
|
|
// A record of a deleted or failed lab is kept for a bounded retention time; after it, the ID is
|
|
// unknown again and a CreateLab with it starts a new lab.
|
|
//
|
|
// PUT /v1/labs/{lab_id}
|
|
func (UnimplementedHandler) CreateLab(ctx context.Context, req *LabCreateRequest, params CreateLabParams) (r CreateLabRes, _ error) {
|
|
return r, ht.ErrNotImplemented
|
|
}
|
|
|
|
// CreateLabConsoleToken implements CreateLabConsoleToken operation.
|
|
//
|
|
// The token lets the console gateway of the backend attach to the serial console of one node. It is
|
|
// random, single-use, bound to the lab and the node, and valid for at most 120 seconds; `labd` keeps
|
|
// only its SHA-256 digest in memory, so a restart invalidates every unused token. The token is never a
|
|
// node password or an SSH key, and the response carries no node address.
|
|
//
|
|
// Attaching: the gateway opens a WebSocket to `attach_path` on the same `labd` origin with the service
|
|
// bearer token and sends the console token in the `X-Lab-Console-Token` header. The WebSocket attach
|
|
// is described here as the planned interface; until it is implemented, `labd` answers the attach path
|
|
// with 501 and issuing a token changes nothing else.
|
|
//
|
|
// A lab that is not `ready` answers 409 `state_conflict`; an unknown node answers 400
|
|
// `validation_failed` with the pointer `/node`.
|
|
//
|
|
// POST /v1/labs/{lab_id}/console-tokens
|
|
func (UnimplementedHandler) CreateLabConsoleToken(ctx context.Context, req *ConsoleTokenRequest, params CreateLabConsoleTokenParams) (r *ConsoleTokenHeaders, _ error) {
|
|
return r, ht.ErrNotImplemented
|
|
}
|
|
|
|
// DeleteLab implements DeleteLab operation.
|
|
//
|
|
// Marks the lab for deletion and answers 202 with `state: deleting`; the provisioner removes its
|
|
// instances and bridges in the background and retries until LXD confirms that they are gone, also
|
|
// across its own restarts. Deleting a lab that is already `deleting` or `deleted` answers 200 with its
|
|
// state and changes nothing. An unknown ID answers 404 `not_found`.
|
|
//
|
|
// DELETE /v1/labs/{lab_id}
|
|
func (UnimplementedHandler) DeleteLab(ctx context.Context, params DeleteLabParams) (r DeleteLabRes, _ error) {
|
|
return r, ht.ErrNotImplemented
|
|
}
|
|
|
|
// GetLab implements GetLab operation.
|
|
//
|
|
// Answers 404 `not_found` for an ID the provisioner does not hold, including a lab whose `deleted`
|
|
// record outlived its retention time. The response never contains an address, a key, or an LXD object
|
|
// name.
|
|
//
|
|
// GET /v1/labs/{lab_id}
|
|
func (UnimplementedHandler) GetLab(ctx context.Context, params GetLabParams) (r *LabStatus, _ error) {
|
|
return r, ht.ErrNotImplemented
|
|
}
|
|
|
|
// GetLabdHealthz implements GetLabdHealthz operation.
|
|
//
|
|
// Check whether the lab provisioner process is responding.
|
|
//
|
|
// GET /healthz
|
|
func (UnimplementedHandler) GetLabdHealthz(ctx context.Context) (r *LabdHealthResponse, _ error) {
|
|
return r, ht.ErrNotImplemented
|
|
}
|
|
|
|
// GetLabdReadyz implements GetLabdReadyz operation.
|
|
//
|
|
// Ready means that the lab records were loaded, the startup reconciliation with LXD finished, the LXD
|
|
// API answered the latest probe, and the process is not draining. A provisioner without free capacity
|
|
// is still ready; capacity is reported by CreateLab.
|
|
//
|
|
// GET /readyz
|
|
func (UnimplementedHandler) GetLabdReadyz(ctx context.Context) (r GetLabdReadyzRes, _ error) {
|
|
return r, ht.ErrNotImplemented
|
|
}
|
|
|
|
// NewError creates *ProblemStatusCode from error returned by handler.
|
|
//
|
|
// Used for common default response.
|
|
func (UnimplementedHandler) NewError(ctx context.Context, err error) (r *ProblemStatusCode) {
|
|
r = new(ProblemStatusCode)
|
|
return r
|
|
}
|