Documentation
¶
Index ¶
Constants ¶
const ( ErrorCodeServiceNotFound = "SERVICE_NOT_FOUND" ErrorCodeEnvironmentNotFound = "ENVIRONMENT_NOT_FOUND" ErrorCodeK8sConnectionFailed = "K8S_CONNECTION_FAILED" ErrorCodeLogsNotAvailable = "LOGS_NOT_AVAILABLE" ErrorCodeInvalidToken = "INVALID_TOKEN" ErrorCodeUnknown = "UNKNOWN_ERROR" )
Error codes for common logs service scenarios
Variables ¶
This section is empty.
Functions ¶
func GetErrorCode ¶
GetErrorCode extracts the error code from a BusinessError, or returns UNKNOWN for other errors
func GetErrorContext ¶
GetErrorContext extracts the context from a BusinessError
func IsBusinessError ¶
IsBusinessError checks if an error is a BusinessError
func ParseAPIError ¶
ParseAPIError analyzes an API error and converts it to a BusinessError if possible
Types ¶
type BusinessError ¶
type BusinessError struct {
Code string `json:"code"`
Message string `json:"message"`
Context map[string]interface{} `json:"context,omitempty"`
}
BusinessError represents a structured business logic error
func (*BusinessError) Error ¶
func (e *BusinessError) Error() string
type GetLogsRequest ¶
type GetLogsRequest struct {
EnvironmentID string
ServiceName string
Follow bool
TailLines int64
Page int
PageSize int
}
GetLogsRequest contains parameters for getting logs
type LogLine ¶
type LogLine struct {
Timestamp time.Time `json:"timestamp"`
Content string `json:"content"`
Service string `json:"service"`
}
LogLine represents a single log line with metadata
type LogsManager ¶
type LogsManager struct {
// contains filtered or unexported fields
}
LogsManager handles logs business operations
func NewLogsManager ¶
func NewLogsManager(client client.Client) *LogsManager
NewLogsManager creates a new logs manager
func (*LogsManager) FormatLogsAsText ¶
func (s *LogsManager) FormatLogsAsText(logs []LogLine) string
FormatLogsAsText formats logs for text display
func (*LogsManager) GetLogs ¶
func (s *LogsManager) GetLogs(ctx context.Context, req GetLogsRequest) (*LogsResponse, error)
GetLogs retrieves logs for a service in an environment
func (*LogsManager) GetLogsReader ¶
func (s *LogsManager) GetLogsReader(ctx context.Context, req GetLogsRequest) (io.Reader, error)
GetLogsReader returns an io.Reader for logs (useful for MCP resources)
type LogsResponse ¶
type LogsResponse struct {
Lines []LogLine `json:"lines"`
Service string `json:"service"`
EnvID string `json:"environment_id"`
HasNext bool `json:"has_next"`
NextPage int `json:"next_page"`
Page int `json:"page"`
PageSize int `json:"page_size"`
}
LogsResponse contains the result of log retrieval