apiv1

package
v0.0.0-...-0186d81 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: AGPL-3.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HttpServerBaseRoute string = "/api/v1"
	HttpServerRootRoute string = ""
)
View Source
const (
	SandboxStatusPending  = string(types.ContainerStatusPending)  // "PENDING"
	SandboxStatusRunning  = string(types.ContainerStatusRunning)  // "RUNNING"
	SandboxStatusStopping = string(types.ContainerStatusStopping) // "STOPPING"
	SandboxStatusStopped  = "STOPPED"
	SandboxStatusFailed   = "FAILED"
)

Sandbox status values surfaced to the dashboard. The live states reuse the canonical container status enum (types.ContainerStatus) so the dashboard filters line up with actual container states; the terminal states cover sandboxes that no longer have an active container.

View Source
const DatabaseCreateTimeout = 10 * time.Minute

Variables

View Source
var (
	DefaultTaskOutputExpirationS  uint32 = 3600
	DefaultTaskSubscribeIntervalS uint32 = 1
)

Functions

func DrainOnShutdown

func DrainOnShutdown(drain context.Context) echo.MiddlewareFunc

DrainOnShutdown disconnects resumable subscriptions when a gateway drains. Ordinary API calls and application requests retain their graceful shutdown budget; idle observers should reconnect to a serving replica immediately.

func HTTPBadRequest

func HTTPBadRequest(message string) error

func HTTPClientClosedRequest

func HTTPClientClosedRequest(ctx echo.Context) error

func HTTPConflict

func HTTPConflict(message string) error

func HTTPForbidden

func HTTPForbidden(message string) error

func HTTPInternalServerError

func HTTPInternalServerError(message string) error

func HTTPNotFound

func HTTPNotFound() error

func HTTPUnauthorized

func HTTPUnauthorized(message string) error

func IsRequestCanceled

func IsRequestCanceled(ctx echo.Context, err error) bool

func NewHTTPError

func NewHTTPError(code int, message string) error

func RedactWebhook

RedactWebhook returns a copy without its signing secret.

func SetConfigField

func SetConfigField(config *types.StubConfigV1, fieldPath string, value interface{}) error

SetConfigField sets a dotted path such as runtime.cpu or autoscaler.max_containers.

func ValidateWebhookURL

func ValidateWebhookURL(ctx context.Context, raw string) error

ValidateWebhookURL requires an absolute HTTP(S) URL resolving only to public IPs.

Types

type AppGroup

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

func NewAppGroup

func NewAppGroup(g *echo.Group, backendRepo repository.BackendRepository, config types.AppConfig, containerRepo repository.ContainerRepository, scheduler scheduler.Scheduler, redisClient *common.RedisClient) *AppGroup

func (*AppGroup) DeleteApp

func (a *AppGroup) DeleteApp(ctx echo.Context) error

func (*AppGroup) GetAppActivity

func (a *AppGroup) GetAppActivity(ctx echo.Context) error

GetAppActivity returns the last 24h of hourly activity for a set of apps in one call: tasks created (and failed) from Postgres, sandboxes created from the Redis counters bumped at creation. Every app gets a full, zero-filled series so the client never has to align buckets itself.

func (*AppGroup) ListAppWithLatestActivity

func (a *AppGroup) ListAppWithLatestActivity(ctx echo.Context) error

func (*AppGroup) ListApps

func (a *AppGroup) ListApps(ctx echo.Context) error

func (*AppGroup) RetrieveApp

func (a *AppGroup) RetrieveApp(ctx echo.Context) error

type AppListResponse

type AppListResponse struct {
	repoCommon.CursorPaginationInfo[AppWithLatestStubOrDeployment]
	StateCounts types.AppStateCounts `json:"state_counts" serializer:"state_counts"`
}

AppListResponse is a page of apps plus workspace-wide state counts, so the dashboard's Running / Idle / Stopped tabs describe the whole workspace and not just the page that happens to be loaded.

type AppWithLatestStubOrDeployment

type AppWithLatestStubOrDeployment struct {
	types.App
	Stub          *types.StubWithRelated       `json:"stub,omitempty" serializer:"stub"`
	Deployment    *types.DeploymentWithRelated `json:"deployment,omitempty" serializer:"deployment"`
	URL           string                       `json:"url,omitempty" serializer:"url,omitempty"`
	InvokeURL     string                       `json:"invoke_url,omitempty" serializer:"invoke_url,omitempty"`
	ConnectionURL string                       `json:"connection_url,omitempty" serializer:"connection_url,omitempty"`
	PoolName      string                       `json:"pool_name" serializer:"pool_name"`
	// RunningContainers counts running containers across every stub in the
	// app, not just the latest one, so multi-function and multi-config apps
	// read as live whenever any of them is doing work.
	RunningContainers int `json:"running_containers" serializer:"running_containers"`
	// ActiveDeployments counts deployments in the app that are currently
	// active (deployed and not stopped), across all of its functions.
	ActiveDeployments int `json:"active_deployments" serializer:"active_deployments"`
	// State is derived from the two counts above: running > idle > stopped.
	// Only the list endpoint knows running containers, so only it sets this.
	State     types.AppState       `json:"state,omitempty" serializer:"state,omitempty"`
	IsService bool                 `json:"is_service" serializer:"is_service"`
	Serving   *types.ServingConfig `json:"serving,omitempty" serializer:"serving"`
}

type ClipAccessMetric

type ClipAccessMetric struct {
	Operation        string `json:"operation,omitempty"`
	Path             string `json:"path,omitempty"`
	Source           string `json:"source,omitempty"`
	LayerDigest      string `json:"layer_digest,omitempty"`
	DecompressedHash string `json:"decompressed_hash,omitempty"`
	ContentHash      string `json:"content_hash,omitempty"`
	Count            int    `json:"count"`
	TotalUs          int64  `json:"total_us,omitempty"`
	MaxUs            int64  `json:"max_us,omitempty"`
	TotalMs          int64  `json:"total_ms"`
	MaxMs            int64  `json:"max_ms"`
	BytesRead        int64  `json:"bytes_read"`
}

type ClusterAdminTokensRequestSerializer

type ClusterAdminTokensRequestSerializer struct {
	Disabled bool `json:"disabled"`
}

type CommonClients

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

type ConcurrencyLimitGroup

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

func NewConcurrencyLimitGroup

func NewConcurrencyLimitGroup(
	g *echo.Group,
	backendRepo repository.BackendRepository,
	workspaceRepo repository.WorkspaceRepository,
) *ConcurrencyLimitGroup

func (*ConcurrencyLimitGroup) CreateConcurrencyLimit

func (c *ConcurrencyLimitGroup) CreateConcurrencyLimit(ctx echo.Context) error

func (*ConcurrencyLimitGroup) DeleteConcurrencyLimit

func (c *ConcurrencyLimitGroup) DeleteConcurrencyLimit(ctx echo.Context) error

func (*ConcurrencyLimitGroup) GetConcurrencyLimitByWorkspaceId

func (c *ConcurrencyLimitGroup) GetConcurrencyLimitByWorkspaceId(ctx echo.Context) error

func (*ConcurrencyLimitGroup) ListConcurrencyLimitsByWorkspaceId

func (c *ConcurrencyLimitGroup) ListConcurrencyLimitsByWorkspaceId(ctx echo.Context) error

func (*ConcurrencyLimitGroup) RevertConcurrencyLimit

func (c *ConcurrencyLimitGroup) RevertConcurrencyLimit(ctx echo.Context) error

type ContainerEventSummary

type ContainerEventSummary struct {
	ContainerID      string                       `json:"container_id"`
	WorkspaceID      string                       `json:"workspace_id,omitempty"`
	StubID           string                       `json:"stub_id,omitempty"`
	TaskID           string                       `json:"task_id,omitempty"`
	Status           string                       `json:"status,omitempty"`
	StopReason       string                       `json:"stop_reason,omitempty"`
	RootCauseEvent   string                       `json:"root_cause_event,omitempty"`
	EventCount       int                          `json:"event_count"`
	Summary          map[string]int64             `json:"summary"`
	Stages           []ContainerStageSummary      `json:"stages,omitempty"`
	Lifecycle        []ContainerLifecycleMetric   `json:"lifecycle,omitempty"`
	SlowestLifecycle []ContainerLifecycleMetric   `json:"slowest_lifecycle,omitempty"`
	ClipAccesses     []ClipAccessMetric           `json:"clip_accesses,omitempty"`
	Missing          []string                     `json:"missing,omitempty"`
	Streams          []string                     `json:"streams,omitempty"`
	CanonicalStream  string                       `json:"canonical_stream,omitempty"`
	Events           []types.ContainerEventRecord `json:"events,omitempty"`
	Error            string                       `json:"error,omitempty"`
}

type ContainerEventsBatchRequest

type ContainerEventsBatchRequest struct {
	ContainerIDs         []string                     `json:"container_ids"`
	TaskIDs              []string                     `json:"task_ids"`
	Targets              []ContainerEventsBatchTarget `json:"targets,omitempty"`
	Limit                uint64                       `json:"limit,omitempty"`
	EventTypes           []string                     `json:"event_types,omitempty"`
	IncludeEvents        bool                         `json:"include_events,omitempty"`
	TopLifecycle         int                          `json:"top_lifecycle,omitempty"`
	RequiredLifecycleIDs []string                     `json:"required_lifecycle_ids,omitempty"`
	RequiredMetrics      []string                     `json:"required_metrics,omitempty"`
}

type ContainerEventsBatchResponse

type ContainerEventsBatchResponse struct {
	Count             int                               `json:"count"`
	Items             []ContainerEventSummary           `json:"items"`
	Summary           map[string]ContainerMetricSummary `json:"summary"`
	Coverage          ContainerEventsCoverage           `json:"coverage"`
	Stages            []ContainerPhaseSummary           `json:"stages"`
	Phases            []ContainerPhaseSummary           `json:"phases"`
	TopBottlenecks    []ContainerPhaseSummary           `json:"top_bottlenecks"`
	PrimaryBottleneck *ContainerPhaseSummary            `json:"primary_bottleneck,omitempty"`
}

type ContainerEventsBatchTarget

type ContainerEventsBatchTarget struct {
	ContainerID string `json:"container_id,omitempty"`
	TaskID      string `json:"task_id,omitempty"`
	StubID      string `json:"stub_id,omitempty"`
}

type ContainerEventsCoverage

type ContainerEventsCoverage struct {
	RequestedContainers      int            `json:"requested_containers"`
	Items                    int            `json:"items"`
	ContainersWithEvents     int            `json:"containers_with_events"`
	EventErrors              int            `json:"event_errors"`
	MissingContainers        []string       `json:"missing_containers,omitempty"`
	RequiredLifecyclePresent int            `json:"required_lifecycle_present"`
	RequiredLifecycleTotal   int            `json:"required_lifecycle_total"`
	RequiredLifecycleMissing map[string]int `json:"required_lifecycle_missing"`
	RequiredMetricPresent    int            `json:"required_metric_present"`
	RequiredMetricTotal      int            `json:"required_metric_total"`
	RequiredMetricMissing    map[string]int `json:"required_metric_missing"`
}

type ContainerGroup

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

func NewContainerGroup

func NewContainerGroup(
	g *echo.Group,
	backendRepo repository.BackendRepository,
	containerRepo repository.ContainerRepository,
	scheduler scheduler.Scheduler,
	config types.AppConfig,
) *ContainerGroup

func (*ContainerGroup) GetContainer

func (c *ContainerGroup) GetContainer(ctx echo.Context) error

func (*ContainerGroup) GetContainerAsAdmin

func (c *ContainerGroup) GetContainerAsAdmin(ctx echo.Context) error

func (*ContainerGroup) ListContainersByWorkspaceId

func (c *ContainerGroup) ListContainersByWorkspaceId(ctx echo.Context) error

func (*ContainerGroup) StopAllWorkspaceContainers

func (c *ContainerGroup) StopAllWorkspaceContainers(ctx echo.Context) error

func (*ContainerGroup) StopContainer

func (c *ContainerGroup) StopContainer(ctx echo.Context) error

type ContainerLifecycleMetric

type ContainerLifecycleMetric struct {
	EventID    string            `json:"event_id"`
	Domain     string            `json:"domain,omitempty"`
	ParentID   string            `json:"parent_id,omitempty"`
	DurationMs int64             `json:"duration_ms"`
	StartTime  time.Time         `json:"start_time,omitempty"`
	EndTime    time.Time         `json:"end_time,omitempty"`
	Success    *bool             `json:"success,omitempty"`
	Attrs      map[string]string `json:"attrs,omitempty"`
}

type ContainerMetricSummary

type ContainerMetricSummary struct {
	Count int     `json:"count"`
	Min   int64   `json:"min_ms"`
	Avg   float64 `json:"avg_ms"`
	P50   float64 `json:"p50_ms"`
	P90   float64 `json:"p90_ms"`
	P95   float64 `json:"p95_ms"`
	P99   float64 `json:"p99_ms"`
	Max   int64   `json:"max_ms"`
	Total int64   `json:"total_ms"`
}

type ContainerPhaseSummary

type ContainerPhaseSummary struct {
	MetricKey      string  `json:"metric_key"`
	EventID        string  `json:"event_id"`
	Label          string  `json:"label,omitempty"`
	Domain         string  `json:"domain,omitempty"`
	ParentID       string  `json:"parent_id,omitempty"`
	Count          int     `json:"count"`
	Coverage       float64 `json:"coverage"`
	CoverageStatus string  `json:"coverage_status"`
	Rollup         bool    `json:"rollup,omitempty"`
	Min            int64   `json:"min_ms"`
	Avg            float64 `json:"avg_ms"`
	P50            float64 `json:"p50_ms"`
	P90            float64 `json:"p90_ms"`
	P95            float64 `json:"p95_ms"`
	P99            float64 `json:"p99_ms"`
	Max            int64   `json:"max_ms"`
	Total          int64   `json:"total_ms"`
}

type ContainerStageSummary

type ContainerStageSummary struct {
	ID          string `json:"id"`
	Label       string `json:"label"`
	MetricKey   string `json:"metric_key"`
	DurationMs  int64  `json:"duration_ms"`
	Description string `json:"description,omitempty"`
}

type ContainerStateWithAppId

type ContainerStateWithAppId struct {
	types.ContainerState
	AppId string `json:"app_id"`
}

type CreateWorkspaceRequest

type CreateWorkspaceRequest struct{}

type CreateWorkspaceStorageRequest

type CreateWorkspaceStorageRequest struct {
	BucketName  string `json:"bucket_name" validate:"required"`
	AccessKey   string `json:"access_key" validate:"required"`
	SecretKey   string `json:"secret_key" validate:"required"`
	EndpointUrl string `json:"endpoint_url" validate:"required"`
	Region      string `json:"region" validate:"required"`
}

type DatabaseGroup

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

func NewDatabaseGroup

func NewDatabaseGroup(g *echo.Group, gws DatabaseManager) *DatabaseGroup

func (*DatabaseGroup) Create

func (g *DatabaseGroup) Create(ctx echo.Context) error

func (*DatabaseGroup) Delete

func (g *DatabaseGroup) Delete(ctx echo.Context) error

func (*DatabaseGroup) List

func (g *DatabaseGroup) List(ctx echo.Context) error

func (*DatabaseGroup) Readiness

func (g *DatabaseGroup) Readiness(ctx echo.Context) error

func (*DatabaseGroup) Rotate

func (g *DatabaseGroup) Rotate(ctx echo.Context) error

type DatabaseManager

type DatabaseManager interface {
	CreateDatabaseService(ctx context.Context, authInfo *auth.AuthInfo, params types.CreateDatabaseParams) (*types.DatabaseServiceInfo, error)
	RotateDatabaseCredentials(ctx context.Context, authInfo *auth.AuthInfo, name string) (*types.DatabaseServiceInfo, error)
	DeleteDatabaseService(ctx context.Context, authInfo *auth.AuthInfo, name string) error
	ListDatabaseServices(ctx context.Context, authInfo *auth.AuthInfo) ([]types.DatabaseServiceInfo, error)
	CheckDatabaseReadiness(ctx context.Context, authInfo *auth.AuthInfo, name, deploymentID string) (*types.DatabaseReadiness, error)
}

DatabaseManager is implemented by the gateway service.

type DeploymentGroup

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

func NewDeploymentGroup

func NewDeploymentGroup(
	g *echo.Group,
	backendRepo repository.BackendRepository,
	containerRepo repository.ContainerRepository,
	scheduler scheduler.Scheduler,
	redisClient *common.RedisClient,
	config types.AppConfig,
) *DeploymentGroup

func (*DeploymentGroup) DeleteDeployment

func (g *DeploymentGroup) DeleteDeployment(ctx echo.Context) error

func (*DeploymentGroup) DownloadDeploymentPackage

func (g *DeploymentGroup) DownloadDeploymentPackage(ctx echo.Context) error

func (*DeploymentGroup) GetURL

func (g *DeploymentGroup) GetURL(ctx echo.Context) error

func (*DeploymentGroup) ListDeployments

func (g *DeploymentGroup) ListDeployments(ctx echo.Context) error

func (*DeploymentGroup) ListLatestDeployments

func (g *DeploymentGroup) ListLatestDeployments(ctx echo.Context) error

func (*DeploymentGroup) RetrieveDeployment

func (g *DeploymentGroup) RetrieveDeployment(ctx echo.Context) error

func (*DeploymentGroup) StartDeployment

func (g *DeploymentGroup) StartDeployment(ctx echo.Context) error

func (*DeploymentGroup) StopAllActiveDeployments

func (g *DeploymentGroup) StopAllActiveDeployments(ctx echo.Context) error

func (*DeploymentGroup) StopDeployment

func (g *DeploymentGroup) StopDeployment(ctx echo.Context) error

type EventGroup

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

func NewEventGroup

func NewEventGroup(g *echo.Group, backendRepo repository.BackendRepository, containerRepo repository.ContainerRepository, eventRepo repository.EventRepository, streamMiddleware echo.MiddlewareFunc) *EventGroup

func (*EventGroup) GetContainerEventSummary

func (g *EventGroup) GetContainerEventSummary(ctx echo.Context) error

func (*EventGroup) GetContainerEvents

func (g *EventGroup) GetContainerEvents(ctx echo.Context) error

func (*EventGroup) GetContainerEventsBatch

func (g *EventGroup) GetContainerEventsBatch(ctx echo.Context) error

func (*EventGroup) GetEventHistory

func (g *EventGroup) GetEventHistory(ctx echo.Context) error

func (*EventGroup) GetTaskEvents

func (g *EventGroup) GetTaskEvents(ctx echo.Context) error

func (*EventGroup) StreamAppNamespaceEvents

func (g *EventGroup) StreamAppNamespaceEvents(ctx echo.Context) error

func (*EventGroup) StreamContainerEvents

func (g *EventGroup) StreamContainerEvents(ctx echo.Context) error

func (*EventGroup) StreamStubEvents

func (g *EventGroup) StreamStubEvents(ctx echo.Context) error

func (*EventGroup) StreamTaskEvents

func (g *EventGroup) StreamTaskEvents(ctx echo.Context) error

func (*EventGroup) StreamWorkspaceEvents

func (g *EventGroup) StreamWorkspaceEvents(ctx echo.Context) error

type HealthGroup

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

func NewHealthGroup

func NewHealthGroup(g *echo.Group, rdb *common.RedisClient, backendRepo repository.BackendRepository, ready func() bool) *HealthGroup

func (*HealthGroup) HealthCheck

func (h *HealthGroup) HealthCheck(c echo.Context) error

func (*HealthGroup) Live

func (h *HealthGroup) Live(c echo.Context) error

type LogGroup

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

func NewLogGroup

func NewLogGroup(g *echo.Group, backendRepo repository.BackendRepository, containerRepo repository.ContainerRepository, computeRepo repository.ComputeRepository, eventRepo repository.EventRepository, streamMiddleware echo.MiddlewareFunc) *LogGroup

func (*LogGroup) GetLogs

func (g *LogGroup) GetLogs(ctx echo.Context) error

func (*LogGroup) StreamLogs

func (g *LogGroup) StreamLogs(ctx echo.Context) error

type MachineGroup

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

func NewMachineGroup

func NewMachineGroup(g *echo.Group, workerRepo repository.WorkerRepository) *MachineGroup

func (*MachineGroup) GPUCounts

func (g *MachineGroup) GPUCounts(ctx echo.Context) error

type MetricsGroup

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

func NewMetricsGroup

func NewMetricsGroup(g *echo.Group, backendRepo repository.BackendRepository, eventRepo repository.EventRepository) *MetricsGroup

func (*MetricsGroup) GetPoolMetricTimeseries

func (g *MetricsGroup) GetPoolMetricTimeseries(ctx echo.Context) error

func (*MetricsGroup) GetStubMetricTimeseries

func (g *MetricsGroup) GetStubMetricTimeseries(ctx echo.Context) error

func (*MetricsGroup) GetWorkspaceMetricTimeseries

func (g *MetricsGroup) GetWorkspaceMetricTimeseries(ctx echo.Context) error

func (*MetricsGroup) StreamStubMetrics

func (g *MetricsGroup) StreamStubMetrics(ctx echo.Context) error

type OverrideStubConfig

type OverrideStubConfig struct {
	Cpu      *int64  `json:"cpu"`
	Memory   *int64  `json:"memory"`
	Gpu      *string `json:"gpu"`
	GpuCount *uint32 `json:"gpu_count"`
}

type PoolGroup

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

func NewPoolGroup

func NewPoolGroup(g *echo.Group, service PoolService) *PoolGroup

func (*PoolGroup) Create

func (g *PoolGroup) Create(ctx echo.Context) error

func (*PoolGroup) Delete

func (g *PoolGroup) Delete(ctx echo.Context) error

func (*PoolGroup) List

func (g *PoolGroup) List(ctx echo.Context) error

func (*PoolGroup) Update

func (g *PoolGroup) Update(ctx echo.Context) error

type PoolService

type PoolService interface {
	ListManagedPools(ctx context.Context, authInfo *auth.AuthInfo) ([]*model.ManagedPool, error)
	CreateManagedPool(ctx context.Context, authInfo *auth.AuthInfo, name string, config types.WorkerPoolConfig) (*model.ManagedPool, error)
	UpdateManagedPool(ctx context.Context, authInfo *auth.AuthInfo, name string, config types.WorkerPoolConfig) (*model.ManagedPool, error)
	DeleteManagedPool(ctx context.Context, authInfo *auth.AuthInfo, name string) error
}

type SandboxCreatedBucket

type SandboxCreatedBucket struct {
	Timestamp time.Time `json:"timestamp"`
	Count     int       `json:"count"`
}

type SandboxListResponse

type SandboxListResponse struct {
	Data []SandboxRow `json:"data"`
	Next string       `json:"next"`
}

type SandboxRow

type SandboxRow struct {
	Id                  string    `json:"id"`
	StubId              string    `json:"stub_id,omitempty"`
	Name                string    `json:"name"`
	CreatedAt           time.Time `json:"created_at"`
	Status              string    `json:"status"`
	Gpu                 string    `json:"gpu,omitempty"`
	ContainerId         string    `json:"container_id,omitempty"`
	TimeToStartedMs     *int64    `json:"time_to_started_ms,omitempty"`
	TimeToInteractiveMs *int64    `json:"time_to_interactive_ms,omitempty"`
	LifetimeMs          *int64    `json:"lifetime_ms,omitempty"`
	StartedAtMs         *int64    `json:"started_at_ms,omitempty"`
	InteractiveAtMs     *int64    `json:"interactive_at_ms,omitempty"`
}

type SandboxStatsResponse

type SandboxStatsResponse struct {
	Concurrent     int                    `json:"concurrent"`
	TotalCreated   int                    `json:"total_created"`
	RatePerSecond  float64                `json:"rate_per_second"`
	StatusCounts   map[string]int         `json:"status_counts"`
	CreatedBuckets []SandboxCreatedBucket `json:"created_buckets"`
	// Window the buckets, TotalCreated and RatePerSecond were computed over.
	WindowStart time.Time `json:"window_start"`
	WindowEnd   time.Time `json:"window_end"`
}

type SandboxTimeline

type SandboxTimeline struct {
	ContainerId  string     `json:"container_id,omitempty"`
	Status       string     `json:"status"`
	CreatedAt    time.Time  `json:"created_at"`
	ScheduledAt  *time.Time `json:"scheduled_at,omitempty"`
	StartedAt    *time.Time `json:"started_at,omitempty"`
	EndedAt      *time.Time `json:"ended_at,omitempty"`
	SchedulingMs *int64     `json:"scheduling_ms,omitempty"`
	StartupMs    *int64     `json:"startup_ms,omitempty"`
	RuntimeMs    *int64     `json:"runtime_ms,omitempty"`
}

type ScaleStubRequest

type ScaleStubRequest struct {
	Containers uint `json:"containers"`
}

type StackGroup

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

func NewStackGroup

func NewStackGroup(g *echo.Group, backendRepo repository.BackendRepository) *StackGroup

func (*StackGroup) Create

func (g *StackGroup) Create(ctx echo.Context) error

func (*StackGroup) Delete

func (g *StackGroup) Delete(ctx echo.Context) error

func (*StackGroup) List

func (g *StackGroup) List(ctx echo.Context) error

func (*StackGroup) Update

func (g *StackGroup) Update(ctx echo.Context) error

type StackRequest

type StackRequest struct {
	Name string          `json:"name"`
	Spec json.RawMessage `json:"spec"`
}

type StopTasksRequest

type StopTasksRequest struct {
	TaskIds types.StringSlice `query:"task_ids"`
}

type StubGroup

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

func NewStubGroup

func NewStubGroup(g *echo.Group, backendRepo repository.BackendRepository, containerRepo repository.ContainerRepository, eventRepo repository.EventRepository, redisClient *common.RedisClient, config types.AppConfig) *StubGroup

func (*StubGroup) CloneStubPublic

func (g *StubGroup) CloneStubPublic(ctx echo.Context) error

func (*StubGroup) GetConfig

func (g *StubGroup) GetConfig(ctx echo.Context) error

func (*StubGroup) GetSandboxStats

func (g *StubGroup) GetSandboxStats(ctx echo.Context) error

GetSandboxStats returns aggregate stats for the sandboxes dashboard using the same container-backed rows as ListSandboxes.

func (*StubGroup) GetSandboxTimeline

func (g *StubGroup) GetSandboxTimeline(ctx echo.Context) error

GetSandboxTimeline returns a Created -> Scheduled -> Started -> Ended timeline for a single sandbox, derived from S2 container lifecycle/scheduling events.

func (*StubGroup) GetURL

func (g *StubGroup) GetURL(ctx echo.Context) error

func (*StubGroup) ListSandboxes

func (g *StubGroup) ListSandboxes(ctx echo.Context) error

ListSandboxes returns a cursor-paginated list of sandboxes enriched with live status, GPU, time-to-started, and lifetime. It is scoped to the app when an app_id is provided, otherwise it lists all sandboxes in the workspace.

func (*StubGroup) ListStubs

func (g *StubGroup) ListStubs(ctx echo.Context) error

func (*StubGroup) ListStubsByWorkspaceId

func (g *StubGroup) ListStubsByWorkspaceId(ctx echo.Context) error

func (*StubGroup) RetrieveStub

func (g *StubGroup) RetrieveStub(ctx echo.Context) error

func (*StubGroup) ScaleStub

func (g *StubGroup) ScaleStub(ctx echo.Context) error

func (*StubGroup) UpdateConfig

func (g *StubGroup) UpdateConfig(ctx echo.Context) error

type TaskGroup

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

func NewTaskGroup

func NewTaskGroup(g *echo.Group, redisClient *common.RedisClient, taskRepo repository.TaskRepository, containerRepo repository.ContainerRepository, eventRepo repository.EventRepository, backendRepo repository.BackendRepository, taskDispatcher *task.Dispatcher, scheduler *scheduler.Scheduler, config types.AppConfig, streamMiddleware echo.MiddlewareFunc) *TaskGroup

func (*TaskGroup) AggregateTasksByTimeWindow

func (g *TaskGroup) AggregateTasksByTimeWindow(ctx echo.Context) error

func (*TaskGroup) GetClusterTaskMetrics

func (g *TaskGroup) GetClusterTaskMetrics(ctx echo.Context) error

func (*TaskGroup) GetTaskCountByDeployment

func (g *TaskGroup) GetTaskCountByDeployment(ctx echo.Context) error

func (*TaskGroup) ListTasksPaginated

func (g *TaskGroup) ListTasksPaginated(ctx echo.Context) error

func (*TaskGroup) RetrieveTask

func (g *TaskGroup) RetrieveTask(ctx echo.Context) error

func (*TaskGroup) StopTasks

func (g *TaskGroup) StopTasks(ctx echo.Context) error

func (*TaskGroup) SubscribeTask

func (g *TaskGroup) SubscribeTask(ctx echo.Context) error

type TokenGroup

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

func NewTokenGroup

func NewTokenGroup(g *echo.Group, backendRepo repository.BackendRepository, workspaceRepo repository.WorkspaceRepository, config types.AppConfig) *TokenGroup

func (*TokenGroup) ClusterAdminUpdateAllWorkspaceTokens

func (g *TokenGroup) ClusterAdminUpdateAllWorkspaceTokens(ctx echo.Context) error

func (*TokenGroup) CreateWorkspaceToken

func (g *TokenGroup) CreateWorkspaceToken(ctx echo.Context) error

func (*TokenGroup) DeleteWorkspaceToken

func (g *TokenGroup) DeleteWorkspaceToken(ctx echo.Context) error

func (*TokenGroup) GetSigningKey

func (g *TokenGroup) GetSigningKey(ctx echo.Context) error

func (*TokenGroup) ListWorkspaceTokens

func (g *TokenGroup) ListWorkspaceTokens(ctx echo.Context) error

func (*TokenGroup) ToggleWorkspaceToken

func (g *TokenGroup) ToggleWorkspaceToken(ctx echo.Context) error

type UpdateConfigRequest

type UpdateConfigRequest struct {
	Fields map[string]interface{} `json:"fields"` // Map of field paths to values (e.g., {"runtime.cpu": 4, "runtime.memory": 8192})
}

type WebhookGroup

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

WebhookGroup edits a workspace's webhook subscriptions; the event sink delivers (its list cache expires within seconds).

func NewWebhookGroup

func NewWebhookGroup(g *echo.Group, workspaceRepo repository.WorkspaceRepository) *WebhookGroup

func (*WebhookGroup) Create

func (g *WebhookGroup) Create(ctx echo.Context) error

func (*WebhookGroup) Delete

func (g *WebhookGroup) Delete(ctx echo.Context) error

func (*WebhookGroup) List

func (g *WebhookGroup) List(ctx echo.Context) error

func (*WebhookGroup) Test

func (g *WebhookGroup) Test(ctx echo.Context) error

Test posts a `webhook.test` event synchronously and reports the receiver's status.

func (*WebhookGroup) Update

func (g *WebhookGroup) Update(ctx echo.Context) error

type WebhookRequest

type WebhookRequest struct {
	URL         string   `json:"url"`
	EventTypes  []string `json:"event_types"`
	Description string   `json:"description"`
	Enabled     *bool    `json:"enabled"`
}

type WorkspaceConfigExport

type WorkspaceConfigExport struct {
	GatewayHTTPHost string `json:"gateway_http_host"`
	GatewayHTTPPort int    `json:"gateway_http_port"`
	GatewayHTTPTLS  bool   `json:"gateway_http_tls"`
	GatewayGRPCHost string `json:"gateway_grpc_host"`
	GatewayGRPCPort int    `json:"gateway_grpc_port"`
	GatewayGRPCTLS  bool   `json:"gateway_grpc_tls"`
	WorkspaceID     string `json:"workspace_id"`
	Token           string `json:"token"`
}

type WorkspaceGroup

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

func NewWorkspaceGroup

func NewWorkspaceGroup(g *echo.Group, backendRepo repository.BackendRepository, workspaceRepo repository.WorkspaceRepository, defaultStorageClient *clients.StorageClient, config types.AppConfig) *WorkspaceGroup

func (*WorkspaceGroup) CreateWorkspace

func (g *WorkspaceGroup) CreateWorkspace(ctx echo.Context) error

func (*WorkspaceGroup) CreateWorkspaceStorage

func (g *WorkspaceGroup) CreateWorkspaceStorage(ctx echo.Context) error

CreateWorkspaceStorage creates a new bucket in the configured default storage provider. It then creates a new workspace storage object for that bucket and sets it as the storage bucket for the workspace.

func (*WorkspaceGroup) CurrentWorkspace

func (g *WorkspaceGroup) CurrentWorkspace(ctx echo.Context) error

func (*WorkspaceGroup) ExportWorkspaceConfig

func (g *WorkspaceGroup) ExportWorkspaceConfig(ctx echo.Context) error

func (*WorkspaceGroup) Limits

func (g *WorkspaceGroup) Limits(ctx echo.Context) error

func (*WorkspaceGroup) SetExternalWorkspaceStorage

func (g *WorkspaceGroup) SetExternalWorkspaceStorage(ctx echo.Context) error

SetExternalWorkspaceStorage takes in the details for accessing an external s3 compatible storage bucket. This includes: - Bucket name - Access key - Secret key - Endpoint URL - Region It then creates a new workspace storage object for that bucket and sets it as the storage bucket for the workspace.

type WorkspaceLimits

type WorkspaceLimits struct {
	Cpu               uint64   `json:"cpu"`
	Memory            uint64   `json:"memory"`
	MaxReplicas       uint64   `json:"max_replicas"`
	MaxGpuCount       uint32   `json:"max_gpu_count"`
	GPULimit          uint32   `json:"gpu_limit"`
	CPUMillicoreLimit uint32   `json:"cpu_millicore_limit"`
	GPUTypes          []string `json:"gpu_types"`
}

WorkspaceLimits: per-stub ceilings, concurrency limit and GPU types a client may request.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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