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 ¶
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 ¶
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.