Documentation
¶
Index ¶
- Constants
- func SignCommand(cmd *Command, secret string) error
- func SubjectCommands(agentName string) string
- func SubjectConfigReloadAgent(agentName string) string
- func SubjectEvents(source string) string
- func SubjectHeartbeat(agentName string) string
- func VerifyCommand(cmd *Command, secret string) bool
- type AgentInfo
- type AgentsResponse
- type Command
- type ConfigReloadResponse
- type Event
- type Heartbeat
- type Registration
- type StatusResponse
- type WorkflowInfo
- type WorkflowsResponse
Constants ¶
const ( SubjectRegistry = "sekia.registry" SubjectConfigReload = "sekia.config.reload" )
NATS subject constants and helpers.
Variables ¶
This section is empty.
Functions ¶
func SignCommand ¶ added in v0.0.8
SignCommand computes an HMAC-SHA256 signature for the command and sets cmd.Signature. If secret is empty, the command is left unsigned.
func SubjectCommands ¶
func SubjectConfigReloadAgent ¶ added in v0.0.14
SubjectConfigReloadAgent returns the subject for a specific agent's config reload.
func SubjectEvents ¶
func SubjectHeartbeat ¶
func VerifyCommand ¶ added in v0.0.8
VerifyCommand checks the HMAC-SHA256 signature on a command. If secret is empty, verification is skipped (returns true). If the command has no signature but a secret is configured, returns false.
Types ¶
type AgentInfo ¶
type AgentInfo struct {
Name string `json:"name"`
Version string `json:"version"`
Status string `json:"status"`
Capabilities []string `json:"capabilities"`
Commands []string `json:"commands"`
RegisteredAt time.Time `json:"registered_at"`
LastHeartbeat time.Time `json:"last_heartbeat"`
EventsProcessed int64 `json:"events_processed"`
Errors int64 `json:"errors"`
}
AgentInfo is one entry in the GET /api/v1/agents response.
type AgentsResponse ¶
type AgentsResponse struct {
Agents []AgentInfo `json:"agents"`
}
AgentsResponse is returned by GET /api/v1/agents.
type Command ¶ added in v0.0.8
type Command struct {
Command string `json:"command"`
Payload map[string]any `json:"payload"`
Source string `json:"source"`
Signature string `json:"signature,omitempty"`
}
Command is the canonical command envelope published on sekia.commands.<agent>.
type ConfigReloadResponse ¶ added in v0.0.14
ConfigReloadResponse is returned by POST /api/v1/config/reload.
type Event ¶
type Event struct {
ID string `json:"id"`
Type string `json:"type"`
Source string `json:"source"`
Timestamp int64 `json:"timestamp"`
Payload map[string]any `json:"payload"`
}
Event is the canonical event envelope published on sekia.events.<source>.
type Heartbeat ¶
type Heartbeat struct {
Name string `json:"name"`
Status string `json:"status"`
LastEvent time.Time `json:"last_event"`
EventsProcessed int64 `json:"events_processed"`
Errors int64 `json:"errors"`
}
Heartbeat is published on sekia.heartbeat.<agent-name> every 30s.
type Registration ¶
type Registration struct {
Name string `json:"name"`
Version string `json:"version"`
Capabilities []string `json:"capabilities"`
Commands []string `json:"commands"`
ConfigSchema map[string]any `json:"config_schema,omitempty"`
}
Registration is published on sekia.registry when an agent starts.
type StatusResponse ¶
type StatusResponse struct {
Status string `json:"status"`
Uptime string `json:"uptime"`
NATSRunning bool `json:"nats_running"`
StartedAt time.Time `json:"started_at"`
AgentCount int `json:"agent_count"`
WorkflowCount int `json:"workflow_count"`
}
StatusResponse is returned by GET /api/v1/status.
type WorkflowInfo ¶
type WorkflowInfo struct {
Name string `json:"name"`
FilePath string `json:"file_path"`
Handlers int `json:"handlers"`
Patterns []string `json:"patterns"`
LoadedAt time.Time `json:"loaded_at"`
Events int64 `json:"events"`
Errors int64 `json:"errors"`
}
WorkflowInfo is one entry in the GET /api/v1/workflows response.
type WorkflowsResponse ¶
type WorkflowsResponse struct {
Workflows []WorkflowInfo `json:"workflows"`
}
WorkflowsResponse is returned by GET /api/v1/workflows.