handlers

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Error types
	ErrorTypeMissingParameter = "missingParameter"
	ErrorTypeInvalidRequest   = "invalidRequest"
	ErrorTypeInternalError    = "internalError"

	// Error codes
	ErrorCodeMissingParameter = "OBS-L-10"
	ErrorCodeInvalidRequest   = "OBS-L-12"
	ErrorCodeInternalError    = "OBS-L-25"

	// Error messages
	ErrorMsgComponentIDRequired    = "Component ID is required"
	ErrorMsgProjectIDRequired      = "Project ID is required"
	ErrorMsgOrganizationIDRequired = "Organization ID is required"
	ErrorMsgInvalidRequestFormat   = "Invalid request format"
	ErrorMsgFailedToRetrieveLogs   = "Failed to retrieve logs"
)

Error codes and messages

Variables

This section is empty.

Functions

This section is empty.

Types

type ComponentLogsRequest

type ComponentLogsRequest struct {
	StartTime     string   `json:"startTime" validate:"required"`
	EndTime       string   `json:"endTime" validate:"required"`
	EnvironmentID string   `json:"environmentId" validate:"required"`
	Namespace     string   `json:"namespace" validate:"required"`
	SearchPhrase  string   `json:"searchPhrase,omitempty"`
	LogLevels     []string `json:"logLevels,omitempty"`
	Versions      []string `json:"versions,omitempty"`
	VersionIDs    []string `json:"versionIds,omitempty"`
	Limit         int      `json:"limit,omitempty"`
	SortOrder     string   `json:"sortOrder,omitempty"`
	LogType       string   `json:"logType,omitempty"`
	BuildID       string   `json:"buildId,omitempty"`
	BuildUUID     string   `json:"buildUuid,omitempty"`
}

ComponentLogsRequest represents the request body for component logs

type ErrorResponse

type ErrorResponse struct {
	Error   string `json:"error"`
	Code    string `json:"code"`
	Message string `json:"message"`
}

ErrorResponse represents an error response

type GatewayLogsRequest

type GatewayLogsRequest struct {
	StartTime         string            `json:"startTime" validate:"required"`
	EndTime           string            `json:"endTime" validate:"required"`
	OrganizationID    string            `json:"organizationId" validate:"required"`
	SearchPhrase      string            `json:"searchPhrase,omitempty"`
	APIIDToVersionMap map[string]string `json:"apiIdToVersionMap,omitempty"`
	GatewayVHosts     []string          `json:"gatewayVHosts,omitempty"`
	Limit             int               `json:"limit,omitempty"`
	SortOrder         string            `json:"sortOrder,omitempty"`
	LogType           string            `json:"logType,omitempty"`
}

GatewayLogsRequest represents the request body for gateway logs

type Handler

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

Handler contains the HTTP handlers for the logging API

func NewHandler

func NewHandler(service *service.LoggingService, logger *slog.Logger) *Handler

NewHandler creates a new handler instance

func (*Handler) GetComponentLogs

func (h *Handler) GetComponentLogs(w http.ResponseWriter, r *http.Request)

GetComponentLogs handles POST /api/logs/component/{componentId}

func (*Handler) GetGatewayLogs

func (h *Handler) GetGatewayLogs(w http.ResponseWriter, r *http.Request)

GetGatewayLogs handles POST /api/logs/gateway

func (*Handler) GetOrganizationLogs

func (h *Handler) GetOrganizationLogs(w http.ResponseWriter, r *http.Request)

GetOrganizationLogs handles POST /api/logs/org/{orgId}

func (*Handler) GetProjectLogs

func (h *Handler) GetProjectLogs(w http.ResponseWriter, r *http.Request)

GetProjectLogs handles POST /api/logs/project/{projectId}

func (*Handler) Health

func (h *Handler) Health(w http.ResponseWriter, r *http.Request)

Health handles GET /health

type OrganizationLogsRequest

type OrganizationLogsRequest struct {
	ComponentLogsRequest
	PodLabels map[string]string `json:"podLabels,omitempty"`
}

OrganizationLogsRequest represents the request body for organization logs

type ProjectLogsRequest

type ProjectLogsRequest struct {
	ComponentLogsRequest
	ComponentIDs []string `json:"componentIds,omitempty"`
}

ProjectLogsRequest represents the request body for project logs

Jump to

Keyboard shortcuts

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