Documentation
¶
Index ¶
- func CreateIncident(c *fiber.Ctx) error
- func HandleAck(c *fiber.Ctx) error
- func HealthCheck(c *fiber.Ctx) error
- func MountStaticUI(app *fiber.App)
- func SNS(c *fiber.Ctx) error
- type AgentController
- type ConfigAdminController
- type IncidentAdminController
- type RunbookAdminController
- type SNSMessage
- type TeamsAdminController
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateIncident ¶
func HealthCheck ¶
func MountStaticUI ¶ added in v1.3.9
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.
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, dl *agent.DetectLog, runbooksEnabled bool) *AgentController
NewAgentController wires the catalog, shadow log, and detect 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, and `dl` may be nil to disable the detect-log endpoints. `runbooksEnabled` tells the status endpoint whether the runbooks subsystem is available.
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) GET /detect list detect-mode AI calls (newest first) GET /detect/stats aggregate counts for the detect log GET /detect/:id get one detect-mode AI call (full prompt + response) DELETE /detect clear the detect log POST /detect/flush force-flush the detect log to disk GET /ai/system-prompt the assembled system prompt sent on every AI call
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/search full-text search (?q=&limit=NN) GET /api/admin/incidents/:id single record POST /api/admin/incidents/:id/resolve mark resolved (idempotent)
type RunbookAdminController ¶ added in v1.4.4
type RunbookAdminController struct {
// contains filtered or unexported fields
}
RunbookAdminController exposes upload/list/get/delete for the runbook corpus that backs the find_runbook tool. Same X-Gateway-Secret guard as the other /api/agent/* admin controllers. Runbooks are managed by uploading `.md` files (multipart) — there is no free-text editor; to change a runbook, re-upload a file with the same name.
func NewRunbookAdminController ¶ added in v1.4.4
func NewRunbookAdminController(mgr *runbook.Manager) *RunbookAdminController
NewRunbookAdminController returns a controller backed by the runbook manager. Pass nil to disable the endpoints entirely (every request returns 503) — e.g. when storage is unavailable.
func (*RunbookAdminController) Register ¶ added in v1.4.4
func (c *RunbookAdminController) Register(router fiber.Router)
Register mounts the runbook admin routes:
GET /api/agent/runbooks list (metadata only) POST /api/agent/runbooks upload one or more `.md` files (field "files") GET /api/agent/runbooks/* get one (full body) DELETE /api/agent/runbooks/* delete one
The wildcard `*` carries the runbook ID, which may itself contain `/` (corpus-relative paths), so a `:id` param would not match nested IDs.
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"`
}
type TeamsAdminController ¶ added in v1.4.1
type TeamsAdminController struct {
// contains filtered or unexported fields
}
TeamsAdminController exposes CRUD for members and teams plus an incident-assignment endpoint. Same X-Gateway-Secret guard as the other /api/admin/* controllers.
func NewTeamsAdminController ¶ added in v1.4.1
func NewTeamsAdminController(s *teams.Store) *TeamsAdminController
NewTeamsAdminController returns a controller backed by the given teams store. Pass nil to disable the endpoints entirely (every request returns 503).
func (*TeamsAdminController) Register ¶ added in v1.4.1
func (c *TeamsAdminController) Register(router fiber.Router)
Register mounts the admin routes:
GET /api/admin/members list POST /api/admin/members create GET /api/admin/members/:id get one PATCH /api/admin/members/:id partial update DELETE /api/admin/members/:id delete (+ scrub team refs) GET /api/admin/teams list POST /api/admin/teams create GET /api/admin/teams/:id get one PATCH /api/admin/teams/:id partial update DELETE /api/admin/teams/:id delete POST /api/admin/incidents/:id/assign assign team + members