handlers

package
v0.0.0-...-58e7928 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2025 License: GPL-3.0 Imports: 30 Imported by: 0

Documentation

Overview

Package handlers provides HTTP handlers for the GoSight API server.

Package handlers provides HTTP handlers for the GoSight API server. This file contains network device management related handlers.

Package handlers provides HTTP handlers for the GoSight API server. This file contains file upload and management related handlers.

Package handlers provides HTTP handlers for the GoSight Server REST API. This file contains handlers for managing permissions and their associations with roles in the system. It supports CRUD operations for permissions and querying roles by permission.

Package handlers provides HTTP handlers for the GoSight API server.

Index

Constants

View Source
const (
	MaxFileSize = 5 * 1024 * 1024 // 5MB max file size
	AvatarSize  = 256             // Avatar dimensions in pixels
	UploadsDir  = "uploads"
	AvatarsDir  = "uploads/avatars"
)

Variables

This section is empty.

Functions

func SortBy

func SortBy(alerts *[]model.AlertInstance, field, order string)

SortBy sorts alerts by the specified field and order

Types

type AgentsHandler

type AgentsHandler struct {
	Sys *sys.SystemContext
}

AgentsHandler provides handlers for agents and containers API endpoints

func NewAgentsHandler

func NewAgentsHandler(sys *sys.SystemContext) *AgentsHandler

NewAgentsHandler creates a new AgentsHandler

func (*AgentsHandler) HandleAgentsAPI

func (h *AgentsHandler) HandleAgentsAPI(w http.ResponseWriter, r *http.Request)

HandleAgentsAPI returns a JSON list of active agents

type AlertContextResponse

type AlertContextResponse struct {
	Alert  model.AlertInstance `json:"alert"`
	Logs   []model.LogEntry    `json:"logs"`
	Events []model.EventEntry  `json:"events"`
}

AlertContextResponse represents the response structure for alert context

type AlertsHandler

type AlertsHandler struct {
	Sys *sys.SystemContext
}

AlertsHandler provides handlers for alerts API endpoints

func NewAlertsHandler

func NewAlertsHandler(sys *sys.SystemContext) *AlertsHandler

NewAlertsHandler creates a new AlertsHandler

func (*AlertsHandler) HandleActiveAlertsAPI

func (h *AlertsHandler) HandleActiveAlertsAPI(w http.ResponseWriter, r *http.Request)

HandleActiveAlertsAPI handles requests to the /api/alerts/active endpoint

func (*AlertsHandler) HandleAlertContext

func (h *AlertsHandler) HandleAlertContext(w http.ResponseWriter, r *http.Request)

HandleAlertContext handles requests to /api/alerts/{id}/context

func (*AlertsHandler) HandleAlertRulesAPI

func (h *AlertsHandler) HandleAlertRulesAPI(w http.ResponseWriter, r *http.Request)

HandleAlertRulesAPI handles requests to the /api/alerts/rules endpoint

func (*AlertsHandler) HandleAlertsAPI

func (h *AlertsHandler) HandleAlertsAPI(w http.ResponseWriter, r *http.Request)

HandleAlertsAPI handles requests to the /api/alerts endpoint It retrieves all alerts from the database and returns them as JSON.

func (*AlertsHandler) HandleAlertsSummaryAPI

func (h *AlertsHandler) HandleAlertsSummaryAPI(w http.ResponseWriter, r *http.Request)

HandleAlertsSummaryAPI handles requests to the /api/alerts/summary endpoint It returns a summary of alerts grouped by rule_id, showing the latest state and last change time.

func (*AlertsHandler) HandleCreateAlertRuleAPI

func (h *AlertsHandler) HandleCreateAlertRuleAPI(w http.ResponseWriter, r *http.Request)

HandleCreateAlertRuleAPI handles POST /api/v1/alerts

type AssignPermissionRequest

type AssignPermissionRequest struct {
	PermissionIDs []string `json:"permission_ids"`
}

type AssignRoleRequest

type AssignRoleRequest struct {
	RoleIDs []uuid.UUID `json:"role_ids"`
}

AssignRoleRequest represents the request body for assigning roles to a user

type AuthHandler

type AuthHandler struct {
	Sys *sys.SystemContext
}

AuthHandler provides handlers for authentication API endpoints

func NewAuthHandler

func NewAuthHandler(sys *sys.SystemContext) *AuthHandler

NewAuthHandler creates a new AuthHandler

func (*AuthHandler) HandleAPIAuthProviders

func (h *AuthHandler) HandleAPIAuthProviders(w http.ResponseWriter, r *http.Request)

HandleAPIAuthProviders returns the list of available authentication providers (JSON API)

func (*AuthHandler) HandleAPILogin

func (h *AuthHandler) HandleAPILogin(w http.ResponseWriter, r *http.Request)

HandleAPILogin handles login requests from the SvelteKit frontend (JSON API)

func (*AuthHandler) HandleAPILogout

func (h *AuthHandler) HandleAPILogout(w http.ResponseWriter, r *http.Request)

HandleAPILogout handles logout requests from the SvelteKit frontend (JSON API)

func (*AuthHandler) HandleAPIMFAVerify

func (h *AuthHandler) HandleAPIMFAVerify(w http.ResponseWriter, r *http.Request)

HandleAPIMFAVerify handles MFA verification requests from the SvelteKit frontend (JSON API)

func (*AuthHandler) HandleCallback

func (h *AuthHandler) HandleCallback(w http.ResponseWriter, r *http.Request)

HandleCallback handles the callback route for various auth providers

func (*AuthHandler) HandleCurrentUser

func (h *AuthHandler) HandleCurrentUser(w http.ResponseWriter, r *http.Request)

HandleCurrentUser handles requests to get the current authenticated user (JSON API)

func (*AuthHandler) HandleLoginStart

func (h *AuthHandler) HandleLoginStart(w http.ResponseWriter, r *http.Request)

HandleLoginStart handles the login/start route for various auth providers

type CommandsHandler

type CommandsHandler struct {
	Sys *sys.SystemContext
}

CommandsHandler handles command-related API endpoints

func NewCommandsHandler

func NewCommandsHandler(sys *sys.SystemContext) *CommandsHandler

NewCommandsHandler creates a new CommandsHandler

func (*CommandsHandler) HandleCommandsAPI

func (h *CommandsHandler) HandleCommandsAPI(w http.ResponseWriter, r *http.Request)

HandleCommandsAPI handles command execution requests to agents

type ContainerMetrics

type ContainerMetrics struct {
	Host   string            `json:"host"`
	Name   string            `json:"name"`
	Image  string            `json:"image"`
	Status string            `json:"status"`
	CPU    *float64          `json:"cpu,omitempty"`
	Mem    *float64          `json:"mem,omitempty"`
	RX     *float64          `json:"rx,omitempty"`
	TX     *float64          `json:"tx,omitempty"`
	Uptime *float64          `json:"uptime,omitempty"`
	Labels map[string]string `json:"labels,omitempty"`
	Ports  string            `json:"ports,omitempty"`
}

ContainerMetrics represents container metrics

type CreatePermissionRequest

type CreatePermissionRequest struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

CreatePermissionRequest represents the payload for creating a new permission.

type CreateRoleRequest

type CreateRoleRequest struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

type DebugHandler

type DebugHandler struct {
	Sys *sys.SystemContext
}

DebugHandler handles debug-related API endpoints

func NewDebugHandler

func NewDebugHandler(sys *sys.SystemContext) *DebugHandler

NewDebugHandler creates a new DebugHandler

func (*DebugHandler) HandleAPIDebugConfig

func (h *DebugHandler) HandleAPIDebugConfig(w http.ResponseWriter, r *http.Request)

HandleAPIDebugConfig returns the current server configuration (sanitized)

func (*DebugHandler) HandleAPIDebugMetrics

func (h *DebugHandler) HandleAPIDebugMetrics(w http.ResponseWriter, r *http.Request)

HandleAPIDebugMetrics returns internal server metrics for debugging

func (*DebugHandler) HandleAPIDebugPprof

func (h *DebugHandler) HandleAPIDebugPprof(w http.ResponseWriter, r *http.Request)

HandleAPIDebugPprof enables Go pprof profiling endpoints

func (*DebugHandler) HandleAPIDebugTest

func (h *DebugHandler) HandleAPIDebugTest(w http.ResponseWriter, r *http.Request)

HandleAPIDebugTest provides a test endpoint for debugging connectivity

func (*DebugHandler) HandleAPIHealthCheck

func (h *DebugHandler) HandleAPIHealthCheck(w http.ResponseWriter, r *http.Request)

HandleAPIHealthCheck returns the server health status

func (*DebugHandler) HandleAPIStatus

func (h *DebugHandler) HandleAPIStatus(w http.ResponseWriter, r *http.Request)

HandleAPIStatus returns detailed system status information

func (*DebugHandler) HandleAPIVersion

func (h *DebugHandler) HandleAPIVersion(w http.ResponseWriter, r *http.Request)

HandleAPIVersion returns version and build information

func (*DebugHandler) HandleCacheAudit

func (h *DebugHandler) HandleCacheAudit(w http.ResponseWriter, r *http.Request)

HandleCacheAudit performs an audit of the cache systems and returns diagnostic information

type DevicesHandler

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

DevicesHandler handles network device management operations

func NewDevicesHandler

func NewDevicesHandler(sys *sys.SystemContext) *DevicesHandler

NewDevicesHandler creates a new devices handler

func (*DevicesHandler) HandleAPIDevice

func (h *DevicesHandler) HandleAPIDevice(w http.ResponseWriter, r *http.Request)

HandleAPIDevice handles single device retrieval requests GET /devices/{id}

func (*DevicesHandler) HandleAPIDeviceCreate

func (h *DevicesHandler) HandleAPIDeviceCreate(w http.ResponseWriter, r *http.Request)

HandleAPIDeviceCreate handles device creation requests POST /devices

func (*DevicesHandler) HandleAPIDeviceDelete

func (h *DevicesHandler) HandleAPIDeviceDelete(w http.ResponseWriter, r *http.Request)

HandleAPIDeviceDelete handles device deletion requests DELETE /devices/{id}

func (*DevicesHandler) HandleAPIDeviceDiscover

func (h *DevicesHandler) HandleAPIDeviceDiscover(w http.ResponseWriter, r *http.Request)

HandleAPIDeviceDiscover handles device discovery requests POST /devices/discover

func (*DevicesHandler) HandleAPIDeviceInterfaces

func (h *DevicesHandler) HandleAPIDeviceInterfaces(w http.ResponseWriter, r *http.Request)

HandleAPIDeviceInterfaces handles device interface listing requests GET /devices/{id}/interfaces

func (*DevicesHandler) HandleAPIDevicePoll

func (h *DevicesHandler) HandleAPIDevicePoll(w http.ResponseWriter, r *http.Request)

HandleAPIDevicePoll handles device polling requests POST /devices/{id}/poll

func (*DevicesHandler) HandleAPIDeviceStatus

func (h *DevicesHandler) HandleAPIDeviceStatus(w http.ResponseWriter, r *http.Request)

HandleAPIDeviceStatus handles device status requests GET /devices/{id}/status

func (*DevicesHandler) HandleAPIDeviceUpdate

func (h *DevicesHandler) HandleAPIDeviceUpdate(w http.ResponseWriter, r *http.Request)

HandleAPIDeviceUpdate handles device update requests PUT /devices/{id}

func (*DevicesHandler) HandleAPIDevices

func (h *DevicesHandler) HandleAPIDevices(w http.ResponseWriter, r *http.Request)

HandleAPIDevices handles device listing requests GET /devices

type EndpointFilter

type EndpointFilter struct {
	EndpointID  string
	Hostname    string
	Status      string
	HostID      string
	IP          string
	OS          string
	Arch        string
	Labels      map[string]string
	Tags        map[string]string
	LastSeenMin time.Duration
	LastSeenMax time.Duration
	Limit       int
	Sort        string
	Order       string
}

EndpointFilter represents filters for endpoint queries

type EndpointsHandler

type EndpointsHandler struct {
	Sys *sys.SystemContext
}

EndpointsHandler handles endpoint management API requests

func NewEndpointsHandler

func NewEndpointsHandler(sys *sys.SystemContext) *EndpointsHandler

NewEndpointsHandler creates a new EndpointsHandler

func (*EndpointsHandler) HandleAPIEndpoint

func (h *EndpointsHandler) HandleAPIEndpoint(w http.ResponseWriter, r *http.Request)

HandleAPIEndpoint returns a specific endpoint by ID

func (*EndpointsHandler) HandleAPIEndpointCreate

func (h *EndpointsHandler) HandleAPIEndpointCreate(w http.ResponseWriter, r *http.Request)

HandleAPIEndpointCreate creates a new endpoint (placeholder)

func (*EndpointsHandler) HandleAPIEndpointDelete

func (h *EndpointsHandler) HandleAPIEndpointDelete(w http.ResponseWriter, r *http.Request)

HandleAPIEndpointDelete deletes an endpoint (placeholder)

func (*EndpointsHandler) HandleAPIEndpointDisable

func (h *EndpointsHandler) HandleAPIEndpointDisable(w http.ResponseWriter, r *http.Request)

HandleAPIEndpointDisable disables an endpoint (placeholder)

func (*EndpointsHandler) HandleAPIEndpointEnable

func (h *EndpointsHandler) HandleAPIEndpointEnable(w http.ResponseWriter, r *http.Request)

HandleAPIEndpointEnable enables an endpoint (placeholder)

func (*EndpointsHandler) HandleAPIEndpointStatus

func (h *EndpointsHandler) HandleAPIEndpointStatus(w http.ResponseWriter, r *http.Request)

HandleAPIEndpointStatus gets endpoint status

func (*EndpointsHandler) HandleAPIEndpointTest

func (h *EndpointsHandler) HandleAPIEndpointTest(w http.ResponseWriter, r *http.Request)

HandleAPIEndpointTest tests an endpoint connection (placeholder)

func (*EndpointsHandler) HandleAPIEndpointUpdate

func (h *EndpointsHandler) HandleAPIEndpointUpdate(w http.ResponseWriter, r *http.Request)

HandleAPIEndpointUpdate updates an endpoint (placeholder)

func (*EndpointsHandler) HandleAPIEndpoints

func (h *EndpointsHandler) HandleAPIEndpoints(w http.ResponseWriter, r *http.Request)

HandleAPIEndpoints returns a JSON list of active endpoints It supports querying or listing all endpoints as well as /api/v1/endpoints/{endpoint_type} (hosts / containers)

func (*EndpointsHandler) HandleAPIEndpointsByType

func (h *EndpointsHandler) HandleAPIEndpointsByType(w http.ResponseWriter, r *http.Request)

HandleAPIEndpointsByType handles the /api/v1/endpoints/{endpointType} endpoint

type EventsHandler

type EventsHandler struct {
	Sys *sys.SystemContext
}

EventsHandler provides handlers for events API endpoints

func NewEventsHandler

func NewEventsHandler(sys *sys.SystemContext) *EventsHandler

NewEventsHandler creates a new EventsHandler

func (*EventsHandler) HandleEventsAPI

func (h *EventsHandler) HandleEventsAPI(w http.ResponseWriter, r *http.Request)

HandleEventsAPI handles api calls to /api/events. It returns a list of events based on the provided filters. The filters are: - level: the level of the event (e.g., "info", "error") - type: the type of the event (e.g., "alert", "notification") - category: the category of the event (e.g., "system", "application") - source: the source of the event (e.g., "agent", "server") - contains: a string that must be contained in the event message - scope: the scope of the event (e.g., "global", "local") - target: the target of the event (e.g., "user", "system") - start: the start timestamp for the event (RFC3339 format) - end: the end timestamp for the event (RFC3339 format) - limit: the maximum number of events to return (default: 100) The response is a JSON array of event entries. If no filters are provided, all events are returned.

type FilesHandler

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

FilesHandler handles file upload and management operations

func NewFilesHandler

func NewFilesHandler(sys *sys.SystemContext) *FilesHandler

NewFilesHandler creates a new files handler

func (*FilesHandler) HandleAPIFile

func (h *FilesHandler) HandleAPIFile(w http.ResponseWriter, r *http.Request)

HandleAPIFile handles single file retrieval requests GET /files/{id}

func (*FilesHandler) HandleAPIFileDelete

func (h *FilesHandler) HandleAPIFileDelete(w http.ResponseWriter, r *http.Request)

HandleAPIFileDelete handles file deletion requests DELETE /files/{id}

func (*FilesHandler) HandleAPIFileDownload

func (h *FilesHandler) HandleAPIFileDownload(w http.ResponseWriter, r *http.Request)

HandleAPIFileDownload handles file download requests GET /files/{id}/download

func (*FilesHandler) HandleAPIFileUpload

func (h *FilesHandler) HandleAPIFileUpload(w http.ResponseWriter, r *http.Request)

HandleAPIFileUpload handles file upload requests POST /upload

func (*FilesHandler) HandleAPIFiles

func (h *FilesHandler) HandleAPIFiles(w http.ResponseWriter, r *http.Request)

HandleAPIFiles handles file listing requests GET /files

type LabelsHandler

type LabelsHandler struct {
	Sys *sys.SystemContext
}

LabelsHandler handles label-related API endpoints

func NewLabelsHandler

func NewLabelsHandler(sys *sys.SystemContext) *LabelsHandler

NewLabelsHandler creates a new LabelsHandler

func (*LabelsHandler) HandleLabelValues

func (h *LabelsHandler) HandleLabelValues(w http.ResponseWriter, r *http.Request)

HandleLabelValues returns all values for a given label key from the metric cache

type LogQueryParams

type LogQueryParams struct {
	Level     string
	Source    string
	Host      string
	Container string
	Contains  string
	Start     *time.Time
	End       *time.Time
	Limit     int
	Cursor    string
}

LogQueryParams represents the query parameters for log requests

type LogResponse

type LogResponse struct {
	Logs       []model.LogEntry `json:"logs"`
	NextCursor string           `json:"next_cursor,omitempty"`
	HasMore    bool             `json:"has_more"`
	Count      int              `json:"count"`
}

LogResponse represents the response structure for log API calls

type LogsHandler

type LogsHandler struct {
	Sys *sys.SystemContext
}

LogsHandler provides handlers for logs API endpoints

func NewLogsHandler

func NewLogsHandler(sys *sys.SystemContext) *LogsHandler

NewLogsHandler creates a new LogsHandler

func (*LogsHandler) HandleLogAPI

func (h *LogsHandler) HandleLogAPI(w http.ResponseWriter, r *http.Request)

HandleLogAPI handles the HTTP request for the log API. It retrieves the logs from the log store, applies any filters specified in the query parameters, and returns the logs as a JSON response. The function uses the LogQueryParams struct to parse the query parameters and filter the logs. It handles errors and returns appropriate HTTP status codes and messages. It also supports pagination using cursor-based pagination.

type MetricsHandler

type MetricsHandler struct {
	Sys *sys.SystemContext
}

MetricsHandler provides handlers for metrics and metadata API endpoints

func NewMetricsHandler

func NewMetricsHandler(sys *sys.SystemContext) *MetricsHandler

NewMetricsHandler creates a new MetricsHandler

func (*MetricsHandler) GetDimensions

func (h *MetricsHandler) GetDimensions(w http.ResponseWriter, r *http.Request)

GetDimensions retrieves all available dimensions. It returns a JSON object containing the dimensions. The URL format is: /api/v1/dimensions

func (*MetricsHandler) GetMetricData

func (h *MetricsHandler) GetMetricData(w http.ResponseWriter, r *http.Request)

GetMetricData retrieves metric data for a specific metric. It accepts a namespace, subnamespace, and metric name as URL parameters. The response is a JSON object containing the metric data. The URL format is: /api/v1/{namespace}/{sub}/{metric}/data

func (*MetricsHandler) GetMetricDimensions

func (h *MetricsHandler) GetMetricDimensions(w http.ResponseWriter, r *http.Request)

GetMetricDimensions retrieves the dimensions for a specific metric. It accepts a namespace, subnamespace, and metric name as URL parameters. The response is a JSON object containing the dimensions. The URL format is: /api/v1/{namespace}/{sub}/{metric}/dimensions

func (*MetricsHandler) GetMetricLatest

func (h *MetricsHandler) GetMetricLatest(w http.ResponseWriter, r *http.Request)

GetMetricLatest retrieves the latest value for a specific metric. It accepts a namespace, subnamespace, and metric name as URL parameters. The response is a JSON object containing the latest value and timestamp. The URL format is: /api/v1/{namespace}/{sub}/{metric}/latest

func (*MetricsHandler) GetMetricNames

func (h *MetricsHandler) GetMetricNames(w http.ResponseWriter, r *http.Request)

GetMetricNames retrieves all metric names for a given namespace and subnamespace. It returns a JSON object containing the metric names. The URL format is: /api/v1/{namespace}/{sub}/metrics

func (*MetricsHandler) GetNamespaces

func (h *MetricsHandler) GetNamespaces(w http.ResponseWriter, r *http.Request)

GetNamespaces retrieves all namespaces. It returns a JSON object containing the namespaces. The URL format is: /api/v1/

func (*MetricsHandler) GetSubNamespaces

func (h *MetricsHandler) GetSubNamespaces(w http.ResponseWriter, r *http.Request)

GetSubNamespaces retrieves all sub-namespaces for a given namespace. It returns a JSON object containing the sub-namespaces. The URL format is: /api/v1/{namespace}

func (*MetricsHandler) HandleAPIQuery

func (h *MetricsHandler) HandleAPIQuery(w http.ResponseWriter, r *http.Request)

HandleAPIQuery handles flexible label-based queries without requiring a metric name. Supports optional time range via start= and end= query params. It also supports sorting and limiting the results. The query parameters are: - metric: the metric name(s) to query - start: the start time for the query (RFC3339 format) - end: the end time for the query (RFC3339 format) - step: the step interval for the query (default is 15s) - limit: the maximum number of results to return - sort: the sort order for the results (asc or desc) - tags: additional filters for the query (key=value pairs) The response is a JSON object containing the query results.

func (*MetricsHandler) HandleExportQuery

func (h *MetricsHandler) HandleExportQuery(w http.ResponseWriter, r *http.Request)

HandleExportQuery handles flexible label-based queries without requiring a metric name. Supports optional time range via start= and end= query params.

type PermissionHandler

type PermissionHandler struct {
	Sys *sys.SystemContext
}

PermissionHandler handles HTTP requests related to permissions.

func NewPermissionHandler

func NewPermissionHandler(sys *sys.SystemContext) *PermissionHandler

NewPermissionHandler creates a new PermissionHandler with the given system context.

func (*PermissionHandler) CreatePermission

func (h *PermissionHandler) CreatePermission(w http.ResponseWriter, r *http.Request)

CreatePermission handles POST /permissions and creates a new permission. Expects a JSON body with name and description fields. Responds with the created Permission object.

func (*PermissionHandler) DeletePermission

func (h *PermissionHandler) DeletePermission(w http.ResponseWriter, r *http.Request)

DeletePermission handles DELETE /permissions/{id} and deletes a permission. Responds with HTTP 204 No Content on success.

func (*PermissionHandler) GetPermission

func (h *PermissionHandler) GetPermission(w http.ResponseWriter, r *http.Request)

GetPermission handles GET /permissions/{id} and returns a specific permission by ID. Responds with a JSON Permission object if found.

func (*PermissionHandler) GetPermissions

func (h *PermissionHandler) GetPermissions(w http.ResponseWriter, r *http.Request)

GetPermissions handles GET /permissions and returns all permissions. Responds with a JSON array of Permission objects.

func (*PermissionHandler) GetRolesWithPermission

func (h *PermissionHandler) GetRolesWithPermission(w http.ResponseWriter, r *http.Request)

GetRolesWithPermission handles GET /permissions/{id}/roles and returns roles with a specific permission. Responds with a JSON array of Role objects.

func (*PermissionHandler) UpdatePermission

func (h *PermissionHandler) UpdatePermission(w http.ResponseWriter, r *http.Request)

UpdatePermission handles PUT /permissions/{id} and updates an existing permission. Expects a JSON body with name and description fields. Responds with the updated Permission object.

type ResourcesHandler

type ResourcesHandler struct {
	Sys *sys.SystemContext
}

ResourcesHandler handles resource management endpoints

func NewResourcesHandler

func NewResourcesHandler(sys *sys.SystemContext) *ResourcesHandler

NewResourcesHandler creates a new ResourcesHandler

func (*ResourcesHandler) CreateResource

func (h *ResourcesHandler) CreateResource(w http.ResponseWriter, r *http.Request)

CreateResource handles POST /resources

func (*ResourcesHandler) DeleteResource

func (h *ResourcesHandler) DeleteResource(w http.ResponseWriter, r *http.Request)

DeleteResource handles DELETE /resources/{id}

func (*ResourcesHandler) GetResource

func (h *ResourcesHandler) GetResource(w http.ResponseWriter, r *http.Request)

GetResource handles GET /resources/{id}

func (*ResourcesHandler) GetResourceKinds

func (h *ResourcesHandler) GetResourceKinds(w http.ResponseWriter, r *http.Request)

GetResourceKinds handles GET /resources/kinds

func (*ResourcesHandler) GetResourceSummary

func (h *ResourcesHandler) GetResourceSummary(w http.ResponseWriter, r *http.Request)

GetResourceSummary handles GET /resources/summary

func (*ResourcesHandler) GetResourcesByKind

func (h *ResourcesHandler) GetResourcesByKind(w http.ResponseWriter, r *http.Request)

GetResourcesByKind handles GET /resources/kinds/{kind}

func (*ResourcesHandler) GetResourcesByLabels

func (h *ResourcesHandler) GetResourcesByLabels(w http.ResponseWriter, r *http.Request)

GetResourcesByLabels handles GET /resources/labels

func (*ResourcesHandler) GetResourcesByTags

func (h *ResourcesHandler) GetResourcesByTags(w http.ResponseWriter, r *http.Request)

GetResourcesByTags handles GET /resources/tags

func (*ResourcesHandler) ListResources

func (h *ResourcesHandler) ListResources(w http.ResponseWriter, r *http.Request)

ListResources handles GET /resources

func (*ResourcesHandler) SearchResources

func (h *ResourcesHandler) SearchResources(w http.ResponseWriter, r *http.Request)

SearchResources handles POST /resources/search

func (*ResourcesHandler) UpdateResource

func (h *ResourcesHandler) UpdateResource(w http.ResponseWriter, r *http.Request)

UpdateResource handles PUT /resources/{id}

func (*ResourcesHandler) UpdateResourceStatus

func (h *ResourcesHandler) UpdateResourceStatus(w http.ResponseWriter, r *http.Request)

UpdateResourceStatus handles PUT /resources/{id}/status

func (*ResourcesHandler) UpdateResourceTags

func (h *ResourcesHandler) UpdateResourceTags(w http.ResponseWriter, r *http.Request)

UpdateResourceTags handles PUT /resources/{id}/tags

type RoleHandler

type RoleHandler struct {
	Sys *sys.SystemContext
}

func NewRoleHandler

func NewRoleHandler(sys *sys.SystemContext) *RoleHandler

func (*RoleHandler) AssignPermissionsToRole

func (h *RoleHandler) AssignPermissionsToRole(w http.ResponseWriter, r *http.Request)

AssignPermissionsToRole assigns permissions to a role

func (*RoleHandler) CreateRole

func (h *RoleHandler) CreateRole(w http.ResponseWriter, r *http.Request)

CreateRole creates a new role

func (*RoleHandler) DeleteRole

func (h *RoleHandler) DeleteRole(w http.ResponseWriter, r *http.Request)

DeleteRole deletes a role

func (*RoleHandler) GetRole

func (h *RoleHandler) GetRole(w http.ResponseWriter, r *http.Request)

GetRole returns a specific role by ID

func (*RoleHandler) GetRolePermissions

func (h *RoleHandler) GetRolePermissions(w http.ResponseWriter, r *http.Request)

GetRolePermissions returns permissions for a specific role

func (*RoleHandler) GetRoles

func (h *RoleHandler) GetRoles(w http.ResponseWriter, r *http.Request)

GetRoles returns all roles

func (*RoleHandler) GetUsersWithRole

func (h *RoleHandler) GetUsersWithRole(w http.ResponseWriter, r *http.Request)

GetUsersWithRole returns users that have a specific role

func (*RoleHandler) UpdateRole

func (h *RoleHandler) UpdateRole(w http.ResponseWriter, r *http.Request)

UpdateRole updates an existing role

type SearchHandler

type SearchHandler struct {
	Sys *sys.SystemContext
}

SearchHandler handles search-related API endpoints

func NewSearchHandler

func NewSearchHandler(sys *sys.SystemContext) *SearchHandler

NewSearchHandler creates a new SearchHandler

func (*SearchHandler) HandleAPICommand

func (h *SearchHandler) HandleAPICommand(w http.ResponseWriter, r *http.Request)

HandleAPICommand handles single command retrieval requests GET /commands/{id}

func (*SearchHandler) HandleAPICommandExecute

func (h *SearchHandler) HandleAPICommandExecute(w http.ResponseWriter, r *http.Request)

HandleAPICommandExecute handles command execution requests POST /commands

func (*SearchHandler) HandleAPICommandStatus

func (h *SearchHandler) HandleAPICommandStatus(w http.ResponseWriter, r *http.Request)

HandleAPICommandStatus handles command status requests GET /commands/{id}/status

func (*SearchHandler) HandleAPICommands

func (h *SearchHandler) HandleAPICommands(w http.ResponseWriter, r *http.Request)

HandleAPICommands handles command listing requests GET /commands

func (*SearchHandler) HandleAPISearch

func (h *SearchHandler) HandleAPISearch(w http.ResponseWriter, r *http.Request)

HandleAPISearch is an alias for HandleGlobalSearchAPI for route compatibility

func (*SearchHandler) HandleAPISearchIndex

func (h *SearchHandler) HandleAPISearchIndex(w http.ResponseWriter, r *http.Request)

HandleAPISearchIndex handles search index rebuilding requests POST /search/index

func (*SearchHandler) HandleAPISearchSuggestions

func (h *SearchHandler) HandleAPISearchSuggestions(w http.ResponseWriter, r *http.Request)

HandleAPISearchSuggestions handles search suggestion requests GET /search/suggestions

func (*SearchHandler) HandleGlobalSearchAPI

func (h *SearchHandler) HandleGlobalSearchAPI(w http.ResponseWriter, r *http.Request)

HandleGlobalSearchAPI handles global search requests across all data types

type SearchResult

type SearchResult struct {
	Hosts      []map[string]string `json:"hosts"`
	Containers []map[string]string `json:"containers"`
	Rules      []map[string]string `json:"rules"`
	Tags       []map[string]string `json:"tags"`
	Logs       []map[string]string `json:"logs"`
}

type TagsHandler

type TagsHandler struct {
	Sys *sys.SystemContext
}

TagsHandler handles tag-related API endpoints

func NewTagsHandler

func NewTagsHandler(sys *sys.SystemContext) *TagsHandler

NewTagsHandler creates a new TagsHandler

func (*TagsHandler) HandleAPITag

func (h *TagsHandler) HandleAPITag(w http.ResponseWriter, r *http.Request)

HandleAPITag handles GET /tags/{id} - Get tag by ID

func (*TagsHandler) HandleAPITagAssign

func (h *TagsHandler) HandleAPITagAssign(w http.ResponseWriter, r *http.Request)

HandleAPITagAssign handles POST /tags/{id}/assign - Assign tag to resource

func (*TagsHandler) HandleAPITagCreate

func (h *TagsHandler) HandleAPITagCreate(w http.ResponseWriter, r *http.Request)

HandleAPITagCreate handles POST /tags - Create new tag

func (*TagsHandler) HandleAPITagDelete

func (h *TagsHandler) HandleAPITagDelete(w http.ResponseWriter, r *http.Request)

HandleAPITagDelete handles DELETE /tags/{id} - Delete tag

func (*TagsHandler) HandleAPITagSearch

func (h *TagsHandler) HandleAPITagSearch(w http.ResponseWriter, r *http.Request)

HandleAPITagSearch handles GET /tags/search - Search tags

func (*TagsHandler) HandleAPITagUnassign

func (h *TagsHandler) HandleAPITagUnassign(w http.ResponseWriter, r *http.Request)

HandleAPITagUnassign handles DELETE /tags/{id}/assign - Remove tag from resource

func (*TagsHandler) HandleAPITagUpdate

func (h *TagsHandler) HandleAPITagUpdate(w http.ResponseWriter, r *http.Request)

HandleAPITagUpdate handles PUT /tags/{id} - Update tag

func (*TagsHandler) HandleAPITags

func (h *TagsHandler) HandleAPITags(w http.ResponseWriter, r *http.Request)

HandleAPITags handles GET /tags - List all tags

func (*TagsHandler) HandleDeleteTag

func (h *TagsHandler) HandleDeleteTag(w http.ResponseWriter, r *http.Request)

HandleDeleteTag deletes a specific tag key

func (*TagsHandler) HandleGetTags

func (h *TagsHandler) HandleGetTags(w http.ResponseWriter, r *http.Request)

HandleGetTags returns all tags for an endpoint

func (*TagsHandler) HandlePatchTags

func (h *TagsHandler) HandlePatchTags(w http.ResponseWriter, r *http.Request)

HandlePatchTags updates or adds individual tags

func (*TagsHandler) HandleSetTags

func (h *TagsHandler) HandleSetTags(w http.ResponseWriter, r *http.Request)

HandleSetTags replaces all tags for an endpoint

func (*TagsHandler) HandleTagKeys

func (h *TagsHandler) HandleTagKeys(w http.ResponseWriter, r *http.Request)

HandleTagKeys returns all known tag keys

func (*TagsHandler) HandleTagValues

func (h *TagsHandler) HandleTagValues(w http.ResponseWriter, r *http.Request)

HandleTagValues returns all values for a given key

type TelemetryHandler

type TelemetryHandler struct {
	Sys *sys.SystemContext
}

TelemetryHandler handles telemetry data ingestion endpoints

func NewTelemetryHandler

func NewTelemetryHandler(sys *sys.SystemContext) *TelemetryHandler

NewTelemetryHandler creates a new TelemetryHandler

func (*TelemetryHandler) HandleLogs

func (h *TelemetryHandler) HandleLogs(w http.ResponseWriter, r *http.Request)

HandleLogs handles POST /telemetry/logs

func (*TelemetryHandler) HandleMetrics

func (h *TelemetryHandler) HandleMetrics(w http.ResponseWriter, r *http.Request)

HandleMetrics handles POST /telemetry/metrics

func (*TelemetryHandler) HandleTraces

func (h *TelemetryHandler) HandleTraces(w http.ResponseWriter, r *http.Request)

HandleTraces handles POST /telemetry/traces

type UpdatePermissionRequest

type UpdatePermissionRequest struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

UpdatePermissionRequest represents the payload for updating an existing permission.

type UpdateRoleRequest

type UpdateRoleRequest struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

type UsersHandler

type UsersHandler struct {
	Sys *sys.SystemContext
}

UsersHandler provides handlers for user API endpoints

func NewUsersHandler

func NewUsersHandler(sys *sys.SystemContext) *UsersHandler

NewUsersHandler creates a new UsersHandler

func (*UsersHandler) AssignRolesToUser

func (h *UsersHandler) AssignRolesToUser(w http.ResponseWriter, r *http.Request)

AssignRolesToUser assigns roles to a user

func (*UsersHandler) GetUserRoles

func (h *UsersHandler) GetUserRoles(w http.ResponseWriter, r *http.Request)

GetUserRoles returns all roles assigned to a user

func (*UsersHandler) HandleAPIUser

func (h *UsersHandler) HandleAPIUser(w http.ResponseWriter, r *http.Request)

HandleAPIUser handles GET /users/{id} requests to get a user by ID

func (*UsersHandler) HandleAPIUserCreate

func (h *UsersHandler) HandleAPIUserCreate(w http.ResponseWriter, r *http.Request)

HandleAPIUserCreate handles POST /users requests to create a new user

func (*UsersHandler) HandleAPIUserDelete

func (h *UsersHandler) HandleAPIUserDelete(w http.ResponseWriter, r *http.Request)

HandleAPIUserDelete handles DELETE /users/{id} requests to delete a user

func (*UsersHandler) HandleAPIUserPasswordChange

func (h *UsersHandler) HandleAPIUserPasswordChange(w http.ResponseWriter, r *http.Request)

HandleAPIUserPasswordChange handles POST /users/{id}/password requests to change a user's password (admin)

func (*UsersHandler) HandleAPIUserSettings

func (h *UsersHandler) HandleAPIUserSettings(w http.ResponseWriter, r *http.Request)

HandleAPIUserSettings handles GET /users/{id}/settings requests to get user settings by ID

func (*UsersHandler) HandleAPIUserSettingsUpdate

func (h *UsersHandler) HandleAPIUserSettingsUpdate(w http.ResponseWriter, r *http.Request)

HandleAPIUserSettingsUpdate handles PUT /users/{id}/settings requests to update user settings by ID

func (*UsersHandler) HandleAPIUserUpdate

func (h *UsersHandler) HandleAPIUserUpdate(w http.ResponseWriter, r *http.Request)

HandleAPIUserUpdate handles PUT /users/{id} requests to update a user

func (*UsersHandler) HandleAPIUsers

func (h *UsersHandler) HandleAPIUsers(w http.ResponseWriter, r *http.Request)

HandleAPIUsers handles GET /users requests to list all users

func (*UsersHandler) HandleCropAvatar

func (h *UsersHandler) HandleCropAvatar(w http.ResponseWriter, r *http.Request)

HandleCropAvatar handles POST /users/avatar/crop requests to crop user avatar

func (*UsersHandler) HandleDeleteAvatar

func (h *UsersHandler) HandleDeleteAvatar(w http.ResponseWriter, r *http.Request)

HandleDeleteAvatar handles DELETE /users/avatar requests to delete user avatar

func (*UsersHandler) HandleGetCompleteUser

func (h *UsersHandler) HandleGetCompleteUser(w http.ResponseWriter, r *http.Request)

HandleGetCompleteUser handles GET /users/me requests to get complete user data with profile and settings

func (*UsersHandler) HandleGetUploadLimits

func (h *UsersHandler) HandleGetUploadLimits(w http.ResponseWriter, r *http.Request)

HandleGetUploadLimits handles GET /upload/limits requests to get file upload limits

func (*UsersHandler) HandleGetUserPreferences

func (h *UsersHandler) HandleGetUserPreferences(w http.ResponseWriter, r *http.Request)

HandleGetUserPreferences handles GET /users/preferences requests to get user settings

func (*UsersHandler) HandleUpdateUserPassword

func (h *UsersHandler) HandleUpdateUserPassword(w http.ResponseWriter, r *http.Request)

HandleUpdateUserPassword handles PUT /users/password requests to update user password

func (*UsersHandler) HandleUpdateUserPreferences

func (h *UsersHandler) HandleUpdateUserPreferences(w http.ResponseWriter, r *http.Request)

HandleUpdateUserPreferences handles PUT /users/preferences requests to update user settings

func (*UsersHandler) HandleUpdateUserProfile

func (h *UsersHandler) HandleUpdateUserProfile(w http.ResponseWriter, r *http.Request)

HandleUpdateUserProfile handles PUT /users/profile requests to update user profile

func (*UsersHandler) HandleUploadAvatar

func (h *UsersHandler) HandleUploadAvatar(w http.ResponseWriter, r *http.Request)

HandleUploadAvatar handles POST /users/avatar requests to upload user avatar

type WebSocketsHandler

type WebSocketsHandler struct {
	Sys *sys.SystemContext
}

WebSocketsHandler handles WebSocket connection endpoints

func NewWebSocketsHandler

func NewWebSocketsHandler(sys *sys.SystemContext) *WebSocketsHandler

NewWebSocketsHandler creates a new WebSocketsHandler

func (*WebSocketsHandler) HandleAlertsWS

func (h *WebSocketsHandler) HandleAlertsWS(w http.ResponseWriter, r *http.Request)

HandleAlertsWS handles WebSocket connections for alerts streaming

func (*WebSocketsHandler) HandleCommandWS

func (h *WebSocketsHandler) HandleCommandWS(w http.ResponseWriter, r *http.Request)

HandleCommandWS handles WebSocket connections for command execution

func (*WebSocketsHandler) HandleEventsWS

func (h *WebSocketsHandler) HandleEventsWS(w http.ResponseWriter, r *http.Request)

HandleEventsWS handles WebSocket connections for events streaming

func (*WebSocketsHandler) HandleLogsWS

func (h *WebSocketsHandler) HandleLogsWS(w http.ResponseWriter, r *http.Request)

HandleLogsWS handles WebSocket connections for logs streaming

func (*WebSocketsHandler) HandleMetricsWS

func (h *WebSocketsHandler) HandleMetricsWS(w http.ResponseWriter, r *http.Request)

HandleMetricsWS handles WebSocket connections for metrics streaming

func (*WebSocketsHandler) HandleProcessWS

func (h *WebSocketsHandler) HandleProcessWS(w http.ResponseWriter, r *http.Request)

HandleProcessWS handles WebSocket connections for process monitoring

Jump to

Keyboard shortcuts

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