v1

package
v1.3.7 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: AGPL-3.0 Imports: 44 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RequestIDFrom added in v1.1.0

func RequestIDFrom(ctx context.Context) string

RequestIDFrom extracts the request ID from the context, if present.

func WriteError

func WriteError(w http.ResponseWriter, status int, code, message string)

WriteError writes a standard JSON error response.

func WriteJSON

func WriteJSON(w http.ResponseWriter, status int, v interface{})

WriteJSON writes a JSON response with the given status code.

Types

type AgentDirectory added in v1.3.0

type AgentDirectory interface {
	AgentNames(ctx context.Context) (map[string]AgentName, error)
}

AgentDirectory resolves agent_id → display identity so container responses can show which agent a remote container belongs to.

type AgentHandler added in v1.3.0

type AgentHandler struct {
	// contains filtered or unexported fields
}

func NewAgentHandler added in v1.3.0

func NewAgentHandler(
	store *sqlite.AgentStore,
	sessions AgentSessions,
	broker *SSEBroker,
	logger *slog.Logger,
	grpcPublicURL string,
	grpcListen string,
	staleThreshold time.Duration,
) *AgentHandler

func (*AgentHandler) HandleCreateEnrollmentToken added in v1.3.0

func (h *AgentHandler) HandleCreateEnrollmentToken(w http.ResponseWriter, r *http.Request)

func (*AgentHandler) HandleDeleteAgent added in v1.3.0

func (h *AgentHandler) HandleDeleteAgent(w http.ResponseWriter, r *http.Request)

func (*AgentHandler) HandleDeleteEnrollmentToken added in v1.3.0

func (h *AgentHandler) HandleDeleteEnrollmentToken(w http.ResponseWriter, r *http.Request)

func (*AgentHandler) HandleGetAgent added in v1.3.0

func (h *AgentHandler) HandleGetAgent(w http.ResponseWriter, r *http.Request)

func (*AgentHandler) HandleGetAgentMetrics added in v1.3.0

func (h *AgentHandler) HandleGetAgentMetrics(w http.ResponseWriter, r *http.Request)

func (*AgentHandler) HandleGetEnrollmentToken added in v1.3.0

func (h *AgentHandler) HandleGetEnrollmentToken(w http.ResponseWriter, r *http.Request)

func (*AgentHandler) HandleListAgents added in v1.3.0

func (h *AgentHandler) HandleListAgents(w http.ResponseWriter, r *http.Request)

func (*AgentHandler) HandleListEnrollmentTokens added in v1.3.0

func (h *AgentHandler) HandleListEnrollmentTokens(w http.ResponseWriter, r *http.Request)

func (*AgentHandler) HandleRevokeAgent added in v1.3.0

func (h *AgentHandler) HandleRevokeAgent(w http.ResponseWriter, r *http.Request)

func (*AgentHandler) HandleUpdateAgent added in v1.3.0

func (h *AgentHandler) HandleUpdateAgent(w http.ResponseWriter, r *http.Request)

type AgentName added in v1.3.0

type AgentName struct {
	Hostname string
	Label    string
}

AgentName holds the display identity of a remote agent.

type AgentSessions added in v1.3.0

type AgentSessions interface {
	IsConnected(agentID string) bool
	Close(agentID, reason string)
}

AgentSessions provides access to live agent stream state.

type AlertHandler

type AlertHandler struct {
	// contains filtered or unexported fields
}

AlertHandler handles alert-related HTTP endpoints.

func NewAlertHandler

func NewAlertHandler(alertStore alert.AlertStore, channelStore alert.ChannelStore, silenceStore alert.SilenceStore, notifier *alert.Notifier, broker *SSEBroker, allowPrivateWebhooks bool, escalator alert.Escalator) *AlertHandler

NewAlertHandler creates a new alert handler.

func (*AlertHandler) HandleAcknowledgeAlert added in v1.0.1

func (h *AlertHandler) HandleAcknowledgeAlert(w http.ResponseWriter, r *http.Request)

HandleAcknowledgeAlert handles POST /api/v1/alerts/{id}/acknowledge.

func (*AlertHandler) HandleCancelSilenceRule

func (h *AlertHandler) HandleCancelSilenceRule(w http.ResponseWriter, r *http.Request)

HandleCancelSilenceRule handles DELETE /api/v1/silence/{id}.

func (*AlertHandler) HandleCreateChannel

func (h *AlertHandler) HandleCreateChannel(w http.ResponseWriter, r *http.Request)

HandleCreateChannel handles POST /api/v1/channels.

func (*AlertHandler) HandleCreateSilenceRule

func (h *AlertHandler) HandleCreateSilenceRule(w http.ResponseWriter, r *http.Request)

HandleCreateSilenceRule handles POST /api/v1/silence.

func (*AlertHandler) HandleDeleteChannel

func (h *AlertHandler) HandleDeleteChannel(w http.ResponseWriter, r *http.Request)

HandleDeleteChannel handles DELETE /api/v1/channels/{id}.

func (*AlertHandler) HandleGetActiveAlerts

func (h *AlertHandler) HandleGetActiveAlerts(w http.ResponseWriter, r *http.Request)

HandleGetActiveAlerts handles GET /api/v1/alerts/active.

func (*AlertHandler) HandleGetAlert

func (h *AlertHandler) HandleGetAlert(w http.ResponseWriter, r *http.Request)

HandleGetAlert handles GET /api/v1/alerts/{id}.

func (*AlertHandler) HandleListAlerts

func (h *AlertHandler) HandleListAlerts(w http.ResponseWriter, r *http.Request)

HandleListAlerts handles GET /api/v1/alerts.

func (*AlertHandler) HandleListChannels

func (h *AlertHandler) HandleListChannels(w http.ResponseWriter, r *http.Request)

HandleListChannels handles GET /api/v1/channels.

func (*AlertHandler) HandleListSilenceRules

func (h *AlertHandler) HandleListSilenceRules(w http.ResponseWriter, r *http.Request)

HandleListSilenceRules handles GET /api/v1/silence.

func (*AlertHandler) HandleTestChannel

func (h *AlertHandler) HandleTestChannel(w http.ResponseWriter, r *http.Request)

HandleTestChannel handles POST /api/v1/channels/{id}/test.

func (*AlertHandler) HandleUpdateChannel

func (h *AlertHandler) HandleUpdateChannel(w http.ResponseWriter, r *http.Request)

HandleUpdateChannel handles PUT /api/v1/channels/{id}.

type AlertTriggerHandler added in v1.2.12

type AlertTriggerHandler struct {
	// contains filtered or unexported fields
}

AlertTriggerHandler handles /api/v1/alert-triggers/* endpoints.

func NewAlertTriggerHandler added in v1.2.12

func NewAlertTriggerHandler(ts alert.TriggerStore, cs alert.ChannelStore, broker *SSEBroker) *AlertTriggerHandler

NewAlertTriggerHandler constructs a new handler.

func (*AlertTriggerHandler) HandleCreateTrigger added in v1.2.12

func (h *AlertTriggerHandler) HandleCreateTrigger(w http.ResponseWriter, r *http.Request)

HandleCreateTrigger handles POST /api/v1/alert-triggers.

func (*AlertTriggerHandler) HandleDeleteTrigger added in v1.2.12

func (h *AlertTriggerHandler) HandleDeleteTrigger(w http.ResponseWriter, r *http.Request)

HandleDeleteTrigger handles DELETE /api/v1/alert-triggers/{id}.

func (*AlertTriggerHandler) HandleGetTrigger added in v1.2.12

func (h *AlertTriggerHandler) HandleGetTrigger(w http.ResponseWriter, r *http.Request)

HandleGetTrigger handles GET /api/v1/alert-triggers/{id}.

func (*AlertTriggerHandler) HandleListTriggers added in v1.2.12

func (h *AlertTriggerHandler) HandleListTriggers(w http.ResponseWriter, r *http.Request)

HandleListTriggers handles GET /api/v1/alert-triggers.

func (*AlertTriggerHandler) HandleUpdateTrigger added in v1.2.12

func (h *AlertTriggerHandler) HandleUpdateTrigger(w http.ResponseWriter, r *http.Request)

HandleUpdateTrigger handles PUT /api/v1/alert-triggers/{id}.

type CVEHandler

type CVEHandler struct {
	// contains filtered or unexported fields
}

CVEHandler handles CVE-related HTTP endpoints.

func NewCVEHandler

func NewCVEHandler(store update.UpdateStore) *CVEHandler

NewCVEHandler creates a new CVE handler.

func (*CVEHandler) HandleGetContainerCVEs

func (h *CVEHandler) HandleGetContainerCVEs(w http.ResponseWriter, r *http.Request)

HandleGetContainerCVEs handles GET /api/v1/cve/{container_id}.

func (*CVEHandler) HandleListCVEs

func (h *CVEHandler) HandleListCVEs(w http.ResponseWriter, r *http.Request)

HandleListCVEs handles GET /api/v1/cve.

type CertificateHandler

type CertificateHandler struct {
	// contains filtered or unexported fields
}

CertificateHandler handles certificate monitor CRUD endpoints.

func NewCertificateHandler

func NewCertificateHandler(svc *certificate.Service) *CertificateHandler

NewCertificateHandler creates a new certificate handler.

func (*CertificateHandler) HandleCreate

func (h *CertificateHandler) HandleCreate(w http.ResponseWriter, r *http.Request)

HandleCreate handles POST /api/v1/certificates

func (*CertificateHandler) HandleDelete

func (h *CertificateHandler) HandleDelete(w http.ResponseWriter, r *http.Request)

HandleDelete handles DELETE /api/v1/certificates/{id}

func (*CertificateHandler) HandleGet

func (h *CertificateHandler) HandleGet(w http.ResponseWriter, r *http.Request)

HandleGet handles GET /api/v1/certificates/{id}

func (*CertificateHandler) HandleList

func (h *CertificateHandler) HandleList(w http.ResponseWriter, r *http.Request)

HandleList handles GET /api/v1/certificates

func (*CertificateHandler) HandleListChecks

func (h *CertificateHandler) HandleListChecks(w http.ResponseWriter, r *http.Request)

HandleListChecks handles GET /api/v1/certificates/{id}/checks

func (*CertificateHandler) HandleUpdate

func (h *CertificateHandler) HandleUpdate(w http.ResponseWriter, r *http.Request)

HandleUpdate handles PUT /api/v1/certificates/{id}

type ContainerHandler

type ContainerHandler struct {
	// contains filtered or unexported fields
}

ContainerHandler handles container-related HTTP endpoints.

func NewContainerHandler

func NewContainerHandler(service *container.Service, uptime *container.UptimeCalculator) *ContainerHandler

NewContainerHandler creates a new container handler.

func (*ContainerHandler) HandleDelete

func (h *ContainerHandler) HandleDelete(w http.ResponseWriter, r *http.Request)

HandleDelete handles DELETE /api/v1/containers/{id}. Only allows deletion of non-running containers.

func (*ContainerHandler) HandleGet

func (h *ContainerHandler) HandleGet(w http.ResponseWriter, r *http.Request)

HandleGet handles GET /api/v1/containers/{id}.

func (*ContainerHandler) HandleList

func (h *ContainerHandler) HandleList(w http.ResponseWriter, r *http.Request)

HandleList handles GET /api/v1/containers.

func (*ContainerHandler) HandleLogs

func (h *ContainerHandler) HandleLogs(w http.ResponseWriter, r *http.Request)

HandleLogs handles GET /api/v1/containers/{id}/logs.

func (*ContainerHandler) HandleTransitions

func (h *ContainerHandler) HandleTransitions(w http.ResponseWriter, r *http.Request)

HandleTransitions handles GET /api/v1/containers/{id}/transitions.

func (*ContainerHandler) SetAgentDirectory added in v1.3.0

func (h *ContainerHandler) SetAgentDirectory(ad AgentDirectory)

SetAgentDirectory sets the agent directory for enriching remote containers with their originating agent's hostname/label.

func (*ContainerHandler) SetAgentSessions added in v1.3.0

func (h *ContainerHandler) SetAgentSessions(s agentLiveness)

SetAgentSessions wires live agent-stream state so containers reported by a disconnected remote agent can be flagged stale (their last-known state is no longer live). The runtimeChecker still governs the local runtime separately.

func (*ContainerHandler) SetContainerNameLister

func (h *ContainerHandler) SetContainerNameLister(cl ContainerNameLister)

SetContainerNameLister sets the K8s container name lister for detail endpoints.

func (*ContainerHandler) SetLogFetcher

func (h *ContainerHandler) SetLogFetcher(lf LogFetcher)

SetLogFetcher sets the log fetcher for the logs endpoint.

func (*ContainerHandler) SetRuntimeChecker added in v1.2.14

func (h *ContainerHandler) SetRuntimeChecker(rc RuntimeChecker)

SetRuntimeChecker injects the runtime availability checker.

func (*ContainerHandler) SetSecurityProvider added in v1.1.0

func (h *ContainerHandler) SetSecurityProvider(sp SecurityInsightProvider)

SetSecurityProvider sets the security insight provider for enriching container responses.

type ContainerInfoProvider added in v1.1.0

type ContainerInfoProvider interface {
	GetContainerInfo(ctx context.Context, externalID string) (update.ContainerInfo, error)
}

ContainerInfoProvider returns container metadata needed for command generation.

type ContainerNameLister

type ContainerNameLister interface {
	ListContainerNames(ctx context.Context, externalID string) ([]string, error)
}

ContainerNameLister lists container names in a K8s workload pod spec.

type EndpointHandler

type EndpointHandler struct {
	// contains filtered or unexported fields
}

EndpointHandler handles endpoint-related HTTP endpoints.

func NewEndpointHandler

func NewEndpointHandler(service *endpoint.Service, containerSvc *container.Service) *EndpointHandler

NewEndpointHandler creates a new endpoint handler.

func (*EndpointHandler) HandleCreateEndpoint added in v1.1.2

func (h *EndpointHandler) HandleCreateEndpoint(w http.ResponseWriter, r *http.Request)

HandleCreateEndpoint handles POST /api/v1/endpoints.

func (*EndpointHandler) HandleDeleteEndpoint added in v1.1.2

func (h *EndpointHandler) HandleDeleteEndpoint(w http.ResponseWriter, r *http.Request)

HandleDeleteEndpoint handles DELETE /api/v1/endpoints/{id}.

func (*EndpointHandler) HandleGetEndpoint

func (h *EndpointHandler) HandleGetEndpoint(w http.ResponseWriter, r *http.Request)

HandleGetEndpoint handles GET /api/v1/endpoints/{id}.

func (*EndpointHandler) HandleListChecks

func (h *EndpointHandler) HandleListChecks(w http.ResponseWriter, r *http.Request)

HandleListChecks handles GET /api/v1/endpoints/{id}/checks.

func (*EndpointHandler) HandleListContainerEndpoints

func (h *EndpointHandler) HandleListContainerEndpoints(w http.ResponseWriter, r *http.Request)

HandleListContainerEndpoints handles GET /api/v1/containers/{id}/endpoints.

func (*EndpointHandler) HandleListEndpoints

func (h *EndpointHandler) HandleListEndpoints(w http.ResponseWriter, r *http.Request)

HandleListEndpoints handles GET /api/v1/endpoints.

func (*EndpointHandler) HandleUpdateEndpoint added in v1.1.2

func (h *EndpointHandler) HandleUpdateEndpoint(w http.ResponseWriter, r *http.Request)

HandleUpdateEndpoint handles PUT /api/v1/endpoints/{id}.

func (*EndpointHandler) SetAgentSessions added in v1.3.0

func (h *EndpointHandler) SetAgentSessions(s agentLiveness)

SetAgentSessions wires live agent-stream state so agent-probed endpoints can be flagged stale when their reporting agent disconnects. Server-probed endpoints (no agent) are unaffected.

type EnrichedPing

type EnrichedPing struct {
	*heartbeat.HeartbeatPing
	ExpectedAt    *time.Time `json:"expected_at,omitempty"`
	GraceDeadline *time.Time `json:"grace_deadline,omitempty"`
}

EnrichedPing extends HeartbeatPing with computed timing fields.

type ErrorDetail

type ErrorDetail struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

ErrorDetail contains the error code and human-readable message.

type ErrorResponse

type ErrorResponse struct {
	Error ErrorDetail `json:"error"`
}

ErrorResponse represents the standard JSON error format.

type EscalationHandler added in v1.2.12

type EscalationHandler struct {
	// contains filtered or unexported fields
}

EscalationHandler handles HTTP endpoints for escalation policies.

func NewEscalationHandler added in v1.2.12

func NewEscalationHandler(svc *escalation.Service) *EscalationHandler

NewEscalationHandler creates a new EscalationHandler.

func (*EscalationHandler) HandleCreatePolicy added in v1.2.12

func (h *EscalationHandler) HandleCreatePolicy(w http.ResponseWriter, r *http.Request)

HandleCreatePolicy handles POST /api/v1/escalation-policies.

func (*EscalationHandler) HandleDeletePolicy added in v1.2.12

func (h *EscalationHandler) HandleDeletePolicy(w http.ResponseWriter, r *http.Request)

HandleDeletePolicy handles DELETE /api/v1/escalation-policies/{id}.

func (*EscalationHandler) HandleGetPolicy added in v1.2.12

func (h *EscalationHandler) HandleGetPolicy(w http.ResponseWriter, r *http.Request)

HandleGetPolicy handles GET /api/v1/escalation-policies/{id}.

func (*EscalationHandler) HandleGetRun added in v1.2.12

func (h *EscalationHandler) HandleGetRun(w http.ResponseWriter, r *http.Request)

HandleGetRun handles GET /api/v1/escalation-runs/{run_id}.

func (*EscalationHandler) HandleListAlertRuns added in v1.2.12

func (h *EscalationHandler) HandleListAlertRuns(w http.ResponseWriter, r *http.Request)

HandleListAlertRuns handles GET /api/v1/alerts/{alert_id}/escalation-runs.

func (*EscalationHandler) HandleListPolicies added in v1.2.12

func (h *EscalationHandler) HandleListPolicies(w http.ResponseWriter, r *http.Request)

HandleListPolicies handles GET /api/v1/escalation-policies.

func (*EscalationHandler) HandleListPolicyRuns added in v1.2.12

func (h *EscalationHandler) HandleListPolicyRuns(w http.ResponseWriter, r *http.Request)

HandleListPolicyRuns handles GET /api/v1/escalation-policies/{id}/runs.

func (*EscalationHandler) HandleOverlapProbe added in v1.2.12

func (h *EscalationHandler) HandleOverlapProbe(w http.ResponseWriter, r *http.Request)

HandleOverlapProbe handles POST /api/v1/escalation-policies/overlap-probe.

func (*EscalationHandler) HandleSetPolicyActive added in v1.2.12

func (h *EscalationHandler) HandleSetPolicyActive(w http.ResponseWriter, r *http.Request)

HandleSetPolicyActive handles PATCH /api/v1/escalation-policies/{id}/active.

func (*EscalationHandler) HandleUpdatePolicy added in v1.2.12

func (h *EscalationHandler) HandleUpdatePolicy(w http.ResponseWriter, r *http.Request)

HandleUpdatePolicy handles PUT /api/v1/escalation-policies/{id}.

type HandlerDeps added in v1.1.0

type HandlerDeps struct {
	// Core services
	Broker       *SSEBroker
	Runtime      runtime.Runtime
	Containers   *container.Service
	Uptime       *container.UptimeCalculator
	Endpoints    *endpoint.Service
	Heartbeats   *heartbeat.Service
	Certificates *certificate.Service
	Resources    *resource.Service
	Logger       *slog.Logger

	// Alert pipeline
	AlertStore   alert.AlertStore
	ChannelStore alert.ChannelStore
	TriggerStore alert.TriggerStore
	SilenceStore alert.SilenceStore
	Notifier     *alert.Notifier
	Escalator    alert.Escalator

	// Status page admin
	StatusComponents   status.ComponentStore
	StatusIncidents    status.IncidentStore
	StatusSubscribers  status.SubscriberStore
	StatusMaintenance  status.MaintenanceStore
	StatusSvc          *status.Service
	StatusBroker       *SSEBroker
	PersonalizationSvc *status.PersonalizationService

	// Webhooks
	WebhookStore webhook.WebhookSubscriptionStore

	// UI extras
	UptimeDaily      UptimeDailyFetcher
	LogStreamer      LogStreamer
	ResourceTopSvc   ResourceTopService
	SparklineFetcher SparklineDataFetcher

	// Update intelligence
	UpdateSvc        *update.Service
	UpdateStore      update.UpdateStore
	ContainerAdapter ContainerInfoProvider

	// Security
	SecuritySvc *security.Service
	Scorer      *security.Scorer
	AckStore    security.AcknowledgmentStore

	// Escalation policies
	EscalationSvc *escalation.Service

	// License
	LicenseMgr *license.Manager

	// Swarm
	SwarmCluster        func() *swarm.SwarmCluster
	SwarmDiscovery      func() *swarm.ServiceDiscovery
	SwarmDetector       func() *swarm.Detector
	SwarmNodeStore      swarm.NodeStore
	SwarmUpdateTracker  *swarm.UpdateTracker
	SwarmCrashLoop      *swarm.CrashLoopDetector
	SwarmReplicaChecker *swarm.ReplicaHealthChecker
	SwarmTopologyStore  *sqlite.SwarmTopologyStore

	// Kubernetes (per-agent store-backed reads)
	KubernetesStore *sqlite.KubernetesStore

	// Multi-host agents (Pro)
	AgentStore          *sqlite.AgentStore
	AgentSessions       AgentSessions
	GRPCPublicURL       string
	GRPCListen          string
	AgentStaleThreshold time.Duration

	// HTTP config
	CORSOrigins          string // comma-separated origins or "*"
	MaxBodySize          int64  // 0 = 1MB default
	BuildVersion         string
	OrganisationName     string
	AllowPrivateWebhooks bool // dev only: skip HTTPS + SSRF check on webhook URLs
	StatusURL            string
}

HandlerDeps holds all dependencies needed to build the API handler.

type HeartbeatHandler

type HeartbeatHandler struct {
	// contains filtered or unexported fields
}

HeartbeatHandler handles heartbeat CRUD endpoints.

func NewHeartbeatHandler

func NewHeartbeatHandler(svc *heartbeat.Service) *HeartbeatHandler

NewHeartbeatHandler creates a new heartbeat handler.

func (*HeartbeatHandler) HandleCreate

func (h *HeartbeatHandler) HandleCreate(w http.ResponseWriter, r *http.Request)

HandleCreate handles POST /api/v1/heartbeats

func (*HeartbeatHandler) HandleDelete

func (h *HeartbeatHandler) HandleDelete(w http.ResponseWriter, r *http.Request)

HandleDelete handles DELETE /api/v1/heartbeats/{id}

func (*HeartbeatHandler) HandleGet

func (h *HeartbeatHandler) HandleGet(w http.ResponseWriter, r *http.Request)

HandleGet handles GET /api/v1/heartbeats/{id}

func (*HeartbeatHandler) HandleList

func (h *HeartbeatHandler) HandleList(w http.ResponseWriter, r *http.Request)

HandleList handles GET /api/v1/heartbeats

func (*HeartbeatHandler) HandleListExecutions

func (h *HeartbeatHandler) HandleListExecutions(w http.ResponseWriter, r *http.Request)

HandleListExecutions handles GET /api/v1/heartbeats/{id}/executions

func (*HeartbeatHandler) HandleListPings

func (h *HeartbeatHandler) HandleListPings(w http.ResponseWriter, r *http.Request)

HandleListPings handles GET /api/v1/heartbeats/{id}/pings

func (*HeartbeatHandler) HandlePause

func (h *HeartbeatHandler) HandlePause(w http.ResponseWriter, r *http.Request)

HandlePause handles POST /api/v1/heartbeats/{id}/pause

func (*HeartbeatHandler) HandleResume

func (h *HeartbeatHandler) HandleResume(w http.ResponseWriter, r *http.Request)

HandleResume handles POST /api/v1/heartbeats/{id}/resume

func (*HeartbeatHandler) HandleUpdate

func (h *HeartbeatHandler) HandleUpdate(w http.ResponseWriter, r *http.Request)

HandleUpdate handles PUT /api/v1/heartbeats/{id}

type K8sMetricsProvider added in v1.2.0

type K8sMetricsProvider interface {
	MetricsAvailable() bool
	GetPodMetrics(ctx context.Context, namespace, name string) (*kubernetes.PodResourceMetrics, error)
	GetNodeMetrics(ctx context.Context, name string) (*kubernetes.NodeResourceMetrics, error)
}

K8sMetricsProvider is an optional interface for runtimes that can query pod/node metrics. Only meaningful for the server's own local cluster (live metrics-server); remote agents do not ship metrics, so requests scoped to a remote agent report metrics as unavailable.

type KubernetesHandler added in v1.2.0

type KubernetesHandler struct {
	// contains filtered or unexported fields
}

KubernetesHandler handles Kubernetes API endpoints. Reads are served from the per-agent store (fed by the local runtime under LocalAgent and by remote agents), so the views work regardless of the server's own runtime.

func NewKubernetesHandler added in v1.2.0

func NewKubernetesHandler(store kubernetesStore, metrics K8sMetricsProvider) *KubernetesHandler

NewKubernetesHandler creates a new KubernetesHandler. metrics may be nil when the server has no live metrics-capable cluster.

func (*KubernetesHandler) HandleGetCluster added in v1.2.0

func (h *KubernetesHandler) HandleGetCluster(w http.ResponseWriter, r *http.Request)

HandleGetCluster handles GET /api/v1/kubernetes/cluster. The overview is aggregated from the per-agent store rather than a live cluster query.

func (*KubernetesHandler) HandleGetNodeResources added in v1.2.0

func (h *KubernetesHandler) HandleGetNodeResources(w http.ResponseWriter, r *http.Request)

HandleGetNodeResources handles GET /api/v1/kubernetes/nodes/{name}/resources (Pro). Returns node-level CPU/RAM from metrics-server.

func (*KubernetesHandler) HandleGetPodDetail added in v1.2.0

func (h *KubernetesHandler) HandleGetPodDetail(w http.ResponseWriter, r *http.Request)

HandleGetPodDetail handles GET /api/v1/kubernetes/pods/{namespace}/{name}.

func (*KubernetesHandler) HandleGetWorkload added in v1.2.0

func (h *KubernetesHandler) HandleGetWorkload(w http.ResponseWriter, r *http.Request)

HandleGetWorkload handles GET /api/v1/kubernetes/workloads/{id}. The id path value is URL-encoded (namespace%2FKind%2Fname).

func (*KubernetesHandler) HandleGetWorkloadResources added in v1.2.0

func (h *KubernetesHandler) HandleGetWorkloadResources(w http.ResponseWriter, r *http.Request)

HandleGetWorkloadResources handles GET /api/v1/kubernetes/workloads/{id}/resources (Pro). Returns per-pod CPU/RAM from metrics-server.

func (*KubernetesHandler) HandleListNamespaces added in v1.2.0

func (h *KubernetesHandler) HandleListNamespaces(w http.ResponseWriter, r *http.Request)

HandleListNamespaces handles GET /api/v1/kubernetes/namespaces.

func (*KubernetesHandler) HandleListNodes added in v1.2.0

func (h *KubernetesHandler) HandleListNodes(w http.ResponseWriter, r *http.Request)

HandleListNodes handles GET /api/v1/kubernetes/nodes.

func (*KubernetesHandler) HandleListPods added in v1.2.0

func (h *KubernetesHandler) HandleListPods(w http.ResponseWriter, r *http.Request)

HandleListPods handles GET /api/v1/kubernetes/pods. Query params: namespaces (comma-separated), workload, node, status.

func (*KubernetesHandler) HandleListWorkloads added in v1.2.0

func (h *KubernetesHandler) HandleListWorkloads(w http.ResponseWriter, r *http.Request)

HandleListWorkloads handles GET /api/v1/kubernetes/workloads. Query params: agent_id, namespaces (comma-separated), kind, status.

func (*KubernetesHandler) SetAgentDirectory added in v1.3.0

func (h *KubernetesHandler) SetAgentDirectory(ad AgentDirectory)

SetAgentDirectory wires agent name resolution so multi-host list views can show which agent each remote workload/pod belongs to.

func (*KubernetesHandler) SetAgentSessions added in v1.3.0

func (h *KubernetesHandler) SetAgentSessions(s agentLiveness)

SetAgentSessions wires live agent-stream state so reads can flag entities whose reporting agent is offline (their last-known status is no longer live).

type LogFetcher

type LogFetcher interface {
	FetchLogs(ctx context.Context, containerID string, lines int, timestamps bool) ([]string, error)
}

LogFetcher abstracts Docker log retrieval for the API layer.

type LogStreamHandler

type LogStreamHandler struct {
	// contains filtered or unexported fields
}

LogStreamHandler handles SSE log streaming endpoints.

func NewLogStreamHandler

func NewLogStreamHandler(streamer LogStreamer, svc *container.Service) *LogStreamHandler

NewLogStreamHandler creates a new log stream handler.

func (*LogStreamHandler) HandleLogStream

func (h *LogStreamHandler) HandleLogStream(w http.ResponseWriter, r *http.Request)

HandleLogStream handles GET /api/v1/containers/{id}/logs/stream. It opens an SSE connection and streams container logs in real-time.

func (*LogStreamHandler) SetRuntimeChecker added in v1.2.14

func (h *LogStreamHandler) SetRuntimeChecker(rc RuntimeChecker)

SetRuntimeChecker injects the runtime availability checker.

type LogStreamer

type LogStreamer interface {
	// StreamLogs returns an io.ReadCloser for following container logs.
	// The reader must be closed by the caller. Demuxing (if needed) is handled internally by the runtime.
	StreamLogs(ctx context.Context, externalID string, lines int, timestamps bool) (io.ReadCloser, error)
}

LogStreamer abstracts runtime log streaming for the API layer.

type PersonalizationHandler added in v1.2.11

type PersonalizationHandler struct {
	// contains filtered or unexported fields
}

func NewPersonalizationHandler added in v1.2.11

func NewPersonalizationHandler(svc *status.PersonalizationService) *PersonalizationHandler

func (*PersonalizationHandler) HandleCreateFAQItem added in v1.2.11

func (h *PersonalizationHandler) HandleCreateFAQItem(w http.ResponseWriter, r *http.Request)
func (h *PersonalizationHandler) HandleCreateFooterLink(w http.ResponseWriter, r *http.Request)

func (*PersonalizationHandler) HandleDeleteAsset added in v1.2.11

func (h *PersonalizationHandler) HandleDeleteAsset(w http.ResponseWriter, r *http.Request)

func (*PersonalizationHandler) HandleDeleteFAQItem added in v1.2.11

func (h *PersonalizationHandler) HandleDeleteFAQItem(w http.ResponseWriter, r *http.Request)
func (h *PersonalizationHandler) HandleDeleteFooterLink(w http.ResponseWriter, r *http.Request)

func (*PersonalizationHandler) HandleGetAsset added in v1.2.11

func (h *PersonalizationHandler) HandleGetAsset(w http.ResponseWriter, r *http.Request)

func (*PersonalizationHandler) HandleGetSettings added in v1.2.11

func (h *PersonalizationHandler) HandleGetSettings(w http.ResponseWriter, r *http.Request)

func (*PersonalizationHandler) HandleListFAQ added in v1.2.11

func (h *PersonalizationHandler) HandleListFAQ(w http.ResponseWriter, r *http.Request)
func (h *PersonalizationHandler) HandleListFooterLinks(w http.ResponseWriter, r *http.Request)

func (*PersonalizationHandler) HandlePutAsset added in v1.2.11

func (h *PersonalizationHandler) HandlePutAsset(w http.ResponseWriter, r *http.Request)

func (*PersonalizationHandler) HandlePutSettings added in v1.2.11

func (h *PersonalizationHandler) HandlePutSettings(w http.ResponseWriter, r *http.Request)

func (*PersonalizationHandler) HandleReorderFAQ added in v1.2.11

func (h *PersonalizationHandler) HandleReorderFAQ(w http.ResponseWriter, r *http.Request)
func (h *PersonalizationHandler) HandleReorderFooterLinks(w http.ResponseWriter, r *http.Request)

func (*PersonalizationHandler) HandleUpdateFAQItem added in v1.2.11

func (h *PersonalizationHandler) HandleUpdateFAQItem(w http.ResponseWriter, r *http.Request)
func (h *PersonalizationHandler) HandleUpdateFooterLink(w http.ResponseWriter, r *http.Request)

type PingHandler

type PingHandler struct {
	// contains filtered or unexported fields
}

PingHandler handles public ping endpoints.

func NewPingHandler

func NewPingHandler(svc *heartbeat.Service) *PingHandler

NewPingHandler creates a new ping handler.

func (*PingHandler) HandleExitCodePing

func (h *PingHandler) HandleExitCodePing(w http.ResponseWriter, r *http.Request)

HandleExitCodePing handles GET|POST /ping/{uuid}/{exit_code}

func (*PingHandler) HandlePing

func (h *PingHandler) HandlePing(w http.ResponseWriter, r *http.Request)

HandlePing handles GET|POST /ping/{uuid}

func (*PingHandler) HandleStartPing

func (h *PingHandler) HandleStartPing(w http.ResponseWriter, r *http.Request)

HandleStartPing handles GET|POST /ping/{uuid}/start

type PostureHandler added in v1.1.0

type PostureHandler struct {
	// contains filtered or unexported fields
}

PostureHandler handles security posture HTTP endpoints.

func NewPostureHandler added in v1.1.0

func NewPostureHandler(scorer *security.Scorer, containerSvc *container.Service, ackStore security.AcknowledgmentStore, alertStore alert.AlertStore, securitySvc *security.Service, broker *SSEBroker) *PostureHandler

NewPostureHandler creates a new posture handler.

func (*PostureHandler) HandleCreateAcknowledgment added in v1.1.0

func (h *PostureHandler) HandleCreateAcknowledgment(w http.ResponseWriter, r *http.Request)

HandleCreateAcknowledgment handles POST /api/v1/security/acknowledgments.

func (*PostureHandler) HandleDeleteAcknowledgment added in v1.1.0

func (h *PostureHandler) HandleDeleteAcknowledgment(w http.ResponseWriter, r *http.Request)

HandleDeleteAcknowledgment handles DELETE /api/v1/security/acknowledgments/{id}.

func (*PostureHandler) HandleGetContainerPosture added in v1.1.0

func (h *PostureHandler) HandleGetContainerPosture(w http.ResponseWriter, r *http.Request)

HandleGetContainerPosture handles GET /api/v1/security/posture/containers/{container_id}.

func (*PostureHandler) HandleGetPosture added in v1.1.0

func (h *PostureHandler) HandleGetPosture(w http.ResponseWriter, r *http.Request)

HandleGetPosture handles GET /api/v1/security/posture.

func (*PostureHandler) HandleListAcknowledgments added in v1.1.0

func (h *PostureHandler) HandleListAcknowledgments(w http.ResponseWriter, r *http.Request)

HandleListAcknowledgments handles GET /api/v1/security/acknowledgments.

func (*PostureHandler) HandleListContainerPostures added in v1.1.0

func (h *PostureHandler) HandleListContainerPostures(w http.ResponseWriter, r *http.Request)

HandleListContainerPostures handles GET /api/v1/security/posture/containers.

type ResourceHandler

type ResourceHandler struct {
	// contains filtered or unexported fields
}

ResourceHandler handles resource monitoring HTTP endpoints.

func NewResourceHandler

func NewResourceHandler(service *resource.Service) *ResourceHandler

NewResourceHandler creates a new resource handler.

func (*ResourceHandler) HandleGetAlertConfig

func (h *ResourceHandler) HandleGetAlertConfig(w http.ResponseWriter, r *http.Request)

HandleGetAlertConfig handles GET /api/v1/containers/{id}/resources/alerts.

func (*ResourceHandler) HandleGetCurrent

func (h *ResourceHandler) HandleGetCurrent(w http.ResponseWriter, r *http.Request)

HandleGetCurrent handles GET /api/v1/containers/{id}/resources/current.

func (*ResourceHandler) HandleGetHistory

func (h *ResourceHandler) HandleGetHistory(w http.ResponseWriter, r *http.Request)

HandleGetHistory handles GET /api/v1/containers/{id}/resources/history.

func (*ResourceHandler) HandleGetHosts added in v1.3.0

func (h *ResourceHandler) HandleGetHosts(w http.ResponseWriter, r *http.Request)

HandleGetHosts handles GET /api/v1/resources/hosts. It lists every known host (the local server plus each remote agent) with its current CPU/mem/disk and running-container count, so the UI can offer a host selector.

func (*ResourceHandler) HandleGetSummary

func (h *ResourceHandler) HandleGetSummary(w http.ResponseWriter, r *http.Request)

HandleGetSummary handles GET /api/v1/resources/summary[?agent_id=local|<id>]. Without agent_id it reports the local server host (preserving prior behaviour).

func (*ResourceHandler) HandleUpsertAlertConfig

func (h *ResourceHandler) HandleUpsertAlertConfig(w http.ResponseWriter, r *http.Request)

HandleUpsertAlertConfig handles PUT /api/v1/containers/{id}/resources/alerts.

func (*ResourceHandler) SetAgentDirectory added in v1.3.0

func (h *ResourceHandler) SetAgentDirectory(d AgentDirectory)

SetAgentDirectory wires the agent directory so /resources/hosts can label remote hosts with their hostname/label. Nil-safe (falls back to ids).

type ResourceTopHandler

type ResourceTopHandler struct {
	// contains filtered or unexported fields
}

ResourceTopHandler handles top resource consumers endpoints.

func NewResourceTopHandler

func NewResourceTopHandler(svc ResourceTopService) *ResourceTopHandler

NewResourceTopHandler creates a new top consumers handler.

func (*ResourceTopHandler) HandleGetTopConsumers

func (h *ResourceTopHandler) HandleGetTopConsumers(w http.ResponseWriter, r *http.Request)

HandleGetTopConsumers handles GET /api/v1/resources/top?metric=cpu|memory&limit=5&period=1h|24h|7d|30d.

type ResourceTopService

type ResourceTopService interface {
	GetAllLatestSnapshots() map[string]*resource.ResourceSnapshot
	GetContainerName(containerID string) string
	GetTopConsumersByPeriod(ctx context.Context, metric, period string, limit int, agentID *string) ([]resource.TopConsumerRow, error)
}

ResourceTopService abstracts the resource service for top consumers.

type RiskHandler

type RiskHandler struct {
	// contains filtered or unexported fields
}

RiskHandler handles risk score HTTP endpoints.

func NewRiskHandler

func NewRiskHandler(store update.UpdateStore) *RiskHandler

NewRiskHandler creates a new risk handler.

func (*RiskHandler) HandleGetContainerRisk

func (h *RiskHandler) HandleGetContainerRisk(w http.ResponseWriter, r *http.Request)

HandleGetContainerRisk handles GET /api/v1/risk/{container_id...}. When the ?period= query param is present (24h, 7d, 30d), returns risk score history instead of the current risk snapshot.

func (*RiskHandler) HandleListRiskScores

func (h *RiskHandler) HandleListRiskScores(w http.ResponseWriter, r *http.Request)

HandleListRiskScores handles GET /api/v1/risk.

type Router

type Router struct {
	// contains filtered or unexported fields
}

Router sets up the /api/v1 route group.

func NewRouter

func NewRouter(d HandlerDeps) *Router

NewRouter creates a new API v1 router from the unified HandlerDeps.

func (*Router) Handler

func (r *Router) Handler() http.Handler

Handler returns the HTTP handler with the full middleware chain applied. Middleware order (outermost to innermost): panicRecovery → requestLogger → requestID → cors → bodyLimit → mux

type RuntimeChecker added in v1.2.14

type RuntimeChecker interface {
	IsConnected() bool
}

RuntimeChecker reports whether the container runtime is currently connected.

type SSEBroker

type SSEBroker struct {
	// contains filtered or unexported fields
}

SSEBroker manages Server-Sent Event connections and broadcasts events.

func NewSSEBroker

func NewSSEBroker(logger *slog.Logger) *SSEBroker

NewSSEBroker creates a new SSE broker.

func (*SSEBroker) AddObserver

func (b *SSEBroker) AddObserver(ch chan SSEEvent)

AddObserver registers a channel that receives all broadcast events (non-blocking).

func (*SSEBroker) Broadcast

func (b *SSEBroker) Broadcast(event SSEEvent)

Broadcast sends an event to all connected SSE clients and observers.

func (*SSEBroker) BroadcastEvent added in v1.3.0

func (b *SSEBroker) BroadcastEvent(eventType string, data any)

BroadcastEvent is a convenience wrapper used by packages that cannot import SSEEvent directly.

func (*SSEBroker) ClientCount

func (b *SSEBroker) ClientCount() int

ClientCount returns the number of connected SSE clients.

func (*SSEBroker) RemoveObserver

func (b *SSEBroker) RemoveObserver(ch chan SSEEvent)

RemoveObserver unregisters an observer channel.

func (*SSEBroker) ServeHTTP

func (b *SSEBroker) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP handles SSE connections.

type SSEEvent

type SSEEvent struct {
	Type string      `json:"type"`
	Data interface{} `json:"data"`
}

SSEEvent represents an event to be sent to SSE clients.

type SecurityHandler added in v1.1.0

type SecurityHandler struct {
	// contains filtered or unexported fields
}

SecurityHandler handles security insight HTTP endpoints.

func NewSecurityHandler added in v1.1.0

func NewSecurityHandler(secSvc *security.Service, containerSvc *container.Service) *SecurityHandler

NewSecurityHandler creates a new security handler.

func (*SecurityHandler) HandleGetContainerInsights added in v1.1.0

func (h *SecurityHandler) HandleGetContainerInsights(w http.ResponseWriter, r *http.Request)

HandleGetContainerInsights handles GET /api/v1/security/insights/{container_id}.

func (*SecurityHandler) HandleGetSummary added in v1.1.0

func (h *SecurityHandler) HandleGetSummary(w http.ResponseWriter, r *http.Request)

HandleGetSummary handles GET /api/v1/security/summary.

func (*SecurityHandler) HandleListInsights added in v1.1.0

func (h *SecurityHandler) HandleListInsights(w http.ResponseWriter, r *http.Request)

HandleListInsights handles GET /api/v1/security/insights.

type SecurityInsightProvider added in v1.1.0

type SecurityInsightProvider interface {
	InsightCount(containerID string) (int, string)
}

SecurityInsightProvider provides security insight counts for containers.

type SparklineDataFetcher

type SparklineDataFetcher interface {
	GetSparklineData(ctx context.Context, limit int) (map[string][]float64, error)
}

SparklineDataFetcher abstracts the endpoint store for sparkline data.

type SparklineHandler

type SparklineHandler struct {
	// contains filtered or unexported fields
}

SparklineHandler handles the batch sparkline endpoint.

func NewSparklineHandler

func NewSparklineHandler(store SparklineDataFetcher) *SparklineHandler

NewSparklineHandler creates a new sparkline handler.

func (*SparklineHandler) HandleGetSparklines

func (h *SparklineHandler) HandleGetSparklines(w http.ResponseWriter, r *http.Request)

HandleGetSparklines handles GET /api/v1/dashboard/sparklines.

type StatusAdminHandler

type StatusAdminHandler struct {
	// contains filtered or unexported fields
}

StatusAdminHandler handles admin endpoints for the public status page.

func NewStatusAdminHandler

func NewStatusAdminHandler(
	components status.ComponentStore,
	incidents status.IncidentStore,
	subscribers status.SubscriberStore,
	maintenance status.MaintenanceStore,
	statusSvc *status.Service,
	broker *SSEBroker,
) *StatusAdminHandler

NewStatusAdminHandler creates a new status admin handler.

func (*StatusAdminHandler) HandleCreateComponent

func (h *StatusAdminHandler) HandleCreateComponent(w http.ResponseWriter, r *http.Request)

func (*StatusAdminHandler) HandleCreateIncident

func (h *StatusAdminHandler) HandleCreateIncident(w http.ResponseWriter, r *http.Request)

func (*StatusAdminHandler) HandleCreateMaintenance

func (h *StatusAdminHandler) HandleCreateMaintenance(w http.ResponseWriter, r *http.Request)

func (*StatusAdminHandler) HandleDeleteComponent

func (h *StatusAdminHandler) HandleDeleteComponent(w http.ResponseWriter, r *http.Request)

func (*StatusAdminHandler) HandleDeleteIncident

func (h *StatusAdminHandler) HandleDeleteIncident(w http.ResponseWriter, r *http.Request)

func (*StatusAdminHandler) HandleDeleteMaintenance

func (h *StatusAdminHandler) HandleDeleteMaintenance(w http.ResponseWriter, r *http.Request)

func (*StatusAdminHandler) HandleGetSmtpConfig

func (h *StatusAdminHandler) HandleGetSmtpConfig(w http.ResponseWriter, r *http.Request)

func (*StatusAdminHandler) HandleListComponents

func (h *StatusAdminHandler) HandleListComponents(w http.ResponseWriter, r *http.Request)

func (*StatusAdminHandler) HandleListIncidents

func (h *StatusAdminHandler) HandleListIncidents(w http.ResponseWriter, r *http.Request)

func (*StatusAdminHandler) HandleListMaintenance

func (h *StatusAdminHandler) HandleListMaintenance(w http.ResponseWriter, r *http.Request)

func (*StatusAdminHandler) HandleListSubscribers

func (h *StatusAdminHandler) HandleListSubscribers(w http.ResponseWriter, r *http.Request)

func (*StatusAdminHandler) HandlePostUpdate

func (h *StatusAdminHandler) HandlePostUpdate(w http.ResponseWriter, r *http.Request)

func (*StatusAdminHandler) HandleTestSmtp

func (h *StatusAdminHandler) HandleTestSmtp(w http.ResponseWriter, r *http.Request)

func (*StatusAdminHandler) HandleUpdateComponent

func (h *StatusAdminHandler) HandleUpdateComponent(w http.ResponseWriter, r *http.Request)

func (*StatusAdminHandler) HandleUpdateIncident

func (h *StatusAdminHandler) HandleUpdateIncident(w http.ResponseWriter, r *http.Request)

func (*StatusAdminHandler) HandleUpdateMaintenance

func (h *StatusAdminHandler) HandleUpdateMaintenance(w http.ResponseWriter, r *http.Request)

func (*StatusAdminHandler) HandleUpdateSmtpConfig

func (h *StatusAdminHandler) HandleUpdateSmtpConfig(w http.ResponseWriter, r *http.Request)

type SwarmHandler added in v1.2.0

type SwarmHandler struct {
	// contains filtered or unexported fields
}

SwarmHandler handles Swarm API endpoints. The services/tasks/nodes lists are store-backed (per-agent); the Pro live dashboards (dashboard, cluster, update-status, resources) still read the server's own live runtime.

func NewSwarmHandler added in v1.2.0

func NewSwarmHandler(
	clusterFn func() *swarm.SwarmCluster,
	discoveryFn func() *swarm.ServiceDiscovery,
	detectorFn func() *swarm.Detector,
	topo swarmTopologyReader,
	nodeStore swarm.NodeStore,
	updateTracker *swarm.UpdateTracker,
	crashLoop *swarm.CrashLoopDetector,
	replicaChecker *swarm.ReplicaHealthChecker,
	containerSvc *container.Service,
	resourceSvc *resource.Service,
) *SwarmHandler

NewSwarmHandler creates a new Swarm API handler.

func (*SwarmHandler) HandleGetCluster added in v1.2.0

func (h *SwarmHandler) HandleGetCluster(w http.ResponseWriter, r *http.Request)

HandleGetCluster handles GET /api/v1/swarm/cluster (Pro).

func (*SwarmHandler) HandleGetDashboard added in v1.2.0

func (h *SwarmHandler) HandleGetDashboard(w http.ResponseWriter, r *http.Request)

HandleGetDashboard handles GET /api/v1/swarm/dashboard (Pro).

func (*SwarmHandler) HandleGetInfo added in v1.2.0

func (h *SwarmHandler) HandleGetInfo(w http.ResponseWriter, r *http.Request)

HandleGetInfo handles GET /api/v1/swarm/info.

func (*SwarmHandler) HandleGetNodeDetail added in v1.2.0

func (h *SwarmHandler) HandleGetNodeDetail(w http.ResponseWriter, r *http.Request)

HandleGetNodeDetail handles GET /api/v1/swarm/nodes/{nodeID} (Pro).

func (*SwarmHandler) HandleGetService added in v1.2.0

func (h *SwarmHandler) HandleGetService(w http.ResponseWriter, r *http.Request)

HandleGetService handles GET /api/v1/swarm/services/{serviceID}.

func (*SwarmHandler) HandleGetServiceResources added in v1.2.0

func (h *SwarmHandler) HandleGetServiceResources(w http.ResponseWriter, r *http.Request)

HandleGetServiceResources handles GET /api/v1/swarm/services/{serviceID}/resources (Pro). Returns per-task CPU/RAM/network snapshots for a Swarm service.

func (*SwarmHandler) HandleGetUpdateStatus added in v1.2.0

func (h *SwarmHandler) HandleGetUpdateStatus(w http.ResponseWriter, r *http.Request)

HandleGetUpdateStatus handles GET /api/v1/swarm/services/{serviceID}/update-status (Pro).

func (*SwarmHandler) HandleListNodes added in v1.2.0

func (h *SwarmHandler) HandleListNodes(w http.ResponseWriter, r *http.Request)

HandleListNodes handles GET /api/v1/swarm/nodes (Pro).

func (*SwarmHandler) HandleListServices added in v1.2.0

func (h *SwarmHandler) HandleListServices(w http.ResponseWriter, r *http.Request)

HandleListServices handles GET /api/v1/swarm/services. Store-backed and per-agent: query param agent_id ("local" → server's own swarm, "" → all).

func (*SwarmHandler) HandleListTasks added in v1.2.0

func (h *SwarmHandler) HandleListTasks(w http.ResponseWriter, r *http.Request)

HandleListTasks handles GET /api/v1/swarm/tasks.

func (*SwarmHandler) SetAgentDirectory added in v1.3.0

func (h *SwarmHandler) SetAgentDirectory(ad AgentDirectory)

SetAgentDirectory wires agent name resolution so multi-host list views can show which agent each remote service/task belongs to.

type TopConsumer

type TopConsumer struct {
	ContainerID   string  `json:"container_id"`
	ContainerName string  `json:"container_name"`
	Value         float64 `json:"value"`
	Percent       float64 `json:"percent"`
	Rank          int     `json:"rank"`
}

TopConsumer represents a ranked container in the top consumers response.

type UpdateHandler

type UpdateHandler struct {
	// contains filtered or unexported fields
}

UpdateHandler handles update intelligence HTTP endpoints.

func NewUpdateHandler

func NewUpdateHandler(service *update.Service, store update.UpdateStore, containers ContainerInfoProvider) *UpdateHandler

NewUpdateHandler creates a new update handler.

func (*UpdateHandler) HandleCreateExclusion

func (h *UpdateHandler) HandleCreateExclusion(w http.ResponseWriter, r *http.Request)

HandleCreateExclusion handles POST /api/v1/updates/exclusions.

func (*UpdateHandler) HandleDeleteExclusion

func (h *UpdateHandler) HandleDeleteExclusion(w http.ResponseWriter, r *http.Request)

HandleDeleteExclusion handles DELETE /api/v1/updates/exclusions/{id}.

func (*UpdateHandler) HandleGetContainerUpdate

func (h *UpdateHandler) HandleGetContainerUpdate(w http.ResponseWriter, r *http.Request)

HandleGetContainerUpdate handles GET /api/v1/updates/{container_id}.

func (*UpdateHandler) HandleGetDryRun

func (h *UpdateHandler) HandleGetDryRun(w http.ResponseWriter, r *http.Request)

HandleGetDryRun handles GET /api/v1/updates/dry-run.

func (*UpdateHandler) HandleGetScanStatus

func (h *UpdateHandler) HandleGetScanStatus(w http.ResponseWriter, r *http.Request)

HandleGetScanStatus handles GET /api/v1/updates/scan/{scan_id}.

func (*UpdateHandler) HandleGetUpdateSummary

func (h *UpdateHandler) HandleGetUpdateSummary(w http.ResponseWriter, r *http.Request)

HandleGetUpdateSummary handles GET /api/v1/updates/summary.

func (*UpdateHandler) HandleListExclusions

func (h *UpdateHandler) HandleListExclusions(w http.ResponseWriter, r *http.Request)

HandleListExclusions handles GET /api/v1/updates/exclusions.

func (*UpdateHandler) HandleListUpdates

func (h *UpdateHandler) HandleListUpdates(w http.ResponseWriter, r *http.Request)

HandleListUpdates handles GET /api/v1/updates.

func (*UpdateHandler) HandlePinVersion

func (h *UpdateHandler) HandlePinVersion(w http.ResponseWriter, r *http.Request)

HandlePinVersion handles POST /api/v1/updates/{container_id}/pin.

func (*UpdateHandler) HandleTriggerScan

func (h *UpdateHandler) HandleTriggerScan(w http.ResponseWriter, r *http.Request)

HandleTriggerScan handles POST /api/v1/updates/scan.

func (*UpdateHandler) HandleUnpinVersion

func (h *UpdateHandler) HandleUnpinVersion(w http.ResponseWriter, r *http.Request)

HandleUnpinVersion handles DELETE /api/v1/updates/{container_id}/pin.

type UptimeDailyFetcher

type UptimeDailyFetcher interface {
	GetEndpointDailyUptime(ctx context.Context, endpointID string, days int) ([]sqlite.DailyUptime, error)
	GetHeartbeatDailyUptime(ctx context.Context, heartbeatID string, days int) ([]sqlite.DailyUptime, error)
	GetContainerDailyUptime(ctx context.Context, containerID string, days int) ([]sqlite.DailyUptime, error)
}

UptimeDailyFetcher abstracts the daily uptime store for testing.

type UptimeDailyHandler

type UptimeDailyHandler struct {
	// contains filtered or unexported fields
}

UptimeDailyHandler handles daily uptime aggregation endpoints.

func NewUptimeDailyHandler

func NewUptimeDailyHandler(store UptimeDailyFetcher) *UptimeDailyHandler

NewUptimeDailyHandler creates a new daily uptime handler.

func (*UptimeDailyHandler) HandleContainerDailyUptime added in v1.3.2

func (h *UptimeDailyHandler) HandleContainerDailyUptime(w http.ResponseWriter, r *http.Request)

HandleContainerDailyUptime handles GET /api/v1/containers/{id}/uptime/daily.

func (*UptimeDailyHandler) HandleEndpointDailyUptime

func (h *UptimeDailyHandler) HandleEndpointDailyUptime(w http.ResponseWriter, r *http.Request)

HandleEndpointDailyUptime handles GET /api/v1/endpoints/{id}/uptime/daily.

func (*UptimeDailyHandler) HandleHeartbeatDailyUptime

func (h *UptimeDailyHandler) HandleHeartbeatDailyUptime(w http.ResponseWriter, r *http.Request)

HandleHeartbeatDailyUptime handles GET /api/v1/heartbeats/{id}/uptime/daily.

type WebhookHandler

type WebhookHandler struct {
	// contains filtered or unexported fields
}

WebhookHandler handles webhook subscription CRUD endpoints.

func NewWebhookHandler

func NewWebhookHandler(store webhook.WebhookSubscriptionStore, logger *slog.Logger, allowPrivateWebhooks bool) *WebhookHandler

NewWebhookHandler creates a new webhook handler.

func (*WebhookHandler) HandleCreateWebhook

func (h *WebhookHandler) HandleCreateWebhook(w http.ResponseWriter, r *http.Request)

HandleCreateWebhook handles POST /api/v1/webhooks.

func (*WebhookHandler) HandleDeleteWebhook

func (h *WebhookHandler) HandleDeleteWebhook(w http.ResponseWriter, r *http.Request)

HandleDeleteWebhook handles DELETE /api/v1/webhooks/{id}.

func (*WebhookHandler) HandleListWebhooks

func (h *WebhookHandler) HandleListWebhooks(w http.ResponseWriter, r *http.Request)

HandleListWebhooks handles GET /api/v1/webhooks.

func (*WebhookHandler) HandleTestWebhook

func (h *WebhookHandler) HandleTestWebhook(w http.ResponseWriter, r *http.Request)

HandleTestWebhook handles POST /api/v1/webhooks/{id}/test.

Jump to

Keyboard shortcuts

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