api

package
v1.3.5 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: Apache-2.0 Imports: 24 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 implements beacon's REST configuration API: a huma-on-chi HTTP interface for CRUD over sources, sinks, and connectors. internal/app mounts the handler this package returns under the admin server's /api/ prefix. Every write goes through internal/config.Service, so the same structural + CEL validation and hot-apply reconcile that already governs the CLI (Phase 4) and internal/config's own tests governs the HTTP surface too — this package is a thin, typed HTTP skin over Service, not a second place business rules live.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(svc *config.Service, reg *stats.Registry, version string, log *slog.Logger, runtimeInfo ...RuntimeInfo) (http.Handler, huma.API)

New builds beacon's config REST API: a chi router with huma registered on it. Every operation is registered with its full "/api/v1/..." path (rather than relying on router-mount prefix stripping), so the returned handler can be mounted directly on a stdlib http.ServeMux via mux.Handle("/api/", handler) and still see the paths it registered.

reg backs the live-metrics endpoints (get-connector-metrics, list-metrics); it is unused by the entity CRUD endpoints.

version is embedded as the OpenAPI document's info.version and returned verbatim by GET /api/v1/system.

log receives the underlying error whenever a handler is about to answer 500 (the client only ever sees a sanitized "internal error" body); nil defaults to slog.Default(), the same convention as config.NewService.

Types

type RuntimeInfo

type RuntimeInfo struct {
	Identity  identity.Appliance
	Devices   func() []bus.DeviceInfo
	Buses     func() []bus.EndpointStatus
	Inventory *inventory.Registry
	Statuses  func() []supervisor.Status
	// Readiness reports failures of local capabilities required to accept work
	// (store and serving listeners). It returns only failing system statuses;
	// expected remote connectivity outages remain in Statuses and do not make
	// the API unavailable.
	Readiness func(context.Context) []supervisor.Status
	// Ready is the legacy single-store readiness seam retained for embeddings.
	// New composition roots should provide Readiness so all local failures have
	// the same component identity as the top-level health endpoint.
	Ready func(context.Context) error
	// Advisories are local degradation statuses that should be visible in the
	// same health body but do not make the process unable to accept work.
	Advisories func() []supervisor.Status
}

type StatusBody

type StatusBody struct {
	Status []supervisor.Status `json:"status" doc:"Supervisor statuses for the affected entity (filtered to its id)."`
}

StatusBody is the response body for every write endpoint (PUT, DELETE): the subset of the supervisor's live component statuses that pertain to the entity just written, letting a caller see the effect of a hot apply without a second round trip to a statuses endpoint.

Jump to

Keyboard shortcuts

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