Documentation
¶
Index ¶
- type BuildStarter
- type ConsoleLogResponse
- type EnvironmentRoutes
- func (e *EnvironmentRoutes) CancelBuild(w http.ResponseWriter, r *http.Request)
- func (e *EnvironmentRoutes) CreateSpec(w http.ResponseWriter, r *http.Request)
- func (e *EnvironmentRoutes) DeleteRegistryConnection(w http.ResponseWriter, r *http.Request)
- func (e *EnvironmentRoutes) GetBuild(w http.ResponseWriter, r *http.Request)
- func (e *EnvironmentRoutes) GetSpec(w http.ResponseWriter, r *http.Request)
- func (e *EnvironmentRoutes) ListBuilds(w http.ResponseWriter, r *http.Request)
- func (e *EnvironmentRoutes) ListRegistryConnections(w http.ResponseWriter, r *http.Request)
- func (e *EnvironmentRoutes) ListSpecs(w http.ResponseWriter, r *http.Request)
- func (e *EnvironmentRoutes) Routes() chi.Router
- func (e *EnvironmentRoutes) SaveRegistryConnection(w http.ResponseWriter, r *http.Request)
- func (e *EnvironmentRoutes) SpawnConfig(w http.ResponseWriter, r *http.Request)
- func (e *EnvironmentRoutes) StartBuild(w http.ResponseWriter, r *http.Request)
- func (e *EnvironmentRoutes) Suggestions(w http.ResponseWriter, r *http.Request)
- type HealthResponse
- type MetricsResponse
- type PoolStatusResponse
- type ProviderDetail
- type ProviderInfo
- type ProviderRoutes
- type PruneResponse
- type SandboxRoutes
- func (s *SandboxRoutes) ChmodFile(w http.ResponseWriter, r *http.Request)
- func (s *SandboxRoutes) ConsoleLog(w http.ResponseWriter, r *http.Request)
- func (s *SandboxRoutes) Create(w http.ResponseWriter, r *http.Request)
- func (s *SandboxRoutes) DeleteFile(w http.ResponseWriter, r *http.Request)
- func (s *SandboxRoutes) Destroy(w http.ResponseWriter, r *http.Request)
- func (s *SandboxRoutes) Exec(w http.ResponseWriter, r *http.Request)
- func (s *SandboxRoutes) ExecWebSocket(w http.ResponseWriter, r *http.Request)
- func (s *SandboxRoutes) Extend(w http.ResponseWriter, r *http.Request)
- func (s *SandboxRoutes) Get(w http.ResponseWriter, r *http.Request)
- func (s *SandboxRoutes) GlobFiles(w http.ResponseWriter, r *http.Request)
- func (s *SandboxRoutes) List(w http.ResponseWriter, r *http.Request)
- func (s *SandboxRoutes) ListFiles(w http.ResponseWriter, r *http.Request)
- func (s *SandboxRoutes) MoveFile(w http.ResponseWriter, r *http.Request)
- func (s *SandboxRoutes) Prune(w http.ResponseWriter, r *http.Request)
- func (s *SandboxRoutes) ReadFile(w http.ResponseWriter, r *http.Request)
- func (s *SandboxRoutes) Routes() chi.Router
- func (s *SandboxRoutes) StatFile(w http.ResponseWriter, r *http.Request)
- func (s *SandboxRoutes) VMPoolStatus(w http.ResponseWriter, r *http.Request)
- func (s *SandboxRoutes) WriteFile(w http.ResponseWriter, r *http.Request)
- type SnapshotRoutes
- type StatusResponse
- type SystemRoutes
- type TemplateRoutes
- func (t *TemplateRoutes) Create(w http.ResponseWriter, r *http.Request)
- func (t *TemplateRoutes) Delete(w http.ResponseWriter, r *http.Request)
- func (t *TemplateRoutes) Get(w http.ResponseWriter, r *http.Request)
- func (t *TemplateRoutes) List(w http.ResponseWriter, r *http.Request)
- func (t *TemplateRoutes) Routes() chi.Router
- func (t *TemplateRoutes) Spawn(w http.ResponseWriter, r *http.Request)
- func (t *TemplateRoutes) Update(w http.ResponseWriter, r *http.Request)
- type TemplateSpawnOverrides
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BuildStarter ¶
type ConsoleLogResponse ¶
type ConsoleLogResponse struct {
Lines []string `json:"lines"`
}
ConsoleLogResponse is the response from the console log endpoint.
type EnvironmentRoutes ¶
type EnvironmentRoutes struct {
// contains filtered or unexported fields
}
func NewEnvironmentRoutes ¶
func NewEnvironmentRoutes(st store.Store, build BuildStarter) *EnvironmentRoutes
func (*EnvironmentRoutes) CancelBuild ¶
func (e *EnvironmentRoutes) CancelBuild(w http.ResponseWriter, r *http.Request)
func (*EnvironmentRoutes) CreateSpec ¶
func (e *EnvironmentRoutes) CreateSpec(w http.ResponseWriter, r *http.Request)
func (*EnvironmentRoutes) DeleteRegistryConnection ¶
func (e *EnvironmentRoutes) DeleteRegistryConnection(w http.ResponseWriter, r *http.Request)
func (*EnvironmentRoutes) GetBuild ¶
func (e *EnvironmentRoutes) GetBuild(w http.ResponseWriter, r *http.Request)
func (*EnvironmentRoutes) GetSpec ¶
func (e *EnvironmentRoutes) GetSpec(w http.ResponseWriter, r *http.Request)
func (*EnvironmentRoutes) ListBuilds ¶
func (e *EnvironmentRoutes) ListBuilds(w http.ResponseWriter, r *http.Request)
func (*EnvironmentRoutes) ListRegistryConnections ¶
func (e *EnvironmentRoutes) ListRegistryConnections(w http.ResponseWriter, r *http.Request)
func (*EnvironmentRoutes) ListSpecs ¶
func (e *EnvironmentRoutes) ListSpecs(w http.ResponseWriter, r *http.Request)
func (*EnvironmentRoutes) Routes ¶
func (e *EnvironmentRoutes) Routes() chi.Router
func (*EnvironmentRoutes) SaveRegistryConnection ¶
func (e *EnvironmentRoutes) SaveRegistryConnection(w http.ResponseWriter, r *http.Request)
func (*EnvironmentRoutes) SpawnConfig ¶
func (e *EnvironmentRoutes) SpawnConfig(w http.ResponseWriter, r *http.Request)
func (*EnvironmentRoutes) StartBuild ¶
func (e *EnvironmentRoutes) StartBuild(w http.ResponseWriter, r *http.Request)
func (*EnvironmentRoutes) Suggestions ¶
func (e *EnvironmentRoutes) Suggestions(w http.ResponseWriter, r *http.Request)
type HealthResponse ¶
type HealthResponse struct {
Status string `json:"status" example:"ok"`
Version string `json:"version" example:"1.0.0"`
Uptime string `json:"uptime" example:"2h30m15s"`
}
HealthResponse is the response from the health check endpoint.
type MetricsResponse ¶
type MetricsResponse struct {
SandboxesActive int `json:"sandboxes_active" example:"5"`
Providers int `json:"providers" example:"2"`
Goroutines int `json:"goroutines" example:"12"`
MemoryAllocMB uint64 `json:"memory_alloc_mb" example:"64"`
Uptime string `json:"uptime" example:"2h30m15s"`
}
MetricsResponse is the response from the metrics endpoint.
type PoolStatusResponse ¶
type PoolStatusResponse = orchestrator.VMPoolStatus
PoolStatusResponse is returned by the pool status endpoint.
type ProviderDetail ¶
type ProviderDetail struct {
Name string `json:"name" example:"firecracker"`
Healthy bool `json:"healthy" example:"true"`
Default bool `json:"default" example:"true"`
SandboxCount int `json:"sandbox_count" example:"3"`
Config map[string]string `json:"config"`
}
ProviderDetail is the detailed info for a provider.
type ProviderInfo ¶
type ProviderInfo struct {
Name string `json:"name" example:"firecracker"`
Healthy bool `json:"healthy" example:"true"`
Default bool `json:"default" example:"true"`
}
ProviderInfo is the summary info for a provider.
type ProviderRoutes ¶
type ProviderRoutes struct {
// contains filtered or unexported fields
}
func NewProviderRoutes ¶
func NewProviderRoutes(registry *providers.Registry, counter sandboxCounter) *ProviderRoutes
func (*ProviderRoutes) Detail ¶
func (p *ProviderRoutes) Detail(w http.ResponseWriter, r *http.Request)
Detail returns detailed information about a provider.
@Summary Get provider details
@Description Return detailed information about a specific provider
@Tags providers
@Produce json
@Param providerName path string true "Provider name"
@Success 200 {object} ProviderDetail
@Failure 404 {object} httputil.APIError
@Security ApiKeyAuth
@Router /providers/{providerName} [get]
func (*ProviderRoutes) List ¶
func (p *ProviderRoutes) List(w http.ResponseWriter, r *http.Request)
List returns all registered providers.
@Summary List providers
@Description Return all registered providers with health status
@Tags providers
@Produce json
@Success 200 {array} ProviderInfo
@Security ApiKeyAuth
@Router /providers [get]
func (*ProviderRoutes) Routes ¶
func (p *ProviderRoutes) Routes() chi.Router
func (*ProviderRoutes) Test ¶
func (p *ProviderRoutes) Test(w http.ResponseWriter, r *http.Request)
Test checks health of all providers.
@Summary Test providers
@Description Run health checks on all registered providers
@Tags providers
@Produce json
@Success 200 {object} map[string]bool
@Security ApiKeyAuth
@Router /providers/test [post]
type PruneResponse ¶
type PruneResponse struct {
Pruned int `json:"pruned" example:"3"`
}
PruneResponse is the response from pruning sandboxes.
type SandboxRoutes ¶
type SandboxRoutes struct {
// contains filtered or unexported fields
}
func NewSandboxRoutes ¶
func NewSandboxRoutes(manager *orchestrator.Manager) *SandboxRoutes
func (*SandboxRoutes) ChmodFile ¶
func (s *SandboxRoutes) ChmodFile(w http.ResponseWriter, r *http.Request)
ChmodFile changes file permissions in a sandbox.
func (*SandboxRoutes) ConsoleLog ¶
func (s *SandboxRoutes) ConsoleLog(w http.ResponseWriter, r *http.Request)
ConsoleLog retrieves console log output from a sandbox.
@Summary Get console logs
@Description Retrieve console log lines from a sandbox
@Tags sandboxes
@Produce json
@Param sandboxID path string true "Sandbox ID"
@Param lines query int false "Number of lines to retrieve (default: 100)"
@Success 200 {array} string
@Failure 404 {object} httputil.APIError
@Failure 500 {object} httputil.APIError
@Security ApiKeyAuth
@Router /sandboxes/{sandboxID}/logs [get]
func (*SandboxRoutes) Create ¶
func (s *SandboxRoutes) Create(w http.ResponseWriter, r *http.Request)
Create creates a new sandbox.
@Summary Create a sandbox
@Description Spawn a new sandbox with the given configuration
@Tags sandboxes
@Accept json
@Produce json
@Param request body orchestrator.SpawnRequest true "Spawn request"
@Success 201 {object} orchestrator.Sandbox
@Failure 400 {object} httputil.APIError
@Failure 500 {object} httputil.APIError
@Security ApiKeyAuth
@Router /sandboxes [post]
func (*SandboxRoutes) DeleteFile ¶
func (s *SandboxRoutes) DeleteFile(w http.ResponseWriter, r *http.Request)
DeleteFile deletes a file from a sandbox.
func (*SandboxRoutes) Destroy ¶
func (s *SandboxRoutes) Destroy(w http.ResponseWriter, r *http.Request)
Destroy destroys a sandbox by ID.
@Summary Destroy a sandbox
@Description Destroy a sandbox and release its resources
@Tags sandboxes
@Produce json
@Param sandboxID path string true "Sandbox ID"
@Success 200 {object} StatusResponse
@Failure 404 {object} httputil.APIError
@Failure 500 {object} httputil.APIError
@Security ApiKeyAuth
@Router /sandboxes/{sandboxID} [delete]
func (*SandboxRoutes) Exec ¶
func (s *SandboxRoutes) Exec(w http.ResponseWriter, r *http.Request)
Exec executes a command in a sandbox.
@Summary Execute a command
@Description Run a command inside a sandbox. Set stream=true for streaming output.
@Tags sandboxes
@Accept json
@Produce json
@Param sandboxID path string true "Sandbox ID"
@Param request body orchestrator.ExecRequest true "Exec request"
@Success 200 {object} orchestrator.ExecResult
@Failure 404 {object} httputil.APIError
@Failure 500 {object} httputil.APIError
@Security ApiKeyAuth
@Router /sandboxes/{sandboxID}/exec [post]
func (*SandboxRoutes) ExecWebSocket ¶
func (s *SandboxRoutes) ExecWebSocket(w http.ResponseWriter, r *http.Request)
ExecWebSocket executes a command over WebSocket.
@Summary Execute via WebSocket
@Description Open a WebSocket connection to execute a command with streaming output
@Tags sandboxes
@Param sandboxID path string true "Sandbox ID"
@Success 101 "WebSocket upgrade"
@Failure 400 "Bad request"
@Security ApiKeyAuth
@Router /sandboxes/{sandboxID}/exec/ws [get]
func (*SandboxRoutes) Extend ¶
func (s *SandboxRoutes) Extend(w http.ResponseWriter, r *http.Request)
Extend extends a sandbox's TTL.
@Summary Extend sandbox TTL
@Description Add additional time to a sandbox's expiration
@Tags sandboxes
@Accept json
@Produce json
@Param sandboxID path string true "Sandbox ID"
@Param request body object{ttl=string} true "TTL extension"
@Success 200 {object} orchestrator.Sandbox
@Failure 400 {object} httputil.APIError
@Failure 404 {object} httputil.APIError
@Failure 500 {object} httputil.APIError
@Security ApiKeyAuth
@Router /sandboxes/{sandboxID}/extend [post]
func (*SandboxRoutes) Get ¶
func (s *SandboxRoutes) Get(w http.ResponseWriter, r *http.Request)
Get returns a single sandbox by ID.
@Summary Get a sandbox
@Description Return a sandbox by its ID
@Tags sandboxes
@Produce json
@Param sandboxID path string true "Sandbox ID"
@Success 200 {object} orchestrator.Sandbox
@Failure 404 {object} httputil.APIError
@Failure 500 {object} httputil.APIError
@Security ApiKeyAuth
@Router /sandboxes/{sandboxID} [get]
func (*SandboxRoutes) GlobFiles ¶
func (s *SandboxRoutes) GlobFiles(w http.ResponseWriter, r *http.Request)
GlobFiles returns paths matching a glob pattern in a sandbox.
func (*SandboxRoutes) List ¶
func (s *SandboxRoutes) List(w http.ResponseWriter, r *http.Request)
List lists all active sandboxes.
@Summary List sandboxes
@Description Return all active sandboxes
@Tags sandboxes
@Produce json
@Success 200 {array} orchestrator.Sandbox
@Failure 500 {object} httputil.APIError
@Security ApiKeyAuth
@Router /sandboxes [get]
func (*SandboxRoutes) ListFiles ¶
func (s *SandboxRoutes) ListFiles(w http.ResponseWriter, r *http.Request)
ListFiles lists files in a sandbox directory.
@Summary List files
@Description List files in a directory inside a sandbox
@Tags sandboxes
@Produce json
@Param sandboxID path string true "Sandbox ID"
@Param path query string false "Directory path (default: /)"
@Success 200 {array} orchestrator.FileInfo
@Failure 404 {object} httputil.APIError
@Failure 500 {object} httputil.APIError
@Security ApiKeyAuth
@Router /sandboxes/{sandboxID}/files/list [get]
func (*SandboxRoutes) MoveFile ¶
func (s *SandboxRoutes) MoveFile(w http.ResponseWriter, r *http.Request)
MoveFile moves/renames a file in a sandbox.
func (*SandboxRoutes) Prune ¶
func (s *SandboxRoutes) Prune(w http.ResponseWriter, r *http.Request)
Prune destroys all expired sandboxes.
@Summary Prune sandboxes
@Description Destroy all expired sandboxes and return the count
@Tags sandboxes
@Produce json
@Success 200 {object} PruneResponse
@Failure 500 {object} httputil.APIError
@Security ApiKeyAuth
@Router /sandboxes [delete]
func (*SandboxRoutes) ReadFile ¶
func (s *SandboxRoutes) ReadFile(w http.ResponseWriter, r *http.Request)
ReadFile reads a file from a sandbox.
@Summary Read a file
@Description Read file content from a sandbox
@Tags sandboxes
@Produce octet-stream
@Param sandboxID path string true "Sandbox ID"
@Param path query string true "File path inside the sandbox"
@Success 200 {file} binary
@Failure 400 {object} httputil.APIError
@Failure 404 {object} httputil.APIError
@Failure 500 {object} httputil.APIError
@Security ApiKeyAuth
@Router /sandboxes/{sandboxID}/files [get]
func (*SandboxRoutes) Routes ¶
func (s *SandboxRoutes) Routes() chi.Router
func (*SandboxRoutes) StatFile ¶
func (s *SandboxRoutes) StatFile(w http.ResponseWriter, r *http.Request)
StatFile returns file info for a single file in a sandbox.
func (*SandboxRoutes) VMPoolStatus ¶
func (s *SandboxRoutes) VMPoolStatus(w http.ResponseWriter, r *http.Request)
VMPoolStatusHandler returns the VM pool status.
func (*SandboxRoutes) WriteFile ¶
func (s *SandboxRoutes) WriteFile(w http.ResponseWriter, r *http.Request)
WriteFile writes a file into a sandbox.
@Summary Write a file
@Description Write content to a file inside a sandbox
@Tags sandboxes
@Accept json
@Produce json
@Param sandboxID path string true "Sandbox ID"
@Param request body orchestrator.FileWriteRequest true "File write request"
@Success 200 {object} StatusResponse
@Failure 400 {object} httputil.APIError
@Failure 404 {object} httputil.APIError
@Failure 500 {object} httputil.APIError
@Security ApiKeyAuth
@Router /sandboxes/{sandboxID}/files [post]
type SnapshotRoutes ¶
type SnapshotRoutes struct {
// contains filtered or unexported fields
}
func NewSnapshotRoutes ¶
func NewSnapshotRoutes(registry *providers.Registry) *SnapshotRoutes
func (*SnapshotRoutes) List ¶
func (s *SnapshotRoutes) List(w http.ResponseWriter, r *http.Request)
List returns all available snapshots across providers.
@Summary List snapshots
@Description Return all pre-built VM snapshots available for fast restore
@Tags snapshots
@Produce json
@Success 200 {array} providers.SnapshotSummary
@Security ApiKeyAuth
@Router /snapshots [get]
func (*SnapshotRoutes) Routes ¶
func (s *SnapshotRoutes) Routes() chi.Router
type StatusResponse ¶
type StatusResponse struct {
Status string `json:"status" example:"destroyed"`
}
StatusResponse is a generic status response.
type SystemRoutes ¶
type SystemRoutes struct {
// contains filtered or unexported fields
}
func NewSystemRoutes ¶
func NewSystemRoutes(registry *providers.Registry, manager *orchestrator.Manager, events *orchestrator.EventBus, version string) *SystemRoutes
func (*SystemRoutes) Events ¶
func (s *SystemRoutes) Events(w http.ResponseWriter, r *http.Request)
Events serves Server-Sent Events for real-time updates.
@Summary Subscribe to events
@Description Open an SSE stream for real-time sandbox and system events
@Tags system
@Produce text/event-stream
@Success 200 {object} orchestrator.Event
@Security ApiKeyAuth
@Router /events [get]
func (*SystemRoutes) Health ¶
func (s *SystemRoutes) Health(w http.ResponseWriter, r *http.Request)
Health returns the health status of the server.
@Summary Health check
@Description Return the health status, version, and uptime
@Tags system
@Produce json
@Success 200 {object} HealthResponse
@Security ApiKeyAuth
@Router /health [get]
func (*SystemRoutes) Metrics ¶
func (s *SystemRoutes) Metrics(w http.ResponseWriter, r *http.Request)
Metrics returns runtime metrics.
@Summary Get metrics
@Description Return runtime metrics including sandbox count, goroutines, and memory usage
@Tags system
@Produce json
@Success 200 {object} MetricsResponse
@Security ApiKeyAuth
@Router /metrics [get]
func (*SystemRoutes) Routes ¶
func (s *SystemRoutes) Routes() chi.Router
type TemplateRoutes ¶
type TemplateRoutes struct {
// contains filtered or unexported fields
}
func NewTemplateRoutes ¶
func NewTemplateRoutes(registry *orchestrator.TemplateRegistry, manager *orchestrator.Manager) *TemplateRoutes
func (*TemplateRoutes) Create ¶
func (t *TemplateRoutes) Create(w http.ResponseWriter, r *http.Request)
Create registers a new template.
@Summary Create a template
@Description Register a new sandbox template
@Tags templates
@Accept json
@Produce json
@Param request body orchestrator.Template true "Template definition"
@Success 201 {object} orchestrator.Template
@Failure 400 {object} httputil.APIError
@Failure 409 {object} httputil.APIError
@Failure 500 {object} httputil.APIError
@Security ApiKeyAuth
@Router /templates [post]
func (*TemplateRoutes) Delete ¶
func (t *TemplateRoutes) Delete(w http.ResponseWriter, r *http.Request)
Delete removes a template.
@Summary Delete a template
@Description Delete a template by name
@Tags templates
@Produce json
@Param name path string true "Template name"
@Success 200 {object} StatusResponse
@Failure 404 {object} httputil.APIError
@Failure 500 {object} httputil.APIError
@Security ApiKeyAuth
@Router /templates/{name} [delete]
func (*TemplateRoutes) Get ¶
func (t *TemplateRoutes) Get(w http.ResponseWriter, r *http.Request)
Get returns a template by name.
@Summary Get a template
@Description Return a template by its name
@Tags templates
@Produce json
@Param name path string true "Template name"
@Success 200 {object} orchestrator.Template
@Failure 404 {object} httputil.APIError
@Failure 500 {object} httputil.APIError
@Security ApiKeyAuth
@Router /templates/{name} [get]
func (*TemplateRoutes) List ¶
func (t *TemplateRoutes) List(w http.ResponseWriter, r *http.Request)
List returns all templates.
@Summary List templates
@Description Return all registered templates
@Tags templates
@Produce json
@Success 200 {array} orchestrator.Template
@Failure 500 {object} httputil.APIError
@Security ApiKeyAuth
@Router /templates [get]
func (*TemplateRoutes) Routes ¶
func (t *TemplateRoutes) Routes() chi.Router
func (*TemplateRoutes) Spawn ¶
func (t *TemplateRoutes) Spawn(w http.ResponseWriter, r *http.Request)
Spawn creates a sandbox from a template.
@Summary Spawn from template
@Description Create a new sandbox using a template's configuration, with optional overrides
@Tags templates
@Accept json
@Produce json
@Param name path string true "Template name"
@Param request body TemplateSpawnOverrides false "Optional overrides"
@Success 201 {object} orchestrator.Sandbox
@Failure 404 {object} httputil.APIError
@Failure 500 {object} httputil.APIError
@Security ApiKeyAuth
@Router /templates/{name}/spawn [post]
func (*TemplateRoutes) Update ¶
func (t *TemplateRoutes) Update(w http.ResponseWriter, r *http.Request)
Update updates an existing template.
@Summary Update a template
@Description Update an existing template by name
@Tags templates
@Accept json
@Produce json
@Param name path string true "Template name"
@Param request body orchestrator.Template true "Updated template"
@Success 200 {object} orchestrator.Template
@Failure 400 {object} httputil.APIError
@Failure 404 {object} httputil.APIError
@Failure 500 {object} httputil.APIError
@Security ApiKeyAuth
@Router /templates/{name} [put]
type TemplateSpawnOverrides ¶
type TemplateSpawnOverrides struct {
Provider string `json:"provider,omitempty" example:"firecracker"`
TTL string `json:"ttl,omitempty" example:"30m"`
}
TemplateSpawnOverrides are optional overrides when spawning from a template.