controllers

package
v1.3.9 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateIncident

func CreateIncident(c *fiber.Ctx) error

func HandleAck

func HandleAck(c *fiber.Ctx) error

func HealthCheck

func HealthCheck(c *fiber.Ctx) error

func MountStaticUI added in v1.3.9

func MountStaticUI(app *fiber.App)

MountStaticUI registers the embedded UI at "/" with SPA fallback so client-side routes like /dashboard, /incidents/:id, /shadow/:id all resolve to index.html when the asset doesn't exist.

Call this AFTER all API/admin routes are registered; otherwise the catch-all would shadow them.

func SNS

func SNS(c *fiber.Ctx) error

Types

type AgentController added in v1.3.9

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

AgentController exposes admin endpoints for inspecting and curating the pattern catalog. All endpoints require the gateway secret configured under `agent.gateway_secret` (or env AGENT_GATEWAY_SECRET), sent in the `X-Gateway-Secret` header. When no secret is configured, every request is rejected — this is by design: an empty secret must not silently grant access.

func NewAgentController added in v1.3.9

func NewAgentController(cat *agent.Catalog, sl *agent.ShadowLog) *AgentController

NewAgentController wires the catalog and shadow log into a controller. Pass `cat=nil` if the agent is disabled — in that case every endpoint will return 503. `sl` may be nil to disable the shadow endpoints.

func (*AgentController) Register added in v1.3.9

func (a *AgentController) Register(router fiber.Router)

Register attaches the agent admin endpoints to the given fiber group.

Routes (under /api/agent):

GET    /patterns         list all patterns (sorted by Count desc)
GET    /patterns/:id     get one pattern
POST   /patterns/:id     update verdict / tags
DELETE /patterns/:id     remove a pattern
POST   /flush            force-flush the catalog to disk
GET    /status           lightweight status (catalog size, dirty flag)
GET    /shadow           list shadow-mode "would have alerted" events
GET    /shadow/stats     aggregate counts for the shadow log
DELETE /shadow           clear the shadow log
POST   /shadow/flush     force-flush the shadow log to disk
GET    /services         list known services with grace status
POST   /services/:name/grace  control grace period (end / restart)

type ConfigAdminController added in v1.3.9

type ConfigAdminController struct{}

ConfigAdminController exposes a read-only, secret-redacted view of the running config so the admin dashboard can render it without ever exposing tokens, passwords, or webhook URLs. Same gateway-secret guard as the rest of the admin surface.

func NewConfigAdminController added in v1.3.9

func NewConfigAdminController() *ConfigAdminController

func (*ConfigAdminController) Register added in v1.3.9

func (c *ConfigAdminController) Register(router fiber.Router)

Register attaches:

GET /api/admin/config/incidents   alert channels + queue + on-call
GET /api/admin/config/agent       agent runtime config

type IncidentAdminController added in v1.3.9

type IncidentAdminController struct{}

IncidentAdminController exposes read endpoints for the persisted incident history. Same X-Gateway-Secret guard as the agent admin surface — see AgentController.authMiddleware.

func NewIncidentAdminController added in v1.3.9

func NewIncidentAdminController() *IncidentAdminController

NewIncidentAdminController returns a controller. No state of its own; the storage provider is read lazily via services.Storage().

func (*IncidentAdminController) Register added in v1.3.9

func (i *IncidentAdminController) Register(router fiber.Router)

Register attaches the admin endpoints under /api/admin/incidents.

GET /api/admin/incidents          list (newest first; ?limit=NN)
GET /api/admin/incidents/:id      single record

type SNSMessage

type SNSMessage struct {
	Type             string `json:"Type"`
	MessageId        string `json:"MessageId"`
	Token            string `json:"Token,omitempty"` // Omit empty for Notification type
	TopicArn         string `json:"TopicArn"`
	Message          string `json:"Message"`
	SubscribeURL     string `json:"SubscribeURL,omitempty"` // Omit empty for Notification type
	Timestamp        string `json:"Timestamp"`
	SignatureVersion string `json:"SignatureVersion"`
	Signature        string `json:"Signature"`
	SigningCertURL   string `json:"SigningCertURL"`
}

Jump to

Keyboard shortcuts

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