api

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: AGPL-3.0 Imports: 22 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package api serves the Kiln HTTP surface. The control listener is the only place these routes exist.

Index

Constants

View Source
const (
	CodeNotFound  = "not_found"
	CodeInvalid   = "invalid"
	CodeConflict  = "conflict"
	CodeExhausted = "exhausted"
	CodeInternal  = "internal"
)

Error codes are stable and part of the API.

View Source
const TenantHeader = "X-Kiln-Tenant"

TenantHeader names the tenant of one call. The gateway sets it after it authenticates the caller. The host trusts the name and enforces what that tenant reaches.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	Store     store.Store
	Templates *template.Manager
	Sandboxes *sandbox.Manager
	Token     string
	// FirecrackerVersion is the pinned version GET /v1/health reports.
	FirecrackerVersion string
	// Root is the Kiln root, for the status page's disk use.
	Root string
	// Base is the lifetime context for asynchronous work.
	Base context.Context
	// Viewers holds the people who open team previews. Nil on a host that
	// serves no preview.
	Viewers ViewerStore
	// SealKey seals a registry token before it reaches the database.
	SealKey []byte
}

Server holds the API dependencies.

func (*Server) Handler

func (s *Server) Handler() http.Handler

Handler returns the control surface: the /v1 API behind bearer authentication and the read-only status page at /.

type ViewerStore

type ViewerStore interface {
	// Create adds one viewer of one tenant.
	Create(ctx context.Context, tenant, address, password string) error
	// Exists reports whether an address already holds a viewer.
	Exists(ctx context.Context, address string) (bool, error)
	// List returns the viewers of one tenant.
	List(ctx context.Context, tenant string) ([]store.Viewer, error)
	// Delete revokes one viewer of one tenant.
	Delete(ctx context.Context, tenant, userID string) error
}

ViewerStore is the part of the viewer login the API touches. The ingress implements it; the interface keeps this package free of that import.

Jump to

Keyboard shortcuts

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