api

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: MIT Imports: 39 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActivityEvent

type ActivityEvent struct {
	ID           string `json:"id"`
	ResourceType string `json:"resource_type"`
	ResourceID   string `json:"resource_id"`
	ResourceName string `json:"resource_name,omitempty"`
	Action       string `json:"action"`
	Status       string `json:"status,omitempty"`
	Message      string `json:"message"`
	CreatedAt    int64  `json:"created_at"`
	ServiceID    string `json:"service_id,omitempty"`
}

type BootstrapTokenValidateRequest

type BootstrapTokenValidateRequest struct {
	Token string `json:"token"`
}

BootstrapTokenValidateRequest is the body for POST /v1/system/bootstrap-token/validate.

type BootstrapTokenValidateResponse

type BootstrapTokenValidateResponse struct {
	Valid bool `json:"valid"`
}

BootstrapTokenValidateResponse indicates whether the provided token is valid.

type CreateKeyRequest

type CreateKeyRequest struct {
	Name      string `json:"name"`
	ExpiresIn *int64 `json:"expires_in,omitempty"`
}

type CreateKeyResponse

type CreateKeyResponse struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	APIKey  string `json:"api_key"`
	Prefix  string `json:"prefix"`
	Expires *int64 `json:"expires_at,omitempty"`
}

type DetailedHealthResponse

type DetailedHealthResponse struct {
	Status          string             `json:"status"`
	Docker          DockerInfo         `json:"docker"`
	GVisor          GVisorInfo         `json:"gvisor"`
	Disk            DiskInfo           `json:"disk"`
	DockerDisk      DiskInfo           `json:"docker_disk"`
	DockerStorage   *DockerStorageInfo `json:"docker_storage,omitempty"`
	TraefikNetworks *int               `json:"traefik_networks,omitempty"`
}

type DiskInfo

type DiskInfo struct {
	TotalGB     float64 `json:"total_gb"`
	FreeGB      float64 `json:"free_gb"`
	UsedPercent float64 `json:"used_percent"`
}

type DockerInfo

type DockerInfo struct {
	Available bool   `json:"available"`
	Version   string `json:"version,omitempty"`
}

type DockerStorageInfo

type DockerStorageInfo struct {
	ImagesSizeBytes     int64   `json:"images_size_bytes"`
	ContainersSizeBytes int64   `json:"containers_size_bytes"`
	VolumesSizeBytes    int64   `json:"volumes_size_bytes"`
	BuildCacheSizeBytes int64   `json:"build_cache_size_bytes"`
	TotalSizeGB         float64 `json:"total_size_gb"`
}

DockerStorageInfo holds Docker object storage sizes from the Docker system df API.

type GVisorInfo

type GVisorInfo struct {
	Available bool   `json:"available"`
	Version   string `json:"version,omitempty"`
}

type HealthResponse

type HealthResponse struct {
	Status string `json:"status"`
}

type KeyInfo

type KeyInfo struct {
	ID         string `json:"id"`
	Name       string `json:"name"`
	Prefix     string `json:"prefix"`
	CreatedAt  int64  `json:"created_at"`
	LastUsedAt *int64 `json:"last_used_at,omitempty"`
	ExpiresAt  *int64 `json:"expires_at,omitempty"`
}

type KeyRecoverRequest

type KeyRecoverRequest struct {
	Email          string `json:"email"`
	BootstrapToken string `json:"bootstrap_token"`
}

KeyRecoverRequest is the body accepted by POST /v1/auth/recover. Authentication is via the admin token (bootstrap token if none configured), not an API key, so this endpoint can be called even when the tenant has no valid keys remaining.

type KeyRecoverResponse

type KeyRecoverResponse struct {
	ID           string `json:"id"`
	Key          string `json:"key"`
	Name         string `json:"name"`
	CreatedAt    int64  `json:"created_at"`
	Warning      string `json:"warning,omitempty"`
	RevokedKeyID string `json:"revoked_key_id,omitempty"`
}

KeyRecoverResponse mirrors CreateKeyResponse so callers can treat both responses the same way. The raw key is shown exactly once. When a key slot was auto-revoked to make room, Warning and RevokedKeyID are populated so the caller knows what happened.

type QuotaUpdateRequest

type QuotaUpdateRequest struct {
	MaxServices          *int `json:"max_services,omitempty"`
	MaxDatabases         *int `json:"max_databases,omitempty"`
	MaxBuildsConcurrent  *int `json:"max_builds_concurrent,omitempty"`
	MaxEnvVarsPerService *int `json:"max_env_vars_per_service,omitempty"`
}

QuotaUpdateRequest is the request body for PATCH /v1/tenants/{tenantID}/quotas. All fields are optional pointers — only non-nil fields are updated.

type QuotaUpdateResponse

type QuotaUpdateResponse struct {
	TenantID             string  `json:"tenant_id"`
	MaxServices          int     `json:"max_services"`
	MaxDatabases         int     `json:"max_databases"`
	MaxBuildsConcurrent  int     `json:"max_builds_concurrent"`
	MaxEnvVarsPerService int     `json:"max_env_vars_per_service"`
	MaxMemoryMB          int     `json:"max_memory_mb"`
	MaxCPUCores          float64 `json:"max_cpu_cores"`
	MaxDiskGB            int     `json:"max_disk_gb"`
	APIRateLimit         int     `json:"api_rate_limit"`
}

QuotaUpdateResponse is the response body for PATCH /v1/tenants/{tenantID}/quotas.

type ReactivateResponse

type ReactivateResponse struct {
	TenantID string `json:"tenant_id"`
	APIKey   string `json:"api_key"`
	Status   string `json:"status"`
}

ReactivateResponse is the response body for POST /v1/tenants/{tenantID}/reactivate. It returns the new API key so the operator can hand it to the tenant.

type RegisterRequest

type RegisterRequest struct {
	Name  string `json:"name"`
	Email string `json:"email"`
}

type RegisterResponse

type RegisterResponse struct {
	TenantID string `json:"tenant_id"`
	APIKey   string `json:"api_key"`
}

type Server

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

func NewServer

func NewServer(cfg ServerConfig) *Server

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

type ServerConfig

type ServerConfig struct {
	Store                 *db.Store
	MasterKey             []byte
	DevMode               bool
	BootstrapTokens       []string
	AdminTokens           []string // operator-only endpoints (recover/reactivate/quota); empty = fall back to BootstrapTokens
	OpenRegistration      bool
	Docker                docker.Client
	BuildManager          *builds.Manager
	DeploymentStore       *deployments.Store
	DatabaseManager       databaseManager
	KanbanManager         kanbanManager
	MeteringStore         *metering.Store
	EnvironmentManager    *environments.Manager
	BaseDomain            string
	TraefikConfigDir      string
	DataDir               string // data dir for health disk checks (default /var/lib/ah)
	ExternalTLSTerminated bool
}

type TenantResponse

type TenantResponse struct {
	ID        string `json:"id"`
	Name      string `json:"name"`
	Email     string `json:"email"`
	Status    string `json:"status"`
	CreatedAt int64  `json:"created_at"`
	UpdatedAt int64  `json:"updated_at"`
}

type TenantUsageBucket

type TenantUsageBucket struct {
	Used int `json:"used"`
	Max  int `json:"max"`
}

type TenantUsageResponse

type TenantUsageResponse struct {
	Services  TenantUsageBucket `json:"services"`
	Databases TenantUsageBucket `json:"databases"`
	APIKeys   TenantUsageBucket `json:"api_keys"`
	MemoryMB  int               `json:"memory_mb"`
	CPUCores  float64           `json:"cpu_cores"`
	DiskGB    int               `json:"disk_gb"`
	RateLimit int               `json:"rate_limit"`
}

type UpdateTenantRequest

type UpdateTenantRequest struct {
	Name *string `json:"name,omitempty"`
}

Jump to

Keyboard shortcuts

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