Documentation
¶
Overview ¶
Package handlers provides HTTP request handlers for the API.
Package handlers provides HTTP handlers for the API.
Package handlers provides HTTP request handlers for the API.
Package handlers provides HTTP request handlers for the API.
Package handlers provides HTTP request handlers for the API.
Package handlers provides HTTP request handlers for the API.
Package handlers provides HTTP request handlers for the API.
Package handlers provides HTTP request handlers for the API.
Package handlers provides HTTP request handlers for the API.
Package handlers provides HTTP handlers for the update system.
Index ¶
- Constants
- func CopyOpenAPISpecToDocsDir() error
- func IsWildcardDomain(domain string) bool
- func ValidateDomain(domain string) bool
- func WriteBadRequest(w http.ResponseWriter, message string)
- func WriteConflict(w http.ResponseWriter, message string)
- func WriteError(w http.ResponseWriter, status int, code, message string)
- func WriteErrorWithDetails(w http.ResponseWriter, status int, code, message string, details any)
- func WriteForbidden(w http.ResponseWriter, message string)
- func WriteInternalError(w http.ResponseWriter, message string)
- func WriteJSON(w http.ResponseWriter, status int, data any)
- func WriteNotFound(w http.ResponseWriter, message string)
- func WriteStructuredBadRequest(w http.ResponseWriter, r *http.Request, message string)
- func WriteStructuredConflict(w http.ResponseWriter, r *http.Request, message string)
- func WriteStructuredError(w http.ResponseWriter, r *http.Request, err *apierrors.APIError)
- func WriteStructuredForbidden(w http.ResponseWriter, r *http.Request, message string)
- func WriteStructuredInternalError(w http.ResponseWriter, r *http.Request, message string)
- func WriteStructuredNotFound(w http.ResponseWriter, r *http.Request, message string)
- func WriteStructuredUnauthorized(w http.ResponseWriter, r *http.Request, message string)
- func WriteStructuredValidationError(w http.ResponseWriter, r *http.Request, fields apierrors.ValidationErrors)
- func WriteUnauthorized(w http.ResponseWriter, message string)
- type APIError
- type AcceptInvitationRequest
- type AddEnvVarRequest
- type AppHandler
- func (h *AppHandler) Create(w http.ResponseWriter, r *http.Request)
- func (h *AppHandler) Delete(w http.ResponseWriter, r *http.Request)
- func (h *AppHandler) Get(w http.ResponseWriter, r *http.Request)
- func (h *AppHandler) List(w http.ResponseWriter, r *http.Request)
- func (h *AppHandler) Update(w http.ResponseWriter, r *http.Request)
- type ArchiveDeploymentsResponse
- type AuthHandler
- func (h *AuthHandler) CanRegister(w http.ResponseWriter, r *http.Request)
- func (h *AuthHandler) DeviceAuthApprove(w http.ResponseWriter, r *http.Request)
- func (h *AuthHandler) DeviceAuthPoll(w http.ResponseWriter, r *http.Request)
- func (h *AuthHandler) DeviceAuthStart(w http.ResponseWriter, r *http.Request)
- func (h *AuthHandler) Login(w http.ResponseWriter, r *http.Request)
- func (h *AuthHandler) Register(w http.ResponseWriter, r *http.Request)
- func (h *AuthHandler) SetupCheck(w http.ResponseWriter, r *http.Request)
- type BuildHandler
- type CleanupAtticResponse
- type CleanupContainersResponse
- type CleanupHandler
- func (h *CleanupHandler) ArchiveDeployments(w http.ResponseWriter, r *http.Request)
- func (h *CleanupHandler) CleanupAttic(w http.ResponseWriter, r *http.Request)
- func (h *CleanupHandler) CleanupContainers(w http.ResponseWriter, r *http.Request)
- func (h *CleanupHandler) CleanupImages(w http.ResponseWriter, r *http.Request)
- func (h *CleanupHandler) NixGC(w http.ResponseWriter, r *http.Request)
- type CleanupImagesResponse
- type CleanupJobResponse
- type ConfigHandler
- type CreateAppRequest
- type CreateDeploymentRequest
- type CreateDomainRequest
- type CreateInvitationRequest
- type CreateOrgRequest
- type CreateSecretRequest
- type CreateServiceRequest
- type DashboardStats
- type DatabaseTypeDef
- type DefaultsResponse
- type DeploymentHandler
- func (h *DeploymentHandler) Create(w http.ResponseWriter, r *http.Request)
- func (h *DeploymentHandler) CreateForService(w http.ResponseWriter, r *http.Request)
- func (h *DeploymentHandler) Get(w http.ResponseWriter, r *http.Request)
- func (h *DeploymentHandler) List(w http.ResponseWriter, r *http.Request)
- func (h *DeploymentHandler) ListAll(w http.ResponseWriter, r *http.Request)
- func (h *DeploymentHandler) Rollback(w http.ResponseWriter, r *http.Request)
- type DetectErrorResponse
- type DetectHandler
- type DetectRequest
- type DetectResponse
- type DetectionSummary
- type DiskUsageSummary
- type DocsHandler
- type DomainHandler
- func (h *DomainHandler) Create(w http.ResponseWriter, r *http.Request)
- func (h *DomainHandler) CreateGlobal(w http.ResponseWriter, r *http.Request)
- func (h *DomainHandler) Delete(w http.ResponseWriter, r *http.Request)
- func (h *DomainHandler) DeleteGlobal(w http.ResponseWriter, r *http.Request)
- func (h *DomainHandler) List(w http.ResponseWriter, r *http.Request)
- func (h *DomainHandler) ListAll(w http.ResponseWriter, r *http.Request)
- type EnvVarResponse
- type EstimatedResources
- type GitHubHandler
- func (h *GitHubHandler) AppInstall(w http.ResponseWriter, r *http.Request)
- func (h *GitHubHandler) GetConfig(w http.ResponseWriter, r *http.Request)
- func (h *GitHubHandler) ListInstallations(w http.ResponseWriter, r *http.Request)
- func (h *GitHubHandler) ListRepos(w http.ResponseWriter, r *http.Request)
- func (h *GitHubHandler) ManifestCallback(w http.ResponseWriter, r *http.Request)
- func (h *GitHubHandler) ManifestStart(w http.ResponseWriter, r *http.Request)
- func (h *GitHubHandler) OAuthCallback(w http.ResponseWriter, r *http.Request)
- func (h *GitHubHandler) OAuthStart(w http.ResponseWriter, r *http.Request)
- func (h *GitHubHandler) PostInstallation(w http.ResponseWriter, r *http.Request)
- func (h *GitHubHandler) ResetConfig(w http.ResponseWriter, r *http.Request)
- func (h *GitHubHandler) SaveConfigManual(w http.ResponseWriter, r *http.Request)
- func (h *GitHubHandler) Webhook(w http.ResponseWriter, r *http.Request)
- type HeartbeatRequest
- type InvitationsHandler
- func (h *InvitationsHandler) Accept(w http.ResponseWriter, r *http.Request)
- func (h *InvitationsHandler) Create(w http.ResponseWriter, r *http.Request)
- func (h *InvitationsHandler) GetByToken(w http.ResponseWriter, r *http.Request)
- func (h *InvitationsHandler) List(w http.ResponseWriter, r *http.Request)
- func (h *InvitationsHandler) Revoke(w http.ResponseWriter, r *http.Request)
- type LogHandler
- type LogStreamHandler
- type NixGCResponse
- type NodeDetailsResponse
- type NodeHandler
- func (h *NodeHandler) Get(w http.ResponseWriter, r *http.Request, nodeID string)
- func (h *NodeHandler) GetDetails(w http.ResponseWriter, r *http.Request, nodeID string)
- func (h *NodeHandler) Heartbeat(w http.ResponseWriter, r *http.Request)
- func (h *NodeHandler) HeartbeatByID(w http.ResponseWriter, r *http.Request, nodeID string)
- func (h *NodeHandler) List(w http.ResponseWriter, r *http.Request)
- func (h *NodeHandler) Register(w http.ResponseWriter, r *http.Request)
- type NodeHealthSummary
- type NodeInfo
- type OrgHandler
- func (h *OrgHandler) Create(w http.ResponseWriter, r *http.Request)
- func (h *OrgHandler) Delete(w http.ResponseWriter, r *http.Request)
- func (h *OrgHandler) Get(w http.ResponseWriter, r *http.Request)
- func (h *OrgHandler) GetBySlug(w http.ResponseWriter, r *http.Request)
- func (h *OrgHandler) List(w http.ResponseWriter, r *http.Request)
- func (h *OrgHandler) Update(w http.ResponseWriter, r *http.Request)
- type PlatformConfig
- type PreviewErrorResponse
- type PreviewHandler
- type PreviewRequest
- type PreviewResponse
- type RegisterRequest
- type RenameRequest
- type ResourceSpecConfig
- type SecretHandler
- type SecretResponse
- type ServerLogsHandler
- func (h *ServerLogsHandler) Download(w http.ResponseWriter, r *http.Request)
- func (h *ServerLogsHandler) Restart(w http.ResponseWriter, r *http.Request)
- func (h *ServerLogsHandler) Stream(w http.ResponseWriter, r *http.Request)
- func (h *ServerLogsHandler) TerminalWS(w http.ResponseWriter, r *http.Request)
- type ServerStatsHandler
- type ServiceDeployRequest
- type ServiceDetectRequest
- type ServiceDetectResponse
- type ServiceHandler
- func (h *ServiceHandler) AddEnvVar(w http.ResponseWriter, r *http.Request)
- func (h *ServiceHandler) Create(w http.ResponseWriter, r *http.Request)
- func (h *ServiceHandler) Delete(w http.ResponseWriter, r *http.Request)
- func (h *ServiceHandler) DeleteEnvVar(w http.ResponseWriter, r *http.Request)
- func (h *ServiceHandler) DetectForService(w http.ResponseWriter, r *http.Request)
- func (h *ServiceHandler) Get(w http.ResponseWriter, r *http.Request)
- func (h *ServiceHandler) List(w http.ResponseWriter, r *http.Request)
- func (h *ServiceHandler) ListEnvVars(w http.ResponseWriter, r *http.Request)
- func (h *ServiceHandler) ReloadService(w http.ResponseWriter, r *http.Request)
- func (h *ServiceHandler) Rename(w http.ResponseWriter, r *http.Request)
- func (h *ServiceHandler) RetryService(w http.ResponseWriter, r *http.Request)
- func (h *ServiceHandler) StartService(w http.ResponseWriter, r *http.Request)
- func (h *ServiceHandler) StopService(w http.ResponseWriter, r *http.Request)
- func (h *ServiceHandler) TerminalWS(w http.ResponseWriter, r *http.Request)
- func (h *ServiceHandler) Update(w http.ResponseWriter, r *http.Request)
- func (h *ServiceHandler) UpdateEnvVar(w http.ResponseWriter, r *http.Request)
- type ServiceResponse
- type SettingsHandler
- type StatsHandler
- type StatusMapping
- type SystemStats
- type UpdateAppRequest
- type UpdateEnvVarRequest
- type UpdateOrgRequest
- type UpdateProfileRequest
- type UpdateServiceRequest
- type UpdatesHandler
- type UserHandler
- type UsersHandler
Constants ¶
const ( SettingServerDomain = "server_domain" SettingDefaultResourceCPU = "default_resource_cpu" SettingDefaultResourceMemory = "default_resource_memory" SettingMaxServicesPerApp = "max_services_per_app" )
Settings keys for configuration values.
const ( DefaultDomain = "localhost" DefaultResourceCPU = "0.5" DefaultResourceMemory = "512Mi" DefaultMaxServicesPerApp = 50 )
Default values for configuration.
const ( ErrCodeInvalidRequest = "invalid_request" ErrCodeNotFound = "not_found" ErrCodeConflict = "conflict" ErrCodeForbidden = "forbidden" ErrCodeInternalError = "internal_error" )
Common error codes. Deprecated: Use constants from internal/api/errors package instead.
const DiskCriticalThreshold = 90.0
DiskCriticalThreshold is the percentage at which automatic cleanup should be triggered. **Validates: Requirements 20.3**
const DiskWarningThreshold = 80.0
DiskWarningThreshold is the percentage at which a warning is logged. **Validates: Requirements 20.2**
Variables ¶
This section is empty.
Functions ¶
func CopyOpenAPISpecToDocsDir ¶
func CopyOpenAPISpecToDocsDir() error
CopyOpenAPISpecToDocsDir copies the OpenAPI spec to the docs directory for embedding. This is typically called during build time.
func IsWildcardDomain ¶
IsWildcardDomain checks if a domain is a wildcard domain (starts with *.)
func ValidateDomain ¶
ValidateDomain validates a domain string, supporting both standard and wildcard domains. Standard domain: example.com, sub.example.com Wildcard domain: *.example.com
func WriteBadRequest ¶
func WriteBadRequest(w http.ResponseWriter, message string)
WriteBadRequest writes a 400 Bad Request response.
func WriteConflict ¶
func WriteConflict(w http.ResponseWriter, message string)
WriteConflict writes a 409 Conflict response.
func WriteError ¶
func WriteError(w http.ResponseWriter, status int, code, message string)
WriteError writes an error response.
func WriteErrorWithDetails ¶
func WriteErrorWithDetails(w http.ResponseWriter, status int, code, message string, details any)
WriteErrorWithDetails writes an error response with additional details.
func WriteForbidden ¶
func WriteForbidden(w http.ResponseWriter, message string)
WriteForbidden writes a 403 Forbidden response.
func WriteInternalError ¶
func WriteInternalError(w http.ResponseWriter, message string)
WriteInternalError writes a 500 Internal Server Error response.
func WriteJSON ¶
func WriteJSON(w http.ResponseWriter, status int, data any)
WriteJSON writes a JSON response with the given status code.
func WriteNotFound ¶
func WriteNotFound(w http.ResponseWriter, message string)
WriteNotFound writes a 404 Not Found response.
func WriteStructuredBadRequest ¶
func WriteStructuredBadRequest(w http.ResponseWriter, r *http.Request, message string)
WriteStructuredBadRequest writes a structured 400 Bad Request response.
func WriteStructuredConflict ¶
func WriteStructuredConflict(w http.ResponseWriter, r *http.Request, message string)
WriteStructuredConflict writes a structured 409 Conflict response.
func WriteStructuredError ¶
WriteStructuredError writes a structured API error response with request ID. This is the preferred method for writing error responses as it includes the request ID for correlation.
func WriteStructuredForbidden ¶
func WriteStructuredForbidden(w http.ResponseWriter, r *http.Request, message string)
WriteStructuredForbidden writes a structured 403 Forbidden response.
func WriteStructuredInternalError ¶
func WriteStructuredInternalError(w http.ResponseWriter, r *http.Request, message string)
WriteStructuredInternalError writes a structured 500 Internal Server Error response.
func WriteStructuredNotFound ¶
func WriteStructuredNotFound(w http.ResponseWriter, r *http.Request, message string)
WriteStructuredNotFound writes a structured 404 Not Found response.
func WriteStructuredUnauthorized ¶
func WriteStructuredUnauthorized(w http.ResponseWriter, r *http.Request, message string)
WriteStructuredUnauthorized writes a structured 401 Unauthorized response.
func WriteStructuredValidationError ¶
func WriteStructuredValidationError(w http.ResponseWriter, r *http.Request, fields apierrors.ValidationErrors)
WriteStructuredValidationError writes a validation error with field-level details.
func WriteUnauthorized ¶
func WriteUnauthorized(w http.ResponseWriter, message string)
WriteUnauthorized writes a 401 Unauthorized response.
Types ¶
type APIError ¶
type APIError struct {
Code string `json:"code"`
Message string `json:"message"`
Details any `json:"details,omitempty"`
}
APIError represents a standard API error response. Deprecated: Use apierrors.APIError from internal/api/errors package instead.
type AcceptInvitationRequest ¶
type AcceptInvitationRequest struct {
Token string `json:"token"`
Password string `json:"password"`
}
AcceptInvitationRequest represents the request body for accepting an invitation.
type AddEnvVarRequest ¶
AddEnvVarRequest represents the request body for adding an environment variable.
type AppHandler ¶
type AppHandler struct {
// contains filtered or unexported fields
}
AppHandler handles application-related HTTP requests.
func NewAppHandler ¶
func NewAppHandler(st store.Store, logger *slog.Logger) *AppHandler
NewAppHandler creates a new app handler.
func (*AppHandler) Create ¶
func (h *AppHandler) Create(w http.ResponseWriter, r *http.Request)
Create handles POST /v1/apps - creates a new application. Requirements: 5.1, 5.3 - Sets org_id from context, assigns default org if not specified.
func (*AppHandler) Delete ¶
func (h *AppHandler) Delete(w http.ResponseWriter, r *http.Request)
Delete handles DELETE /v1/apps/:appID - soft-deletes an application. Requirements: 11.1, 11.2, 11.3, 11.4 - Safe deletion with deployment cleanup.
func (*AppHandler) Get ¶
func (h *AppHandler) Get(w http.ResponseWriter, r *http.Request)
Get handles GET /v1/apps/:appID - retrieves a specific application. Requirements: 4.1 - Verify user owns app or is org member.
func (*AppHandler) List ¶
func (h *AppHandler) List(w http.ResponseWriter, r *http.Request)
List handles GET /v1/apps - lists all applications for the current organization. Requirements: 5.2 - Filter apps by org_id using ListByOrg.
func (*AppHandler) Update ¶
func (h *AppHandler) Update(w http.ResponseWriter, r *http.Request)
Update handles PATCH /v1/apps/:appID - updates an application. Requirements: 8.1, 8.2, 8.3, 8.4 - Partial updates with optimistic locking.
type ArchiveDeploymentsResponse ¶
type ArchiveDeploymentsResponse struct {
JobID string `json:"job_id"`
Status string `json:"status"`
DeploymentsArchived int `json:"deployments_archived"`
BuildsArchived int `json:"builds_archived"`
LogsArchived int `json:"logs_archived"`
Errors []string `json:"errors,omitempty"`
Duration string `json:"duration"`
}
ArchiveDeploymentsResponse represents the response for deployment archival.
type AuthHandler ¶
type AuthHandler struct {
// contains filtered or unexported fields
}
AuthHandler handles authentication endpoints.
func NewAuthHandler ¶
NewAuthHandler creates a new auth handler.
func (*AuthHandler) CanRegister ¶
func (h *AuthHandler) CanRegister(w http.ResponseWriter, r *http.Request)
CanRegister returns whether public registration is allowed.
func (*AuthHandler) DeviceAuthApprove ¶
func (h *AuthHandler) DeviceAuthApprove(w http.ResponseWriter, r *http.Request)
DeviceAuthApprove approves a device auth request (called from web UI after login).
func (*AuthHandler) DeviceAuthPoll ¶
func (h *AuthHandler) DeviceAuthPoll(w http.ResponseWriter, r *http.Request)
DeviceAuthPoll polls for device authorization status (CLI calls this).
func (*AuthHandler) DeviceAuthStart ¶
func (h *AuthHandler) DeviceAuthStart(w http.ResponseWriter, r *http.Request)
DeviceAuthStart initiates device authorization flow (for CLI).
func (*AuthHandler) Login ¶
func (h *AuthHandler) Login(w http.ResponseWriter, r *http.Request)
Login handles user login.
func (*AuthHandler) Register ¶
func (h *AuthHandler) Register(w http.ResponseWriter, r *http.Request)
Register handles user registration (only allowed if no users exist or for additional users).
func (*AuthHandler) SetupCheck ¶
func (h *AuthHandler) SetupCheck(w http.ResponseWriter, r *http.Request)
SetupCheck returns whether initial setup is complete.
type BuildHandler ¶
type BuildHandler struct {
// contains filtered or unexported fields
}
BuildHandler handles build-related HTTP requests.
func NewBuildHandler ¶
NewBuildHandler creates a new build handler.
func (*BuildHandler) Get ¶
func (h *BuildHandler) Get(w http.ResponseWriter, r *http.Request)
Get handles GET /v1/builds/{buildID} - retrieves a specific build.
func (*BuildHandler) List ¶
func (h *BuildHandler) List(w http.ResponseWriter, r *http.Request)
List handles GET /v1/builds - lists all builds for the authenticated user.
func (*BuildHandler) Retry ¶
func (h *BuildHandler) Retry(w http.ResponseWriter, r *http.Request)
Retry handles POST /v1/builds/{buildID}/retry - retries a failed build.
type CleanupAtticResponse ¶
type CleanupAtticResponse struct {
JobID string `json:"job_id"`
Status string `json:"status"`
ItemsRemoved int `json:"items_removed"`
SpaceFreed int64 `json:"space_freed_bytes"`
Errors []string `json:"errors,omitempty"`
Duration string `json:"duration"`
}
CleanupAtticResponse represents the response for Attic cache cleanup.
type CleanupContainersResponse ¶
type CleanupContainersResponse struct {
JobID string `json:"job_id"`
Status string `json:"status"`
ItemsRemoved int `json:"items_removed"`
Errors []string `json:"errors,omitempty"`
Duration string `json:"duration"`
}
CleanupContainersResponse represents the response for container cleanup.
type CleanupHandler ¶
type CleanupHandler struct {
// contains filtered or unexported fields
}
CleanupHandler handles cleanup-related HTTP requests. Requirements: 19.1
func NewCleanupHandler ¶
func NewCleanupHandler(st store.Store, cleanupSvc *cleanup.Service, logger *slog.Logger) *CleanupHandler
NewCleanupHandler creates a new cleanup handler.
func (*CleanupHandler) ArchiveDeployments ¶
func (h *CleanupHandler) ArchiveDeployments(w http.ResponseWriter, r *http.Request)
ArchiveDeployments handles POST /v1/admin/cleanup/deployments - triggers immediate deployment archival. Requirements: 19.3, 19.4
func (*CleanupHandler) CleanupAttic ¶
func (h *CleanupHandler) CleanupAttic(w http.ResponseWriter, r *http.Request)
CleanupAttic handles POST /v1/admin/cleanup/attic - triggers immediate Attic cache cleanup. Requirements: 26.4, 19.4
func (*CleanupHandler) CleanupContainers ¶
func (h *CleanupHandler) CleanupContainers(w http.ResponseWriter, r *http.Request)
CleanupContainers handles POST /v1/admin/cleanup/containers - triggers immediate container cleanup. Requirements: 19.1, 19.4
func (*CleanupHandler) CleanupImages ¶
func (h *CleanupHandler) CleanupImages(w http.ResponseWriter, r *http.Request)
CleanupImages handles POST /v1/admin/cleanup/images - triggers immediate image cleanup. Requirements: 25.4, 19.4
func (*CleanupHandler) NixGC ¶
func (h *CleanupHandler) NixGC(w http.ResponseWriter, r *http.Request)
NixGC handles POST /v1/admin/cleanup/nix-gc - triggers immediate Nix garbage collection. Requirements: 19.2, 19.4
type CleanupImagesResponse ¶
type CleanupImagesResponse struct {
JobID string `json:"job_id"`
Status string `json:"status"`
ItemsRemoved int `json:"items_removed"`
Errors []string `json:"errors,omitempty"`
Duration string `json:"duration"`
}
CleanupImagesResponse represents the response for image cleanup.
type CleanupJobResponse ¶
type CleanupJobResponse struct {
JobID string `json:"job_id"`
Status string `json:"status"`
Message string `json:"message,omitempty"`
}
CleanupJobResponse represents the response for a cleanup job trigger. Requirements: 19.4
type ConfigHandler ¶
type ConfigHandler struct {
// contains filtered or unexported fields
}
ConfigHandler handles platform configuration endpoints.
func NewConfigHandler ¶
func NewConfigHandler(st store.Store, logger *slog.Logger) *ConfigHandler
NewConfigHandler creates a new config handler.
func (*ConfigHandler) GetConfig ¶
func (h *ConfigHandler) GetConfig(w http.ResponseWriter, r *http.Request)
GetConfig handles GET /v1/config - returns platform configuration. Requirements: 2.1
func (*ConfigHandler) GetDefaults ¶
func (h *ConfigHandler) GetDefaults(w http.ResponseWriter, r *http.Request)
GetDefaults handles GET /v1/config/defaults - returns current default resource values. Requirements: 30.4
type CreateAppRequest ¶
type CreateAppRequest struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
IconURL string `json:"icon_url,omitempty"`
Services []models.ServiceConfig `json:"services"`
}
CreateAppRequest represents the request body for creating an application.
func (*CreateAppRequest) Validate ¶
func (r *CreateAppRequest) Validate() error
Validate validates the create app request.
type CreateDeploymentRequest ¶
type CreateDeploymentRequest struct {
GitRef string `json:"git_ref,omitempty"` // Optional, uses service's git_ref if not specified
ServiceName string `json:"service_name,omitempty"` // Optional for app-level deploy, required for per-service deploy
}
CreateDeploymentRequest represents the request body for creating a deployment.
func (*CreateDeploymentRequest) Validate ¶
func (r *CreateDeploymentRequest) Validate() error
Validate validates the create deployment request.
type CreateDomainRequest ¶
CreateDomainRequest represents the request body for adding a domain.
func (*CreateDomainRequest) Validate ¶
func (r *CreateDomainRequest) Validate() error
Validate validates the create domain request.
type CreateInvitationRequest ¶
CreateInvitationRequest represents the request body for creating an invitation.
type CreateOrgRequest ¶
type CreateOrgRequest struct {
Name string `json:"name"`
Slug string `json:"slug"`
Description string `json:"description"`
IconURL string `json:"icon_url"`
}
CreateOrgRequest represents the request body for creating an organization.
type CreateSecretRequest ¶
CreateSecretRequest represents the request body for creating a secret.
func (*CreateSecretRequest) Validate ¶
func (r *CreateSecretRequest) Validate() error
Validate validates the create secret request.
type CreateServiceRequest ¶
type CreateServiceRequest struct {
Name string `json:"name"`
SourceType models.SourceType `json:"source_type,omitempty"`
GitRepo string `json:"git_repo,omitempty"`
GitRef string `json:"git_ref,omitempty"` // Default: "main"
FlakeOutput string `json:"flake_output,omitempty"` // Default: "packages.x86_64-linux.default"
FlakeURI string `json:"flake_uri,omitempty"`
Image string `json:"image,omitempty"`
Database *models.DatabaseConfig `json:"database,omitempty"`
// Language selection for auto-detection
// When specified, determines build strategy and build type automatically
// Valid values: "go", "Go", "rust", "Rust", "python", "Python", "node", "nodejs", "Node.js", "dockerfile", "Dockerfile"
Language string `json:"language,omitempty"`
// Build strategy configuration
BuildStrategy models.BuildStrategy `json:"build_strategy,omitempty"` // Default: "flake"
BuildConfig *models.BuildConfig `json:"build_config,omitempty"`
// Runtime
Resources *models.ResourceSpec `json:"resources,omitempty"` // CPU/memory specification
Replicas int `json:"replicas,omitempty"` // Default: 1
Ports []models.PortMapping `json:"ports,omitempty"`
HealthCheck *models.HealthCheckConfig `json:"health_check,omitempty"`
DependsOn []string `json:"depends_on,omitempty"`
EnvVars map[string]string `json:"env_vars,omitempty"`
}
CreateServiceRequest represents the request body for creating a service.
type DashboardStats ¶
type DashboardStats struct {
ActiveDeployments int `json:"active_deployments"`
TotalApps int `json:"total_apps"`
TotalServices int `json:"total_services"`
NodeHealth NodeHealthSummary `json:"node_health"`
}
DashboardStats represents the statistics returned for the dashboard. Requirements: 1.1
type DatabaseTypeDef ¶
type DatabaseTypeDef struct {
Type string `json:"type"`
Versions []string `json:"versions"`
DefaultVersion string `json:"default_version"`
}
DatabaseTypeDef defines a supported database type with its versions.
type DefaultsResponse ¶
type DefaultsResponse struct {
Resources ResourceSpecConfig `json:"resources"`
}
DefaultsResponse represents the response for the defaults endpoint. Requirements: 30.4
type DeploymentHandler ¶
type DeploymentHandler struct {
// contains filtered or unexported fields
}
DeploymentHandler handles deployment-related HTTP requests.
func NewDeploymentHandler ¶
NewDeploymentHandler creates a new deployment handler.
func (*DeploymentHandler) Create ¶
func (h *DeploymentHandler) Create(w http.ResponseWriter, r *http.Request)
Create handles POST /v1/apps/:appID/deploy - triggers a new deployment.
func (*DeploymentHandler) CreateForService ¶
func (h *DeploymentHandler) CreateForService(w http.ResponseWriter, r *http.Request)
CreateForService handles POST /v1/apps/{appID}/services/{serviceName}/deploy - deploys a specific service.
func (*DeploymentHandler) Get ¶
func (h *DeploymentHandler) Get(w http.ResponseWriter, r *http.Request)
Get handles GET /v1/deployments/:deploymentID - retrieves a specific deployment.
func (*DeploymentHandler) List ¶
func (h *DeploymentHandler) List(w http.ResponseWriter, r *http.Request)
List handles GET /v1/apps/:appID/deployments - lists deployments for an app.
func (*DeploymentHandler) ListAll ¶
func (h *DeploymentHandler) ListAll(w http.ResponseWriter, r *http.Request)
ListAll handles GET /v1/deployments - lists all deployments for the authenticated user.
func (*DeploymentHandler) Rollback ¶
func (h *DeploymentHandler) Rollback(w http.ResponseWriter, r *http.Request)
Rollback handles POST /v1/deployments/:deploymentID/rollback - rolls back to a previous deployment.
type DetectErrorResponse ¶
type DetectErrorResponse struct {
Error string `json:"error"`
Code string `json:"code"`
Suggestions []string `json:"suggestions,omitempty"`
}
DetectErrorResponse represents an error response for detection failures.
type DetectHandler ¶
type DetectHandler struct {
// contains filtered or unexported fields
}
DetectHandler handles build strategy detection HTTP requests.
func NewDetectHandler ¶
func NewDetectHandler(logger *slog.Logger) *DetectHandler
NewDetectHandler creates a new detect handler.
func NewDetectHandlerWithDetector ¶
func NewDetectHandlerWithDetector(d detector.Detector, logger *slog.Logger) *DetectHandler
NewDetectHandlerWithDetector creates a new detect handler with a custom detector.
func (*DetectHandler) CloneAndDetect ¶
func (h *DetectHandler) CloneAndDetect(ctx context.Context, gitURL, gitRef string) (*models.DetectionResult, error)
CloneAndDetect is a helper function that clones a repository and runs detection. This is useful for testing and can be called directly.
func (*DetectHandler) Detect ¶
func (h *DetectHandler) Detect(w http.ResponseWriter, r *http.Request)
Detect handles POST /v1/detect - detects build strategy for a repository.
func (*DetectHandler) DetectFromPath ¶
func (h *DetectHandler) DetectFromPath(ctx context.Context, repoPath string) (*models.DetectionResult, error)
DetectFromPath runs detection on a local path (useful for testing).
type DetectRequest ¶
type DetectRequest struct {
GitURL string `json:"git_url"`
GitRef string `json:"git_ref,omitempty"`
}
DetectRequest represents the request body for detecting build strategy.
type DetectResponse ¶
type DetectResponse struct {
Strategy models.BuildStrategy `json:"strategy"`
Framework models.Framework `json:"framework"`
Version string `json:"version,omitempty"`
SuggestedConfig map[string]interface{} `json:"suggested_config,omitempty"`
RecommendedBuildType models.BuildType `json:"recommended_build_type"`
EntryPoints []string `json:"entry_points,omitempty"`
Confidence float64 `json:"confidence"`
Warnings []string `json:"warnings,omitempty"`
DefaultBranch string `json:"default_branch,omitempty"`
}
DetectResponse represents the response for build strategy detection.
type DetectionSummary ¶
type DetectionSummary struct {
Framework models.Framework `json:"framework"`
Version string `json:"version,omitempty"`
EntryPoint string `json:"entry_point,omitempty"`
Confidence float64 `json:"confidence"`
}
DetectionSummary provides a summary of detection results.
type DiskUsageSummary ¶
type DiskUsageSummary struct {
NixStoreUsagePercent float64 `json:"nix_store_usage_percent"`
ContainerStorageUsagePercent float64 `json:"container_storage_usage_percent"`
WarningThreshold float64 `json:"warning_threshold"`
CriticalThreshold float64 `json:"critical_threshold"`
NixStoreStatus string `json:"nix_store_status"`
ContainerStorageStatus string `json:"container_storage_status"`
}
DiskUsageSummary provides a summary of disk usage across all monitored paths. **Validates: Requirements 20.4**
type DocsHandler ¶
type DocsHandler struct {
// contains filtered or unexported fields
}
DocsHandler handles API documentation endpoints.
func NewDocsHandler ¶
func NewDocsHandler(logger *slog.Logger) *DocsHandler
NewDocsHandler creates a new docs handler.
func (*DocsHandler) ServeDocsAssets ¶
func (h *DocsHandler) ServeDocsAssets() http.Handler
ServeDocsAssets serves static assets for the documentation.
func (*DocsHandler) ServeOpenAPISpec ¶
func (h *DocsHandler) ServeOpenAPISpec(w http.ResponseWriter, r *http.Request)
ServeOpenAPISpec serves the OpenAPI specification file at /api/docs/openapi.yaml.
func (*DocsHandler) ServeSwaggerUI ¶
func (h *DocsHandler) ServeSwaggerUI(w http.ResponseWriter, r *http.Request)
ServeSwaggerUI serves the Swagger UI at /api/docs.
type DomainHandler ¶
type DomainHandler struct {
// contains filtered or unexported fields
}
DomainHandler handles domain-related HTTP requests.
func NewDomainHandler ¶
func NewDomainHandler(st store.Store, logger *slog.Logger) *DomainHandler
NewDomainHandler creates a new domain handler.
func (*DomainHandler) Create ¶
func (h *DomainHandler) Create(w http.ResponseWriter, r *http.Request)
Create handles POST /v1/apps/:appID/domains - adds a custom domain.
func (*DomainHandler) CreateGlobal ¶
func (h *DomainHandler) CreateGlobal(w http.ResponseWriter, r *http.Request)
CreateGlobal handles POST /v1/domains - creates a domain with app_id in body.
func (*DomainHandler) Delete ¶
func (h *DomainHandler) Delete(w http.ResponseWriter, r *http.Request)
Delete handles DELETE /v1/apps/:appID/domains/:domainID - removes a domain.
func (*DomainHandler) DeleteGlobal ¶
func (h *DomainHandler) DeleteGlobal(w http.ResponseWriter, r *http.Request)
DeleteGlobal handles DELETE /v1/domains/:domainID - removes a domain by ID.
func (*DomainHandler) List ¶
func (h *DomainHandler) List(w http.ResponseWriter, r *http.Request)
List handles GET /v1/apps/:appID/domains - lists domains for an app.
func (*DomainHandler) ListAll ¶
func (h *DomainHandler) ListAll(w http.ResponseWriter, r *http.Request)
ListAll handles GET /v1/domains - lists all domains across all applications.
type EnvVarResponse ¶
type EnvVarResponse struct {
Key string `json:"key"`
Value string `json:"value,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
}
EnvVarResponse represents an environment variable in API responses.
type EstimatedResources ¶
type EstimatedResources struct {
// Estimated memory usage in MB
MemoryMB int `json:"memory_mb"`
// Estimated disk usage in MB
DiskMB int `json:"disk_mb"`
// Estimated CPU cores needed
CPUCores float64 `json:"cpu_cores"`
}
EstimatedResources represents estimated resource usage for a build.
type GitHubHandler ¶
type GitHubHandler struct {
// contains filtered or unexported fields
}
GitHubHandler handles GitHub-related endpoints.
func NewGitHubHandler ¶
func NewGitHubHandler(st store.Store, logger *slog.Logger) *GitHubHandler
NewGitHubHandler creates a new GitHub handler.
func (*GitHubHandler) AppInstall ¶
func (h *GitHubHandler) AppInstall(w http.ResponseWriter, r *http.Request)
AppInstall returns the URL to install the GitHub App.
func (*GitHubHandler) GetConfig ¶
func (h *GitHubHandler) GetConfig(w http.ResponseWriter, r *http.Request)
GetConfig returns the current GitHub App configuration status.
func (*GitHubHandler) ListInstallations ¶
func (h *GitHubHandler) ListInstallations(w http.ResponseWriter, r *http.Request)
ListInstallations lists all GitHub App installations for the authenticated user.
func (*GitHubHandler) ListRepos ¶
func (h *GitHubHandler) ListRepos(w http.ResponseWriter, r *http.Request)
ListRepos lists repositories for the authenticated user from both App installations and OAuth accounts.
func (*GitHubHandler) ManifestCallback ¶
func (h *GitHubHandler) ManifestCallback(w http.ResponseWriter, r *http.Request)
ManifestCallback handles the callback from GitHub App creation.
func (*GitHubHandler) ManifestStart ¶
func (h *GitHubHandler) ManifestStart(w http.ResponseWriter, r *http.Request)
ManifestStart returns the URL to start the GitHub App manifest flow.
func (*GitHubHandler) OAuthCallback ¶
func (h *GitHubHandler) OAuthCallback(w http.ResponseWriter, r *http.Request)
OAuthCallback handles the callback from GitHub's OAuth flow.
func (*GitHubHandler) OAuthStart ¶
func (h *GitHubHandler) OAuthStart(w http.ResponseWriter, r *http.Request)
OAuthStart redirects the user to GitHub's OAuth authorization page.
func (*GitHubHandler) PostInstallation ¶
func (h *GitHubHandler) PostInstallation(w http.ResponseWriter, r *http.Request)
PostInstallation handles the redirect after a user installs the GitHub App. This is called by GitHub, so we need to extract user info from the setup_action parameter.
func (*GitHubHandler) ResetConfig ¶
func (h *GitHubHandler) ResetConfig(w http.ResponseWriter, r *http.Request)
ResetConfig clears the GitHub configuration and all installations/accounts.
func (*GitHubHandler) SaveConfigManual ¶
func (h *GitHubHandler) SaveConfigManual(w http.ResponseWriter, r *http.Request)
SaveConfigManual saves the GitHub configuration manually (for OAuth).
func (*GitHubHandler) Webhook ¶ added in v0.0.10
func (h *GitHubHandler) Webhook(w http.ResponseWriter, r *http.Request)
Webhook handles GitHub webhook events.
type HeartbeatRequest ¶
type HeartbeatRequest struct {
NodeID string `json:"node_id"`
Resources *models.NodeResources `json:"resources"`
DiskMetrics *models.NodeDiskMetrics `json:"disk_metrics,omitempty"`
NodeInfo *NodeInfo `json:"node_info,omitempty"`
Timestamp int64 `json:"timestamp,omitempty"`
}
HeartbeatRequest represents the request body for a node heartbeat.
func (*HeartbeatRequest) GetDiskMetrics ¶
func (r *HeartbeatRequest) GetDiskMetrics() *models.NodeDiskMetrics
GetDiskMetrics returns disk metrics from either format. **Validates: Requirements 20.1**
func (*HeartbeatRequest) GetNodeID ¶
func (r *HeartbeatRequest) GetNodeID() string
GetNodeID returns the node ID from either format.
func (*HeartbeatRequest) GetResources ¶
func (r *HeartbeatRequest) GetResources() *models.NodeResources
GetResources returns resources from either format.
func (*HeartbeatRequest) Validate ¶
func (r *HeartbeatRequest) Validate() error
Validate validates the heartbeat request.
type InvitationsHandler ¶
type InvitationsHandler struct {
// contains filtered or unexported fields
}
InvitationsHandler handles invitation HTTP requests.
func NewInvitationsHandler ¶
func NewInvitationsHandler(st store.Store, authSvc *auth.Service, logger *slog.Logger) *InvitationsHandler
NewInvitationsHandler creates a new invitations handler.
func (*InvitationsHandler) Accept ¶
func (h *InvitationsHandler) Accept(w http.ResponseWriter, r *http.Request)
Accept handles POST /auth/invite/accept - accepts an invitation (public).
func (*InvitationsHandler) Create ¶
func (h *InvitationsHandler) Create(w http.ResponseWriter, r *http.Request)
Create handles POST /v1/invitations - creates a new invitation (admin only).
func (*InvitationsHandler) GetByToken ¶
func (h *InvitationsHandler) GetByToken(w http.ResponseWriter, r *http.Request)
GetByToken handles GET /auth/invite/{token} - gets invitation details (public).
func (*InvitationsHandler) List ¶
func (h *InvitationsHandler) List(w http.ResponseWriter, r *http.Request)
List handles GET /v1/invitations - lists all invitations (admin only).
func (*InvitationsHandler) Revoke ¶
func (h *InvitationsHandler) Revoke(w http.ResponseWriter, r *http.Request)
Revoke handles DELETE /v1/invitations/{invitationID} - revokes an invitation (admin only).
type LogHandler ¶
type LogHandler struct {
// contains filtered or unexported fields
}
LogHandler handles log-related HTTP requests.
func NewLogHandler ¶
func NewLogHandler(st store.Store, logger *slog.Logger) *LogHandler
NewLogHandler creates a new log handler.
func (*LogHandler) Get ¶
func (h *LogHandler) Get(w http.ResponseWriter, r *http.Request)
Get handles GET /v1/apps/:appID/logs - retrieves logs for the most recent deployment.
type LogStreamHandler ¶
type LogStreamHandler struct {
// contains filtered or unexported fields
}
LogStreamHandler handles real-time log streaming via Server-Sent Events.
func NewLogStreamHandler ¶
func NewLogStreamHandler(st store.Store, logger *slog.Logger) *LogStreamHandler
NewLogStreamHandler creates a new log stream handler.
func NewLogStreamHandlerWithBroker ¶
func NewLogStreamHandlerWithBroker(st store.Store, broker *logs.Broker, logger *slog.Logger) *LogStreamHandler
NewLogStreamHandlerWithBroker creates a new log stream handler with a shared broker.
func (*LogStreamHandler) Broker ¶
func (h *LogStreamHandler) Broker() *logs.Broker
Broker returns the log broker for publishing logs.
func (*LogStreamHandler) Stream ¶
func (h *LogStreamHandler) Stream(w http.ResponseWriter, r *http.Request)
Stream handles GET /v1/apps/:appID/logs/stream - streams logs in real-time via SSE. Requirements: 8.1, 8.2, 8.3, 8.4, 8.5, 8.6
type NixGCResponse ¶
type NixGCResponse struct {
JobID string `json:"job_id"`
Status string `json:"status"`
SpaceFreed int64 `json:"space_freed_bytes"`
PathsRemoved int `json:"paths_removed"`
Duration string `json:"duration"`
Error string `json:"error,omitempty"`
}
NixGCResponse represents the response for Nix garbage collection.
type NodeDetailsResponse ¶
type NodeDetailsResponse struct {
*models.Node
DiskUsageSummary *DiskUsageSummary `json:"disk_usage_summary,omitempty"`
}
NodeDetailsResponse represents the response for node details with disk stats. **Validates: Requirements 20.4**
type NodeHandler ¶
type NodeHandler struct {
// contains filtered or unexported fields
}
NodeHandler handles node-related HTTP requests.
func NewNodeHandler ¶
func NewNodeHandler(st store.Store, logger *slog.Logger) *NodeHandler
NewNodeHandler creates a new node handler.
func NewNodeHandlerWithCleanup ¶
func NewNodeHandlerWithCleanup(st store.Store, cleanupSvc *cleanup.Service, logger *slog.Logger) *NodeHandler
NewNodeHandlerWithCleanup creates a new node handler with cleanup service for automatic cleanup. **Validates: Requirements 20.3**
func (*NodeHandler) Get ¶
func (h *NodeHandler) Get(w http.ResponseWriter, r *http.Request, nodeID string)
Get handles GET /v1/nodes/{nodeID} - retrieves a specific node with disk stats. **Validates: Requirements 20.4**
func (*NodeHandler) GetDetails ¶
func (h *NodeHandler) GetDetails(w http.ResponseWriter, r *http.Request, nodeID string)
GetDetails handles GET /v1/nodes/{nodeID}/details - retrieves detailed node info with disk stats. **Validates: Requirements 20.4**
func (*NodeHandler) Heartbeat ¶
func (h *NodeHandler) Heartbeat(w http.ResponseWriter, r *http.Request)
Heartbeat handles POST /v1/nodes/heartbeat - updates node health status.
func (*NodeHandler) HeartbeatByID ¶
func (h *NodeHandler) HeartbeatByID(w http.ResponseWriter, r *http.Request, nodeID string)
HeartbeatByID handles POST /v1/nodes/{nodeID}/heartbeat - updates specific node health.
func (*NodeHandler) List ¶
func (h *NodeHandler) List(w http.ResponseWriter, r *http.Request)
List handles GET /v1/nodes - lists all registered nodes.
func (*NodeHandler) Register ¶
func (h *NodeHandler) Register(w http.ResponseWriter, r *http.Request)
Register handles POST /v1/nodes/register - registers a new node.
type NodeHealthSummary ¶
type NodeHealthSummary struct {
Total int `json:"total"`
Healthy int `json:"healthy"`
Unhealthy int `json:"unhealthy"`
}
NodeHealthSummary represents the health summary of all nodes.
type NodeInfo ¶
type NodeInfo struct {
ID string `json:"id"`
Hostname string `json:"hostname"`
Address string `json:"address"`
GRPCPort int `json:"grpc_port"`
Resources *models.NodeResources `json:"resources"`
DiskMetrics *models.NodeDiskMetrics `json:"disk_metrics,omitempty"`
CachedPaths []string `json:"cached_paths,omitempty"`
}
NodeInfo contains information about a node from registration/heartbeat.
type OrgHandler ¶
type OrgHandler struct {
// contains filtered or unexported fields
}
OrgHandler handles organization-related HTTP requests.
func NewOrgHandler ¶
func NewOrgHandler(st store.Store, logger *slog.Logger) *OrgHandler
NewOrgHandler creates a new organization handler.
func (*OrgHandler) Create ¶
func (h *OrgHandler) Create(w http.ResponseWriter, r *http.Request)
Create handles POST /v1/orgs - creates a new organization.
func (*OrgHandler) Delete ¶
func (h *OrgHandler) Delete(w http.ResponseWriter, r *http.Request)
Delete handles DELETE /v1/orgs/{orgID} - deletes an organization.
func (*OrgHandler) Get ¶
func (h *OrgHandler) Get(w http.ResponseWriter, r *http.Request)
Get handles GET /v1/orgs/{orgID} - gets an organization by ID.
func (*OrgHandler) GetBySlug ¶
func (h *OrgHandler) GetBySlug(w http.ResponseWriter, r *http.Request)
GetBySlug handles GET /v1/orgs/slug/{slug} - gets an organization by slug.
func (*OrgHandler) List ¶
func (h *OrgHandler) List(w http.ResponseWriter, r *http.Request)
List handles GET /v1/orgs - lists all organizations for the current user.
func (*OrgHandler) Update ¶
func (h *OrgHandler) Update(w http.ResponseWriter, r *http.Request)
Update handles PATCH /v1/orgs/{orgID} - updates an organization.
type PlatformConfig ¶
type PlatformConfig struct {
Domain string `json:"domain"`
DefaultPorts map[string]int `json:"default_ports"`
StatusMappings map[string]StatusMapping `json:"status_mappings"`
DefaultResources ResourceSpecConfig `json:"default_resources"`
SupportedDBTypes []DatabaseTypeDef `json:"supported_db_types"`
MaxServicesPerApp int `json:"max_services_per_app"`
}
PlatformConfig represents the platform configuration returned to clients. This provides all platform-specific values so the UI doesn't need hardcoded values.
type PreviewErrorResponse ¶
type PreviewErrorResponse struct {
Error string `json:"error"`
Code string `json:"code"`
Suggestions []string `json:"suggestions,omitempty"`
}
PreviewErrorResponse represents an error response for preview failures.
type PreviewHandler ¶
type PreviewHandler struct {
// contains filtered or unexported fields
}
PreviewHandler handles build preview HTTP requests.
func NewPreviewHandler ¶
NewPreviewHandler creates a new preview handler.
func NewPreviewHandlerWithDeps ¶
func NewPreviewHandlerWithDeps(st store.Store, det detector.Detector, tmplEngine templates.TemplateEngine, logger *slog.Logger) *PreviewHandler
NewPreviewHandlerWithDeps creates a new preview handler with custom dependencies.
func (*PreviewHandler) Preview ¶
func (h *PreviewHandler) Preview(w http.ResponseWriter, r *http.Request)
Preview handles POST /v1/apps/{appID}/services/{serviceName}/preview - generates a build preview.
func (*PreviewHandler) PreviewFromDetection ¶
func (h *PreviewHandler) PreviewFromDetection(ctx context.Context, detection *models.DetectionResult, config models.BuildConfig) (*PreviewResponse, error)
PreviewFromDetection generates a preview directly from a detection result. This is useful for testing and can be called directly.
type PreviewRequest ¶
type PreviewRequest struct {
// Optional: Override build strategy (if not specified, uses service's configured strategy)
BuildStrategy *models.BuildStrategy `json:"build_strategy,omitempty"`
// Optional: Override build config
BuildConfig *models.BuildConfig `json:"build_config,omitempty"`
}
PreviewRequest represents the request body for build preview.
type PreviewResponse ¶
type PreviewResponse struct {
// Generated flake.nix content (empty for flake/dockerfile/nixpacks strategies)
GeneratedFlake string `json:"generated_flake,omitempty"`
// The build strategy that will be used
Strategy models.BuildStrategy `json:"strategy"`
// The build type that will be used
BuildType models.BuildType `json:"build_type"`
// Estimated build time in seconds
EstimatedBuildTime int `json:"estimated_build_time"`
// Estimated resource usage
EstimatedResources EstimatedResources `json:"estimated_resources"`
// Detection result if auto-detection was performed
Detection *DetectionSummary `json:"detection,omitempty"`
// Warnings about the build configuration
Warnings []string `json:"warnings,omitempty"`
// Whether the flake syntax is valid (only for generated flakes)
FlakeValid *bool `json:"flake_valid,omitempty"`
// Validation error message if flake is invalid
ValidationError string `json:"validation_error,omitempty"`
}
PreviewResponse represents the response for build preview.
type RegisterRequest ¶
type RegisterRequest struct {
NodeInfo *NodeInfo `json:"node_info"`
}
RegisterRequest represents the request body for node registration.
func (*RegisterRequest) Validate ¶
func (r *RegisterRequest) Validate() error
Validate validates the registration request.
type RenameRequest ¶
type RenameRequest struct {
NewName string `json:"new_name"`
}
RenameRequest represents the request body for renaming a service.
type ResourceSpecConfig ¶
ResourceSpecConfig defines default CPU and memory resource allocation.
type SecretHandler ¶
type SecretHandler struct {
// contains filtered or unexported fields
}
SecretHandler handles secret-related HTTP requests.
func NewSecretHandler ¶
func NewSecretHandler(st store.Store, sopsService *secrets.SOPSService, logger *slog.Logger) *SecretHandler
NewSecretHandler creates a new secret handler.
func (*SecretHandler) Create ¶
func (h *SecretHandler) Create(w http.ResponseWriter, r *http.Request)
Create handles POST /v1/apps/:appID/secrets - creates or updates a secret.
func (*SecretHandler) Delete ¶
func (h *SecretHandler) Delete(w http.ResponseWriter, r *http.Request)
Delete handles DELETE /v1/apps/:appID/secrets/:key - deletes a secret.
func (*SecretHandler) List ¶
func (h *SecretHandler) List(w http.ResponseWriter, r *http.Request)
List handles GET /v1/apps/:appID/secrets - lists secrets for an app. Returns decrypted values for display in the UI.
type SecretResponse ¶
SecretResponse represents a secret in the API response.
type ServerLogsHandler ¶
type ServerLogsHandler struct {
// contains filtered or unexported fields
}
ServerLogsHandler handles real-time server log streaming via SSE.
func NewServerLogsHandler ¶
func NewServerLogsHandler(logger *slog.Logger) *ServerLogsHandler
NewServerLogsHandler creates a new server logs handler.
func (*ServerLogsHandler) Download ¶
func (h *ServerLogsHandler) Download(w http.ResponseWriter, r *http.Request)
Download handles GET /v1/server/logs/download - downloads logs as a file.
func (*ServerLogsHandler) Restart ¶
func (h *ServerLogsHandler) Restart(w http.ResponseWriter, r *http.Request)
Restart handles POST /v1/server/restart - restarts systemd services.
func (*ServerLogsHandler) Stream ¶
func (h *ServerLogsHandler) Stream(w http.ResponseWriter, r *http.Request)
Stream handles GET /v1/server/logs/stream - streams system logs in real-time.
func (*ServerLogsHandler) TerminalWS ¶
func (h *ServerLogsHandler) TerminalWS(w http.ResponseWriter, r *http.Request)
TerminalWS handles GET /v1/server/console/ws - WebSocket terminal bridge.
type ServerStatsHandler ¶
type ServerStatsHandler struct {
// contains filtered or unexported fields
}
func NewServerStatsHandler ¶
func NewServerStatsHandler(logger *slog.Logger, version string) *ServerStatsHandler
func (*ServerStatsHandler) Get ¶
func (h *ServerStatsHandler) Get(w http.ResponseWriter, r *http.Request)
func (*ServerStatsHandler) Stream ¶
func (h *ServerStatsHandler) Stream(w http.ResponseWriter, r *http.Request)
type ServiceDeployRequest ¶
type ServiceDeployRequest struct {
GitRef string `json:"git_ref,omitempty"` // Optional, overrides service's git_ref if specified
}
ServiceDeployRequest represents the request body for deploying a specific service.
func (*ServiceDeployRequest) Validate ¶
func (r *ServiceDeployRequest) Validate() error
Validate validates the service deploy request.
type ServiceDetectRequest ¶
type ServiceDetectRequest struct {
GitURL string `json:"git_url"`
GitRef string `json:"git_ref,omitempty"`
}
ServiceDetectRequest represents the request body for detecting service configuration.
type ServiceDetectResponse ¶
type ServiceDetectResponse struct {
Strategy models.BuildStrategy `json:"strategy"`
BuildType models.BuildType `json:"build_type"`
Framework models.Framework `json:"framework"`
Version string `json:"version,omitempty"`
EntryPoint string `json:"entry_point,omitempty"`
EntryPoints []string `json:"entry_points,omitempty"`
BuildCommand string `json:"build_command,omitempty"`
StartCommand string `json:"start_command,omitempty"`
SuggestedConfig map[string]interface{} `json:"suggested_config,omitempty"`
Confidence float64 `json:"confidence"`
Warnings []string `json:"warnings,omitempty"`
}
ServiceDetectResponse represents the response for service detection. **Validates: Requirements 4.3, 4.4, 4.5**
type ServiceHandler ¶
type ServiceHandler struct {
// contains filtered or unexported fields
}
ServiceHandler handles service-related HTTP requests.
func NewServiceHandler ¶
func NewServiceHandler(st store.Store, pd *podman.Client, sopsService *secrets.SOPSService, logger *slog.Logger) *ServiceHandler
NewServiceHandler creates a new service handler.
func NewServiceHandlerWithDetector ¶
func NewServiceHandlerWithDetector(st store.Store, pd *podman.Client, det detector.Detector, sopsService *secrets.SOPSService, logger *slog.Logger) *ServiceHandler
NewServiceHandlerWithDetector creates a new service handler with a custom detector.
func (*ServiceHandler) AddEnvVar ¶
func (h *ServiceHandler) AddEnvVar(w http.ResponseWriter, r *http.Request)
AddEnvVar handles POST /v1/apps/{appID}/services/{serviceName}/env - adds an environment variable. **Validates: Requirements 1.2, 5.1, 5.2, 5.3**
func (*ServiceHandler) Create ¶
func (h *ServiceHandler) Create(w http.ResponseWriter, r *http.Request)
Create handles POST /v1/apps/{appID}/services - creates a new service.
func (*ServiceHandler) Delete ¶
func (h *ServiceHandler) Delete(w http.ResponseWriter, r *http.Request)
Delete handles DELETE /v1/apps/{appID}/services/{serviceName} - deletes a service.
func (*ServiceHandler) DeleteEnvVar ¶
func (h *ServiceHandler) DeleteEnvVar(w http.ResponseWriter, r *http.Request)
DeleteEnvVar handles DELETE /v1/apps/{appID}/services/{serviceName}/env/{key} - deletes an environment variable. **Validates: Requirements 1.4**
func (*ServiceHandler) DetectForService ¶
func (h *ServiceHandler) DetectForService(w http.ResponseWriter, r *http.Request)
DetectForService handles POST /v1/apps/{appID}/services/detect - detects service configuration from git URL. This endpoint is called when a user enters a git URL during service creation to auto-populate fields. **Validates: Requirements 4.3, 4.4, 4.5**
func (*ServiceHandler) Get ¶
func (h *ServiceHandler) Get(w http.ResponseWriter, r *http.Request)
Get handles GET /v1/apps/{appID}/services/{serviceName} - retrieves a specific service.
func (*ServiceHandler) List ¶
func (h *ServiceHandler) List(w http.ResponseWriter, r *http.Request)
List handles GET /v1/apps/{appID}/services - lists all services for an app.
func (*ServiceHandler) ListEnvVars ¶
func (h *ServiceHandler) ListEnvVars(w http.ResponseWriter, r *http.Request)
ListEnvVars handles GET /v1/apps/{appID}/services/{serviceName}/env - lists all environment variables. **Validates: Requirements 5.4**
func (*ServiceHandler) ReloadService ¶
func (h *ServiceHandler) ReloadService(w http.ResponseWriter, r *http.Request)
ReloadService handles POST /v1/apps/{appID}/services/{serviceName}/reload - restarts a service without rebuilding. **Validates: Requirements 7.8**
func (*ServiceHandler) Rename ¶
func (h *ServiceHandler) Rename(w http.ResponseWriter, r *http.Request)
Rename handles POST /v1/apps/{appID}/services/{serviceName}/rename - renames a service. **Validates: Requirements 23.1, 23.2, 23.3, 23.4, 23.5**
func (*ServiceHandler) RetryService ¶
func (h *ServiceHandler) RetryService(w http.ResponseWriter, r *http.Request)
RetryService handles POST /v1/apps/{appID}/services/{serviceName}/retry - retries a failed deployment. **Validates: Requirements 7.6**
func (*ServiceHandler) StartService ¶
func (h *ServiceHandler) StartService(w http.ResponseWriter, r *http.Request)
StartService handles POST /v1/apps/{appID}/services/{serviceName}/start - starts a stopped service. **Validates: Requirements 7.7**
func (*ServiceHandler) StopService ¶
func (h *ServiceHandler) StopService(w http.ResponseWriter, r *http.Request)
StopService handles POST /v1/apps/{appID}/services/{serviceName}/stop - stops a running service. **Validates: Requirements 7.7**
func (*ServiceHandler) TerminalWS ¶
func (h *ServiceHandler) TerminalWS(w http.ResponseWriter, r *http.Request)
TerminalWS handles GET /v1/apps/{appID}/services/{serviceName}/terminal/ws - WebSocket terminal bridge.
func (*ServiceHandler) Update ¶
func (h *ServiceHandler) Update(w http.ResponseWriter, r *http.Request)
Update handles PATCH /v1/apps/{appID}/services/{serviceName} - updates a service.
func (*ServiceHandler) UpdateEnvVar ¶
func (h *ServiceHandler) UpdateEnvVar(w http.ResponseWriter, r *http.Request)
UpdateEnvVar handles PUT /v1/apps/{appID}/services/{serviceName}/env/{key} - updates an environment variable. **Validates: Requirements 1.3, 5.1, 5.3**
type ServiceResponse ¶
type ServiceResponse struct {
models.ServiceConfig
InheritedEnvVars map[string]string `json:"inherited_env_vars,omitempty"`
}
ServiceResponse represents a service in API responses with inherited env vars.
type SettingsHandler ¶
type SettingsHandler struct {
// contains filtered or unexported fields
}
SettingsHandler handles global settings endpoints.
func NewSettingsHandler ¶
func NewSettingsHandler(st store.Store, logger *slog.Logger) *SettingsHandler
NewSettingsHandler creates a new settings handler.
func (*SettingsHandler) Get ¶
func (h *SettingsHandler) Get(w http.ResponseWriter, r *http.Request)
Get retrieves all global settings.
func (*SettingsHandler) Update ¶
func (h *SettingsHandler) Update(w http.ResponseWriter, r *http.Request)
Update updates global settings.
type StatsHandler ¶
type StatsHandler struct {
// contains filtered or unexported fields
}
StatsHandler handles dashboard statistics endpoints.
func NewStatsHandler ¶
func NewStatsHandler(st store.Store, logger *slog.Logger) *StatsHandler
NewStatsHandler creates a new stats handler.
func (*StatsHandler) GetDashboardStats ¶
func (h *StatsHandler) GetDashboardStats(w http.ResponseWriter, r *http.Request)
GetDashboardStats handles GET /v1/dashboard/stats - returns dashboard statistics. Requirements: 1.1
type StatusMapping ¶
type StatusMapping struct {
Label string `json:"label"`
Color string `json:"color"`
Icon string `json:"icon,omitempty"`
}
StatusMapping defines how a status should be displayed in the UI.
type SystemStats ¶
type UpdateAppRequest ¶
type UpdateAppRequest struct {
Name *string `json:"name,omitempty"`
Description *string `json:"description,omitempty"`
IconURL *string `json:"icon_url,omitempty"`
Version int `json:"version"` // Required for optimistic locking
}
UpdateAppRequest represents the request body for updating an application. All fields are optional - only specified fields will be updated.
func (*UpdateAppRequest) Validate ¶
func (r *UpdateAppRequest) Validate() error
Validate validates the update app request.
type UpdateEnvVarRequest ¶
type UpdateEnvVarRequest struct {
Value string `json:"value"`
}
UpdateEnvVarRequest represents the request body for updating an environment variable.
type UpdateOrgRequest ¶
type UpdateOrgRequest struct {
Name string `json:"name"`
Slug string `json:"slug"`
Description string `json:"description"`
IconURL string `json:"icon_url"`
}
UpdateOrgRequest represents the request body for updating an organization.
type UpdateProfileRequest ¶
UpdateProfileRequest represents the request body for profile updates.
type UpdateServiceRequest ¶
type UpdateServiceRequest struct {
SourceType *models.SourceType `json:"source_type,omitempty"`
GitRepo *string `json:"git_repo,omitempty"`
GitRef *string `json:"git_ref,omitempty"`
FlakeOutput *string `json:"flake_output,omitempty"`
FlakeURI *string `json:"flake_uri,omitempty"`
Image *string `json:"image,omitempty"`
Database *models.DatabaseConfig `json:"database,omitempty"`
// Build strategy updates
BuildStrategy *models.BuildStrategy `json:"build_strategy,omitempty"`
BuildConfig *models.BuildConfig `json:"build_config,omitempty"`
// Runtime updates
Resources *models.ResourceSpec `json:"resources,omitempty"` // CPU/memory specification
Replicas *int `json:"replicas,omitempty"`
Ports []models.PortMapping `json:"ports,omitempty"`
HealthCheck *models.HealthCheckConfig `json:"health_check,omitempty"`
DependsOn []string `json:"depends_on,omitempty"`
EnvVars map[string]string `json:"env_vars,omitempty"`
}
UpdateServiceRequest represents the request body for updating a service.
type UpdatesHandler ¶ added in v0.0.9
type UpdatesHandler struct {
// contains filtered or unexported fields
}
UpdatesHandler handles update-related requests.
func NewUpdatesHandler ¶ added in v0.0.9
func NewUpdatesHandler(updaterService *updater.Service, logger *slog.Logger) *UpdatesHandler
NewUpdatesHandler creates a new updates handler.
func (*UpdatesHandler) CheckForUpdates ¶ added in v0.0.9
func (h *UpdatesHandler) CheckForUpdates(w http.ResponseWriter, r *http.Request)
CheckForUpdates handles GET /v1/updates/check
func (*UpdatesHandler) TriggerUpdate ¶ added in v0.0.9
func (h *UpdatesHandler) TriggerUpdate(w http.ResponseWriter, r *http.Request)
TriggerUpdate handles POST /v1/updates/apply
type UserHandler ¶
type UserHandler struct {
// contains filtered or unexported fields
}
UserHandler handles user-related HTTP requests.
func NewUserHandler ¶
func NewUserHandler(st store.Store, logger *slog.Logger) *UserHandler
NewUserHandler creates a new user handler.
func (*UserHandler) GetProfile ¶
func (h *UserHandler) GetProfile(w http.ResponseWriter, r *http.Request)
GetProfile handles GET /v1/user/profile - returns the current user's profile.
func (*UserHandler) UpdateProfile ¶
func (h *UserHandler) UpdateProfile(w http.ResponseWriter, r *http.Request)
UpdateProfile handles PATCH /v1/user/profile - updates the current user's profile.
type UsersHandler ¶
type UsersHandler struct {
// contains filtered or unexported fields
}
UsersHandler handles user management HTTP requests.
func NewUsersHandler ¶
func NewUsersHandler(st store.Store, logger *slog.Logger) *UsersHandler
NewUsersHandler creates a new users handler.
func (*UsersHandler) Delete ¶
func (h *UsersHandler) Delete(w http.ResponseWriter, r *http.Request)
Delete handles DELETE /v1/users/{userID} - removes a user (admin only).
func (*UsersHandler) List ¶
func (h *UsersHandler) List(w http.ResponseWriter, r *http.Request)
List handles GET /v1/users - returns all users (admin only).