Documentation
¶
Overview ¶
Package event owns persisted system events, manager ingestion, and event HTTP routes.
Index ¶
- 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 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) (*models.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 models.EventType, ...) error
- func (s *EventService) LogErrorEvent(ctx context.Context, eventType models.EventType, ...)
- func (s *EventService) LogImageEvent(ctx context.Context, eventType models.EventType, ...) error
- func (s *EventService) LogNetworkEvent(ctx context.Context, eventType models.EventType, ...) error
- func (s *EventService) LogProjectEvent(ctx context.Context, eventType models.EventType, ...) error
- func (s *EventService) LogUserEvent(ctx context.Context, eventType models.EventType, userID, username string, ...) error
- func (s *EventService) LogVolumeEvent(ctx context.Context, eventType models.EventType, ...) error
- type EventSeverityCounts
- type GetEventStatsInput
- type GetEventStatsOutput
- type GetEventsByEnvironmentInput
- type GetEventsByEnvironmentOutput
- type ListEventsInput
- type ListEventsOutput
- type Module
Constants ¶
This section is empty.
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 models.EventType `json:"type"`
Severity models.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 models.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 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) (*models.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 ¶
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.