Documentation
¶
Overview ¶
Package types defines API request and response types.
Package types defines API request and response types.
Index ¶
- Constants
- func NullInt32ToPtr(ni sql.NullInt32) *int32
- func NullStringToPtr(ns sql.NullString) *string
- func NullTimeToPtr(nt sql.NullTime) *time.Time
- type ConfigResponse
- type CreateConfigRequest
- type CreateDeploymentRequest
- type DeploymentResponse
- type ErrorResponse
- type EventResponse
- type EventStatsResponse
- type EventTypeInfo
- type ExecuteDeploymentRequest
- type ExecutionResponse
- type HealthResponse
- type ListEventsRequest
- type ListParams
- type ListResponse
- type UpdateConfigRequest
- type UpdateDeploymentRequest
- type ValidateConfigRequest
- type ValidationErrorResponse
- type ValidationResult
Constants ¶
const DefaultLimit = 20
DefaultLimit is the default number of items per page.
const DefaultMaxLimit = 100
DefaultMaxLimit is the maximum allowed limit.
Variables ¶
This section is empty.
Functions ¶
func NullInt32ToPtr ¶
NullInt32ToPtr converts sql.NullInt32 to *int32.
func NullStringToPtr ¶
func NullStringToPtr(ns sql.NullString) *string
NullStringToPtr converts sql.NullString to *string.
Types ¶
type ConfigResponse ¶
type ConfigResponse struct {
ID string `json:"id"`
Name string `json:"name"`
Content string `json:"content"`
ASTJSON json.RawMessage `json:"ast_json,omitempty"`
ValidationErrors json.RawMessage `json:"validation_errors,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
ConfigResponse represents a config in API responses.
func ConfigFromModel ¶
func ConfigFromModel(c *models.Config) *ConfigResponse
ConfigFromModel converts a database model to an API response.
func ConfigsFromModels ¶
func ConfigsFromModels(configs []*models.Config) []*ConfigResponse
ConfigsFromModels converts a slice of database models to API responses.
type CreateConfigRequest ¶
type CreateConfigRequest struct {
Name string `json:"name" validate:"required,min=1,max=255"`
Content string `json:"content" validate:"required"`
}
CreateConfigRequest represents a request to create a config.
type CreateDeploymentRequest ¶
type CreateDeploymentRequest struct {
Name string `json:"name" validate:"required,min=1,max=255"`
ConfigID string `json:"config_id" validate:"omitempty,uuid"`
}
CreateDeploymentRequest represents a request to create a deployment.
type DeploymentResponse ¶
type DeploymentResponse struct {
ID string `json:"id"`
Name string `json:"name"`
ConfigID *string `json:"config_id,omitempty"`
Status string `json:"status"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
DeploymentResponse represents a deployment in API responses.
func DeploymentFromModel ¶
func DeploymentFromModel(d *models.Deployment) *DeploymentResponse
DeploymentFromModel converts a database model to an API response.
func DeploymentsFromModels ¶
func DeploymentsFromModels(deployments []*models.Deployment) []*DeploymentResponse
DeploymentsFromModels converts a slice of database models to API responses.
type ErrorResponse ¶
type ErrorResponse struct {
Error string `json:"error"`
Details map[string]string `json:"details,omitempty"`
}
ErrorResponse represents an error in API responses.
type EventResponse ¶
type EventResponse struct {
ID string `json:"id"`
Type string `json:"type"`
Source string `json:"source"`
Timestamp time.Time `json:"timestamp"`
Data map[string]interface{} `json:"data"`
Metadata map[string]string `json:"metadata"`
}
EventResponse represents an event in API responses.
func EventFromBus ¶
func EventFromBus(e bus.Event) *EventResponse
EventFromBus converts a bus.Event to an API response.
func EventsFromBus ¶
func EventsFromBus(events []bus.Event) []*EventResponse
EventsFromBus converts a slice of bus.Events to API responses.
type EventStatsResponse ¶
type EventStatsResponse struct {
TotalEvents int64 `json:"total_events"`
ByType map[string]int64 `json:"by_type"`
BySource map[string]int64 `json:"by_source"`
}
EventStatsResponse represents event statistics.
type EventTypeInfo ¶
type EventTypeInfo struct {
Type string `json:"type"`
Description string `json:"description"`
Category string `json:"category"`
}
EventTypeInfo describes an event type.
func GetEventTypes ¶
func GetEventTypes() []EventTypeInfo
GetEventTypes returns all available event types with descriptions.
type ExecuteDeploymentRequest ¶
type ExecuteDeploymentRequest struct {
Variables map[string]interface{} `json:"variables"`
}
ExecuteDeploymentRequest represents a request to execute a deployment.
type ExecutionResponse ¶
type ExecutionResponse struct {
ID string `json:"id"`
DeploymentID string `json:"deployment_id"`
Command string `json:"command"`
Output *string `json:"output,omitempty"`
ExitCode *int32 `json:"exit_code,omitempty"`
StartedAt time.Time `json:"started_at"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
}
ExecutionResponse represents an execution in API responses.
func ExecutionFromModel ¶
func ExecutionFromModel(e *models.Execution) *ExecutionResponse
ExecutionFromModel converts a database model to an API response.
func ExecutionsFromModels ¶
func ExecutionsFromModels(executions []*models.Execution) []*ExecutionResponse
ExecutionsFromModels converts a slice of database models to API responses.
type HealthResponse ¶
HealthResponse represents a health check response.
type ListEventsRequest ¶
type ListEventsRequest struct {
Types []string `json:"types"`
Sources []string `json:"sources"`
StartTime string `json:"start_time"`
EndTime string `json:"end_time"`
}
ListEventsRequest represents a request to list events.
type ListParams ¶
type ListParams struct {
Limit int `json:"limit" validate:"omitempty,min=1,max=100"`
Offset int `json:"offset" validate:"omitempty,min=0"`
}
ListParams represents common pagination parameters.
type ListResponse ¶
type ListResponse[T any] struct { Data []T `json:"data"` Limit int `json:"limit"` Offset int `json:"offset"` Total int `json:"total,omitempty"` }
ListResponse represents a paginated list response.
func NewListResponse ¶
func NewListResponse[T any](data []T, limit, offset int) *ListResponse[T]
NewListResponse creates a new list response.
type UpdateConfigRequest ¶
type UpdateConfigRequest struct {
Name string `json:"name" validate:"omitempty,min=1,max=255"`
Content string `json:"content" validate:"omitempty"`
}
UpdateConfigRequest represents a request to update a config.
type UpdateDeploymentRequest ¶
type UpdateDeploymentRequest struct {
Name string `json:"name" validate:"omitempty,min=1,max=255"`
ConfigID string `json:"config_id" validate:"omitempty,uuid"`
Status string `json:"status" validate:"omitempty,oneof=pending running stopped failed complete"`
}
UpdateDeploymentRequest represents a request to update a deployment.
type ValidateConfigRequest ¶
type ValidateConfigRequest struct {
Content string `json:"content" validate:"required"`
}
ValidateConfigRequest represents a request to validate a config.
type ValidationErrorResponse ¶
type ValidationErrorResponse struct {
Error string `json:"error"`
Errors []struct {
Field string `json:"field"`
Message string `json:"message"`
} `json:"errors,omitempty"`
}
ValidationErrorResponse represents validation errors in API responses.
type ValidationResult ¶
type ValidationResult struct {
Valid bool `json:"valid"`
Errors []string `json:"errors,omitempty"`
}
ValidationResult represents the result of config validation.