Documentation
¶
Overview ¶
Package event owns persisted system events, manager ingestion, and event HTTP routes.
Index ¶
- Constants
- func RegisterAgentEventIngestion(g *echo.Group, eventService *EventService, cfg *config.Config)
- func RegisterEvents(api huma.API, eventService *EventService)
- type CreateEventRequest
- type DeleteEventInput
- type DeleteEventOutput
- type Dependencies
- type Event
- type EventHandler
- func (h *EventHandler) DeleteEvent(ctx context.Context, input *DeleteEventInput) (*DeleteEventOutput, error)
- func (h *EventHandler) GetEventStats(ctx context.Context, _ *GetEventStatsInput) (*GetEventStatsOutput, error)
- func (h *EventHandler) GetEventsByEnvironment(ctx context.Context, input *GetEventsByEnvironmentInput) (*GetEventsByEnvironmentOutput, error)
- func (h *EventHandler) ListEvents(ctx context.Context, input *ListEventsInput) (*ListEventsOutput, error)
- type EventService
- func (s *EventService) CreateEvent(ctx context.Context, req CreateEventRequest) (*Event, error)
- func (s *EventService) DeleteEvent(ctx context.Context, eventID string) error
- func (s *EventService) DeleteOldEvents(ctx context.Context, olderThan time.Duration) error
- func (s *EventService) GetEventSeverityCounts(ctx context.Context) (EventSeverityCounts, error)
- func (s *EventService) GetEventsByEnvironmentPaginated(ctx context.Context, environmentID string, params pagination.QueryParams) ([]eventtypes.Event, pagination.Response, error)
- func (s *EventService) ListEventsPaginated(ctx context.Context, params pagination.QueryParams) ([]eventtypes.Event, pagination.Response, error)
- func (s *EventService) LogContainerEvent(ctx context.Context, eventType EventType, ...) error
- func (s *EventService) LogErrorEvent(ctx context.Context, eventType EventType, ...)
- func (s *EventService) LogImageEvent(ctx context.Context, eventType EventType, ...) error
- func (s *EventService) LogNetworkEvent(ctx context.Context, eventType EventType, ...) error
- func (s *EventService) LogProjectEvent(ctx context.Context, eventType EventType, ...) error
- func (s *EventService) LogUserEvent(ctx context.Context, eventType EventType, userID, username string, ...) error
- func (s *EventService) LogVolumeEvent(ctx context.Context, eventType EventType, ...) error
- type EventSeverity
- type EventSeverityCounts
- type EventType
- type GetEventStatsInput
- type GetEventStatsOutput
- type GetEventsByEnvironmentInput
- type GetEventsByEnvironmentOutput
- type ListEventsInput
- type ListEventsOutput
- type Module
Constants ¶
const ( // EventTypeContainerStart and the constants below enumerate Arcane event types. EventTypeContainerStart EventType = "container.start" EventTypeContainerStop EventType = "container.stop" EventTypeContainerRestart EventType = "container.restart" EventTypeContainerDelete EventType = "container.delete" EventTypeContainerCreate EventType = "container.create" EventTypeContainerScan EventType = "container.scan" EventTypeContainerUpdate EventType = "container.update" EventTypeContainerDeploy EventType = "container.deploy" EventTypeContainerKill EventType = "container.kill" EventTypeContainerPause EventType = "container.pause" EventTypeContainerUnpause EventType = "container.unpause" EventTypeContainerError EventType = "container.error" EventTypeImagePull EventType = "image.pull" EventTypeImageLoad EventType = "image.load" EventTypeImageTag EventType = "image.tag" EventTypeImageCommit EventType = "image.commit" EventTypeImageDelete EventType = "image.delete" EventTypeImageScan EventType = "image.scan" EventTypeImageError EventType = "image.error" EventTypeImageVulnerabilityScan EventType = "image.vulnerability_scan" EventTypeProjectDeploy EventType = "project.deploy" EventTypeProjectDelete EventType = "project.delete" EventTypeProjectStart EventType = "project.start" EventTypeProjectStop EventType = "project.stop" EventTypeProjectCreate EventType = "project.create" EventTypeProjectUpdate EventType = "project.update" EventTypeProjectError EventType = "project.error" EventTypeGitRepositoryCreate EventType = "git.repository.create" EventTypeGitRepositoryUpdate EventType = "git.repository.update" EventTypeGitRepositoryDelete EventType = "git.repository.delete" EventTypeGitRepositoryTest EventType = "git.repository.test" EventTypeGitRepositoryError EventType = "git.repository.error" EventTypeGitSyncCreate EventType = "git.sync.create" EventTypeGitSyncUpdate EventType = "git.sync.update" EventTypeGitSyncDelete EventType = "git.sync.delete" EventTypeGitSyncRun EventType = "git.sync.run" EventTypeGitSyncError EventType = "git.sync.error" EventTypeVolumeCreate EventType = "volume.create" EventTypeVolumeDelete EventType = "volume.delete" EventTypeVolumeError EventType = "volume.error" EventTypeVolumeFileCreate EventType = "volume.file.create" EventTypeVolumeFileDelete EventType = "volume.file.delete" EventTypeVolumeFileUpload EventType = "volume.file.upload" EventTypeVolumeFileUpdate EventType = "volume.file.update" EventTypeVolumeWorkspaceUpdate EventType = "volume.workspace.update" EventTypeVolumeBackupCreate EventType = "volume.backup.create" EventTypeVolumeBackupDelete EventType = "volume.backup.delete" EventTypeVolumeBackupRestore EventType = "volume.backup.restore" EventTypeVolumeBackupRestoreFiles EventType = "volume.backup.restore_files" EventTypeVolumeBackupDownload EventType = "volume.backup.download" EventTypeNetworkCreate EventType = "network.create" EventTypeNetworkDelete EventType = "network.delete" EventTypeNetworkError EventType = "network.error" EventTypeSystemPrune EventType = "system.prune" EventTypeUserLogin EventType = "user.login" EventTypeUserLogout EventType = "user.logout" EventTypeFederatedExchange EventType = "federated.exchange" EventTypeSystemAutoUpdate EventType = "system.auto_update" EventTypeSystemUpgrade EventType = "system.upgrade" EventTypeEnvironmentCreate EventType = "environment.create" EventTypeEnvironmentConnect EventType = "environment.connect" EventTypeEnvironmentDisconnect EventType = "environment.disconnect" EventTypeEnvironmentUpdate EventType = "environment.update" EventTypeEnvironmentDelete EventType = "environment.delete" EventTypeEnvironmentApiKeyRegenerated EventType = "environment.api_key.regenerated" EventTypeEnvironmentMTLSCAGenerated EventType = "environment.mtls.ca_generated" EventTypeEnvironmentMTLSCertIssued EventType = "environment.mtls.cert_issued" EventTypeEnvironmentMTLSEnroll EventType = "environment.mtls.enroll" EventTypeEnvironmentMTLSDownload EventType = "environment.mtls.download" EventTypeWebhookCreate EventType = "webhook.create" EventTypeWebhookUpdate EventType = "webhook.update" EventTypeWebhookDelete EventType = "webhook.delete" EventTypeWebhookTrigger EventType = "webhook.trigger" // EventTypeNotificationSend is emitted for every notification delivery // attempt; severity is success or error depending on the send result. EventTypeNotificationSend EventType = "notification.send" // EventTypeLifecycleExecute is emitted by LifecycleService each time a // pre-deploy script runs. Severity is success on a clean exit and warning // on non-zero exit or timeout. EventTypeLifecycleExecute EventType = "lifecycle.execute" // EventSeverityInfo and the constants below enumerate event severities. EventSeverityInfo EventSeverity = "info" EventSeverityWarning EventSeverity = "warning" EventSeverityError EventSeverity = "error" EventSeveritySuccess EventSeverity = "success" )
Variables ¶
This section is empty.
Functions ¶
func RegisterAgentEventIngestion ¶
func RegisterAgentEventIngestion(g *echo.Group, eventService *EventService, cfg *config.Config)
RegisterAgentEventIngestion registers the manager ingestion endpoint used by direct agents when no edge tunnel is active. This route is not part of the Huma/OpenAPI surface and authenticates only with the configured agent token.
func RegisterEvents ¶
func RegisterEvents(api huma.API, eventService *EventService)
RegisterEvents registers all event management endpoints.
Types ¶
type CreateEventRequest ¶
type CreateEventRequest struct {
Type EventType `json:"type"`
Severity EventSeverity `json:"severity,omitempty"`
Title string `json:"title"`
Description string `json:"description,omitempty"`
ResourceType *string `json:"resourceType,omitempty"`
ResourceID *string `json:"resourceId,omitempty"`
ResourceName *string `json:"resourceName,omitempty"`
UserID *string `json:"userId,omitempty"`
Username *string `json:"username,omitempty"`
EnvironmentID *string `json:"environmentId,omitempty"`
Metadata database.JSON `json:"metadata,omitempty"`
}
type DeleteEventInput ¶
type DeleteEventInput struct {
EventID string `path:"eventId" doc:"Event ID"`
}
type DeleteEventOutput ¶
type DeleteEventOutput struct {
Body base.ApiResponse[base.MessageResponse]
}
type Dependencies ¶
Dependencies are the collaborators the event domain needs.
type Event ¶ added in v2.8.1
type Event struct {
database.BaseModel
Type EventType `json:"type" sortable:"true"`
Severity EventSeverity `json:"severity" sortable:"true"`
Title string `json:"title" sortable:"true"`
Description string `json:"description"`
ResourceType *string `json:"resourceType,omitempty" sortable:"true"`
ResourceID *string `json:"resourceId,omitempty" sortable:"true"`
ResourceName *string `json:"resourceName,omitempty" sortable:"true"`
UserID *string `json:"userId,omitempty" sortable:"true"`
Username *string `json:"username,omitempty" sortable:"true"`
EnvironmentID *string `json:"environmentId,omitempty"`
Metadata database.JSON `json:"metadata,omitempty" gorm:"type:text"`
Timestamp time.Time `json:"timestamp" sortable:"true"`
}
type EventHandler ¶
type EventHandler struct {
// contains filtered or unexported fields
}
EventHandler handles event management endpoints.
func (*EventHandler) DeleteEvent ¶
func (h *EventHandler) DeleteEvent(ctx context.Context, input *DeleteEventInput) (*DeleteEventOutput, error)
DeleteEvent deletes an event.
func (*EventHandler) GetEventStats ¶
func (h *EventHandler) GetEventStats(ctx context.Context, _ *GetEventStatsInput) (*GetEventStatsOutput, error)
GetEventStats returns global event counts grouped by severity.
func (*EventHandler) GetEventsByEnvironment ¶
func (h *EventHandler) GetEventsByEnvironment(ctx context.Context, input *GetEventsByEnvironmentInput) (*GetEventsByEnvironmentOutput, error)
GetEventsByEnvironment returns events for a specific environment.
func (*EventHandler) ListEvents ¶
func (h *EventHandler) ListEvents(ctx context.Context, input *ListEventsInput) (*ListEventsOutput, error)
ListEvents returns a paginated list of events.
type EventService ¶
type EventService struct {
// contains filtered or unexported fields
}
func NewEventService ¶
func (*EventService) CreateEvent ¶
func (s *EventService) CreateEvent(ctx context.Context, req CreateEventRequest) (*Event, error)
func (*EventService) DeleteEvent ¶
func (s *EventService) DeleteEvent(ctx context.Context, eventID string) error
func (*EventService) DeleteOldEvents ¶
func (*EventService) GetEventSeverityCounts ¶
func (s *EventService) GetEventSeverityCounts(ctx context.Context) (EventSeverityCounts, error)
func (*EventService) GetEventsByEnvironmentPaginated ¶
func (s *EventService) GetEventsByEnvironmentPaginated(ctx context.Context, environmentID string, params pagination.QueryParams) ([]eventtypes.Event, pagination.Response, error)
func (*EventService) ListEventsPaginated ¶
func (s *EventService) ListEventsPaginated(ctx context.Context, params pagination.QueryParams) ([]eventtypes.Event, pagination.Response, error)
func (*EventService) LogContainerEvent ¶
func (*EventService) LogErrorEvent ¶
func (*EventService) LogImageEvent ¶
func (*EventService) LogNetworkEvent ¶
func (*EventService) LogProjectEvent ¶
func (*EventService) LogUserEvent ¶
func (*EventService) LogVolumeEvent ¶
type EventSeverity ¶ added in v2.8.1
type EventSeverity string
type EventSeverityCounts ¶
type EventSeverityCounts struct {
Total int64 `json:"total"`
Info int64 `json:"info"`
Success int64 `json:"success"`
Warning int64 `json:"warning"`
Error int64 `json:"error"`
}
EventSeverityCounts holds global event counts per severity.
type GetEventStatsInput ¶
type GetEventStatsInput struct{}
type GetEventStatsOutput ¶
type GetEventStatsOutput struct {
Body base.ApiResponse[EventSeverityCounts]
}
type GetEventsByEnvironmentInput ¶
type GetEventsByEnvironmentInput struct {
EnvironmentID string `path:"environmentId" doc:"Environment ID"`
Search string `query:"search" doc:"Search query"`
Sort string `query:"sort" doc:"Column to sort by"`
Order string `query:"order" default:"asc" doc:"Sort direction"`
Start int `query:"start" default:"0" doc:"Start index"`
Limit int `query:"limit" default:"20" doc:"Limit"`
Severity string `query:"severity" doc:"Filter by severity"`
Type string `query:"type" doc:"Filter by event type (exact type or category prefix, comma-separated)"`
}
type GetEventsByEnvironmentOutput ¶
type GetEventsByEnvironmentOutput struct {
Body base.Paginated[eventtypes.Event]
}
type ListEventsInput ¶
type ListEventsInput struct {
Search string `query:"search" doc:"Search query"`
Sort string `query:"sort" doc:"Column to sort by"`
Order string `query:"order" default:"asc" doc:"Sort direction"`
Start int `query:"start" default:"0" doc:"Start index"`
Limit int `query:"limit" default:"20" doc:"Limit"`
Severity string `query:"severity" doc:"Filter by severity"`
Type string `query:"type" doc:"Filter by event type (exact type or category prefix, comma-separated)"`
}
type ListEventsOutput ¶
type ListEventsOutput struct {
Body base.Paginated[eventtypes.Event]
}
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module owns event persistence and both of the domain's HTTP surfaces.
func (*Module) RegisterAgentRoutes ¶
RegisterAgentRoutes mounts the token-authenticated direct-agent ingestion endpoint.
func (*Module) RegisterRoutes ¶
RegisterRoutes mounts the typed event endpoints for runtime and schema discovery.
func (*Module) Service ¶
func (m *Module) Service() *EventService
Service exposes event operations to collaborating domains.