Help us shape the future of Go! Take the 2026 Go Developer Survey

httpapi

package
v0.1.0-rc.6 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Package httpapi exposes the controller HTTP API with standard net/http handlers and chi.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(config Config, deps Dependencies) http.Handler

NewHandler assembles the router in one operation. The caller owns dependencies. Access policy (also applied to 404/405):

/healthz, /readyz, auth/setup, auth/login, auth/logout: public, with origin checks on auth writes.
auth/session, account/*, apikeys*, agentkeys*: browser session; account/key access also checks origins.
other /api/v1/*: browser session or an explicit management API key.
/v1/opamp, /v1/otlp/v1/metrics: separate agent credentials.

Types

type Config

type Config struct {
	Version      string
	SecureCookie bool
}

Config contains the controller version and transport settings for this router instance.

type Dependencies

type Dependencies struct {
	Agents         *agent.Store
	AgentKeys      *agentauth.Store
	Monitors       *monitor.Store
	AlertRules     *alert.Store
	Notifications  *notification.Store
	Silences       *notification.SilenceClient
	Configs        *remoteconfig.Store
	Auth           *auth.Store
	Sessions       SessionStore
	Prometheus     *prometheus.Client
	Logger         *slog.Logger
	CheckReadiness ReadinessChecker
	OpAMP          http.Handler
	OTLPMetrics    http.Handler
	// Frontend optionally serves unmatched browser paths; service prefixes stay reserved.
	Frontend http.Handler
	// NotifyAgentConfig delivers a committed target to live Agents.
	// It is required by Monitor creation, update and deletion.
	NotifyAgentConfig func(context.Context, agent.InstanceUID) error
}

Dependencies names the caller-owned stores, clients and protocol handlers. OpAMP and OTLPMetrics may be nil when those transports are not being assembled. AgentKeys is required by agent-key management and OTLP admission. All dependencies for registered management operations must be supplied by the caller.

type DependencyReadiness

type DependencyReadiness struct {
	Prometheus   bool
	Alertmanager bool
}

DependencyReadiness describes whether Arveld's observability dependencies are ready.

type ReadinessChecker

type ReadinessChecker func(context.Context) DependencyReadiness

ReadinessChecker returns the current readiness of Arveld's dependencies.

type SessionStore

type SessionStore interface {
	Find(ctx context.Context, token string) (auth.Session, bool, error)
	Rotate(ctx context.Context, previous string, verified auth.VerifiedCredentials) (auth.Session, error)
	Delete(ctx context.Context, token string) error
}

SessionStore is the session work HTTP consumes; auth owns token and storage formats. The caller owns persistence and its cleanup lifecycle.

Jump to

Keyboard shortcuts

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