api

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package api provides a client for communicating with the control-plane API.

Package api provides a client for communicating with the control-plane API.

Index

Constants

View Source
const DefaultConfigCacheTTL = 5 * time.Minute

DefaultConfigCacheTTL is the default time-to-live for cached configuration.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	ID          string    `json:"id"`
	OrgID       string    `json:"org_id"`
	OwnerID     string    `json:"owner_id"`
	Name        string    `json:"name"`
	Description string    `json:"description"`
	IconURL     string    `json:"icon_url"`
	Services    []Service `json:"services"`
	Version     int       `json:"version"` // For optimistic locking
	Domains     []string  `json:"domains"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
}

App represents an application from the API.

type AuthResponse

type AuthResponse struct {
	Token  string `json:"token"`
	UserID string `json:"user_id"`
}

AuthResponse is returned from login/register.

type Build

type Build struct {
	ID           string    `json:"id"`
	AppID        string    `json:"app_id"`
	DeploymentID string    `json:"deployment_id"`
	Status       string    `json:"status"`
	Strategy     string    `json:"build_strategy,omitempty"`
	Logs         string    `json:"logs,omitempty"`
	CreatedAt    time.Time `json:"created_at"`
	UpdatedAt    time.Time `json:"updated_at"`
}

Build represents a build job from the API.

type BuildConfig

type BuildConfig struct {
	BuildCommand string            `json:"build_command,omitempty"`
	StartCommand string            `json:"start_command,omitempty"`
	EntryPoint   string            `json:"entry_point,omitempty"`
	EnvVars      map[string]string `json:"environment_vars,omitempty"`

	// Go-specific build configuration fields
	// **Validates: Requirements 17.1**
	BuildTags []string `json:"build_tags,omitempty"` // Go build tags (e.g., ["integration", "debug"])

	// **Validates: Requirements 18.1**
	Ldflags string `json:"ldflags,omitempty"` // Custom ldflags for Go linker (e.g., "-X main.version=1.0.0")

	// **Validates: Requirements 16.5**
	CGOEnabled *bool `json:"cgo_enabled,omitempty"` // Explicit CGO control (nil = auto-detect)

	// **Validates: Requirements 21.1, 21.2**
	PreBuildCommands  []string `json:"pre_build_commands,omitempty"`  // Commands to run before build
	PostBuildCommands []string `json:"post_build_commands,omitempty"` // Commands to run after build

	// Go workspace support **Validates: Requirements 22.1, 22.2, 22.3, 22.4**
	IsWorkspace     bool   `json:"is_workspace,omitempty"`     // True if go.work file detected
	WorkspaceModule string `json:"workspace_module,omitempty"` // Selected module to build in workspace
}

BuildConfig contains strategy-specific configuration options.

type BuildStrategy

type BuildStrategy string

BuildStrategy represents the method used to build an application.

const (
	BuildStrategyFlake      BuildStrategy = "flake"       // Use existing flake.nix
	BuildStrategyAutoGo     BuildStrategy = "auto-go"     // Generate flake for Go
	BuildStrategyAutoRust   BuildStrategy = "auto-rust"   // Generate flake for Rust
	BuildStrategyAutoNode   BuildStrategy = "auto-node"   // Generate flake for Node.js
	BuildStrategyAutoPython BuildStrategy = "auto-python" // Generate flake for Python
	BuildStrategyDockerfile BuildStrategy = "dockerfile"  // Build from Dockerfile
	BuildStrategyNixpacks   BuildStrategy = "nixpacks"    // Use Nixpacks
	BuildStrategyAuto       BuildStrategy = "auto"        // Auto-detect
)

type Client

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

Client is an API client for the control-plane.

func NewClient

func NewClient(baseURL string) *Client

NewClient creates a new API client.

func (*Client) AcceptInvitation

func (c *Client) AcceptInvitation(ctx context.Context, token, password string) (*AuthResponse, error)

AcceptInvitation accepts an invitation and creates a user (public).

func (*Client) ApplyUpdate added in v0.0.9

func (c *Client) ApplyUpdate(ctx context.Context, version string) error

ApplyUpdate triggers an update to the specified version.

func (*Client) CanRegister

func (c *Client) CanRegister(ctx context.Context) (bool, error)

CanRegister checks if public registration is allowed (no owner exists yet).

func (*Client) CheckForUpdates added in v0.0.9

func (c *Client) CheckForUpdates(ctx context.Context) (*UpdateInfo, error)

CheckForUpdates checks if a new version is available.

func (*Client) CheckHealth

func (c *Client) CheckHealth(ctx context.Context) error

CheckHealth checks if the API server is healthy by calling the /health endpoint.

func (*Client) CreateApp

func (c *Client) CreateApp(ctx context.Context, name, description, iconURL string) (*App, error)

CreateApp creates a new application.

func (*Client) CreateDomain

func (c *Client) CreateDomain(ctx context.Context, appID, service, domain string, isWildcard bool) (*Domain, error)

CreateDomain creates a new domain mapping.

func (*Client) CreateInvitation

func (c *Client) CreateInvitation(ctx context.Context, email, role string) (*Invitation, error)

CreateInvitation creates a new invitation (admin only).

func (*Client) CreateOrg

func (c *Client) CreateOrg(ctx context.Context, req CreateOrgRequest) (*Organization, error)

CreateOrg creates a new organization.

func (*Client) CreateSecret

func (c *Client) CreateSecret(ctx context.Context, appID, key, value string) error

CreateSecret adds a secret to an app.

func (*Client) CreateService

func (c *Client) CreateService(ctx context.Context, appID string, svc CreateServiceRequest) (*Service, error)

CreateService adds a service to an app.

func (*Client) DeleteApp

func (c *Client) DeleteApp(ctx context.Context, id string) error

DeleteApp removes an application.

func (*Client) DeleteDomain

func (c *Client) DeleteDomain(ctx context.Context, id string) error

DeleteDomain removes a domain mapping.

func (*Client) DeleteOrg

func (c *Client) DeleteOrg(ctx context.Context, orgID string) error

DeleteOrg deletes an organization.

func (*Client) DeleteSecret

func (c *Client) DeleteSecret(ctx context.Context, appID, key string) error

DeleteSecret removes a secret from an app.

func (*Client) DeleteService

func (c *Client) DeleteService(ctx context.Context, appID, serviceName string) error

DeleteService removes a service from an app.

func (*Client) DeleteUser

func (c *Client) DeleteUser(ctx context.Context, userID string) error

DeleteUser removes a user (admin only).

func (*Client) Deploy

func (c *Client) Deploy(ctx context.Context, appID, serviceName string) (*Deployment, error)

Deploy triggers a deployment for a service.

func (*Client) Get

func (c *Client) Get(ctx context.Context, path string, result interface{}) error

Get performs a GET request and unmarshals the response.

func (*Client) GetApp

func (c *Client) GetApp(ctx context.Context, id string) (*App, error)

GetApp fetches a single app by ID.

func (*Client) GetAppLogs

func (c *Client) GetAppLogs(ctx context.Context, appID string) ([]Log, error)

GetAppLogs fetches logs for an app.

func (*Client) GetBuild

func (c *Client) GetBuild(ctx context.Context, id string) (*Build, error)

GetBuild retrieves a specific build by ID.

func (*Client) GetBuildByDeployment

func (c *Client) GetBuildByDeployment(ctx context.Context, deploymentID string) (*Build, error)

GetBuildByDeployment fetches a build by its deployment ID.

func (*Client) GetConfig

func (c *Client) GetConfig(ctx context.Context) (*PlatformConfig, error)

GetConfig fetches platform configuration from the backend.

func (*Client) GetDashboardData

func (c *Client) GetDashboardData(ctx context.Context) (*DashboardStats, []RecentDeployment, []NodeHealth, error)

GetDashboardData fetches dashboard data from the backend statistics endpoint. This uses the backend as the source of truth for statistics instead of calculating client-side. **Validates: Requirements 3.1, 3.2, 3.3**

func (*Client) GetDashboardStats

func (c *Client) GetDashboardStats(ctx context.Context) (*DashboardStatsResponse, error)

GetDashboardStats fetches pre-calculated dashboard statistics from the backend.

func (*Client) GetDeployment

func (c *Client) GetDeployment(ctx context.Context, id string) (*Deployment, error)

func (*Client) GetGitHubConfig

func (c *Client) GetGitHubConfig(ctx context.Context) (*GitHubConfigStatus, error)

GetGitHubConfig checks if the GitHub App is configured.

func (*Client) GetGitHubInstallURL

func (c *Client) GetGitHubInstallURL(ctx context.Context) (string, error)

GetGitHubInstallURL gets the URL to install the GitHub App.

func (*Client) GetGitHubOAuthURL

func (c *Client) GetGitHubOAuthURL(ctx context.Context) (string, error)

GetGitHubOAuthURL gets the URL to start standard GitHub OAuth authorization.

func (*Client) GetGitHubSetupURL

func (c *Client) GetGitHubSetupURL(ctx context.Context, org string) (string, error)

GetGitHubSetupURL returns the path to start GitHub App creation. Note: This endpoint now returns HTML for a POST manifest flow, so we don't fetch it as JSON.

func (*Client) GetInvitationByToken

func (c *Client) GetInvitationByToken(ctx context.Context, token string) (*Invitation, error)

GetInvitationByToken fetches invitation details by token (public).

func (*Client) GetNode

func (c *Client) GetNode(ctx context.Context, id string) (*Node, error)

GetNode retrieves a specific node by ID.

func (*Client) GetOrg

func (c *Client) GetOrg(ctx context.Context, orgID string) (*Organization, error)

GetOrg fetches an organization by ID.

func (*Client) GetOrgBySlug

func (c *Client) GetOrgBySlug(ctx context.Context, slug string) (*Organization, error)

GetOrgBySlug fetches an organization by slug.

func (*Client) GetRaw

func (c *Client) GetRaw(ctx context.Context, path string) ([]byte, string, error)

GetRaw performs a GET request and returns the raw response body as a byte slice.

func (*Client) GetServiceLogs

func (c *Client) GetServiceLogs(ctx context.Context, appID, serviceName string) ([]Log, error)

GetServiceLogs fetches logs for a specific service within an app.

func (*Client) GetSettings

func (c *Client) GetSettings(ctx context.Context) (map[string]string, error)

GetSettings fetches global settings.

func (*Client) GetUserProfile

func (c *Client) GetUserProfile(ctx context.Context) (*store.User, error)

GetUserProfile retrieves the current user's profile.

func (*Client) ListAllDomains

func (c *Client) ListAllDomains(ctx context.Context) ([]Domain, error)

ListAllDomains retrieves all domains across all applications.

func (*Client) ListAppDeployments

func (c *Client) ListAppDeployments(ctx context.Context, appID string) ([]Deployment, error)

ListAppDeployments fetches all deployments for an app.

func (*Client) ListApps

func (c *Client) ListApps(ctx context.Context) ([]App, error)

ListApps fetches all apps for the current user.

func (*Client) ListBuilds

func (c *Client) ListBuilds(ctx context.Context) ([]Build, error)

ListBuilds retrieves all builds for the user from the API.

func (*Client) ListDeployments

func (c *Client) ListDeployments(ctx context.Context) ([]Deployment, error)

GetDeployment fetches a single deployment by ID. ListDeployments retrieves all deployments for the user.

func (*Client) ListGitHubInstallations

func (c *Client) ListGitHubInstallations(ctx context.Context) ([]GitHubInstallation, error)

ListGitHubInstallations lists all GitHub App installations.

func (*Client) ListGitHubRepos

func (c *Client) ListGitHubRepos(ctx context.Context) ([]GitHubRepository, error)

ListGitHubRepos lists repositories across all user installations.

func (*Client) ListInvitations

func (c *Client) ListInvitations(ctx context.Context) ([]Invitation, error)

ListInvitations fetches all invitations (admin only).

func (*Client) ListNodes

func (c *Client) ListNodes(ctx context.Context) ([]Node, error)

ListNodes retrieves all nodes.

func (*Client) ListOrgs

func (c *Client) ListOrgs(ctx context.Context) ([]Organization, error)

ListOrgs fetches all organizations for the current user.

func (*Client) ListSecrets

func (c *Client) ListSecrets(ctx context.Context, appID string) ([]Secret, error)

ListSecrets fetches all secrets for an app.

func (*Client) ListUsers

func (c *Client) ListUsers(ctx context.Context) ([]UserInfo, error)

ListUsers fetches all users (admin only).

func (*Client) Login

func (c *Client) Login(ctx context.Context, email, password string) (*AuthResponse, error)

Login authenticates a user and returns a JWT token.

func (*Client) Register

func (c *Client) Register(ctx context.Context, email, password string) (*AuthResponse, error)

Register creates a new user account.

func (*Client) ReloadService

func (c *Client) ReloadService(ctx context.Context, appID, serviceName string) error

ReloadService restarts a service without rebuilding.

func (*Client) ResetGitHubConfig

func (c *Client) ResetGitHubConfig(ctx context.Context) error

ResetGitHubConfig clears the GitHub configuration and all associated data.

func (*Client) RetryBuild

func (c *Client) RetryBuild(ctx context.Context, id string) error

RetryBuild retries a failed build.

func (*Client) RetryService

func (c *Client) RetryService(ctx context.Context, appID, serviceName string) error

RetryService retries a failed deployment.

func (*Client) RevokeInvitation

func (c *Client) RevokeInvitation(ctx context.Context, invitationID string) error

RevokeInvitation revokes an invitation (admin only).

func (*Client) RollbackDeployment

func (c *Client) RollbackDeployment(ctx context.Context, id string) (*Deployment, error)

RollbackDeployment rolls back a deployment.

func (*Client) SaveGitHubConfig

func (c *Client) SaveGitHubConfig(ctx context.Context, configType, clientID, clientSecret string) error

SaveGitHubConfig saves the GitHub configuration (for manual OAuth).

func (*Client) StartService

func (c *Client) StartService(ctx context.Context, appID, serviceName string) error

StartService starts a stopped service.

func (*Client) StopService

func (c *Client) StopService(ctx context.Context, appID, serviceName string) error

StopService stops a running service.

func (*Client) UpdateApp

func (c *Client) UpdateApp(ctx context.Context, id string, req UpdateAppRequest) (*App, error)

UpdateApp updates an existing application.

func (*Client) UpdateOrg

func (c *Client) UpdateOrg(ctx context.Context, orgID string, req UpdateOrgRequest) (*Organization, error)

UpdateOrg updates an organization.

func (*Client) UpdateService

func (c *Client) UpdateService(ctx context.Context, appID, serviceName string, svc CreateServiceRequest) (*Service, error)

UpdateService updates an existing service.

func (*Client) UpdateServicePort

func (c *Client) UpdateServicePort(ctx context.Context, appID, serviceName string, port int) (*Service, error)

UpdateServicePort updates a service's port configuration.

func (*Client) UpdateSettings

func (c *Client) UpdateSettings(ctx context.Context, settings map[string]string) error

UpdateSettings updates global settings.

func (*Client) UpdateUserProfile

func (c *Client) UpdateUserProfile(ctx context.Context, name, avatarURL string) (*store.User, error)

UpdateUserProfile updates the current user's profile.

func (*Client) WithOrg

func (c *Client) WithOrg(orgID string) *Client

WithOrg returns a new client with the specified organization ID. The organization ID will be included in the X-Org-ID header for all requests. **Validates: Requirements 13.1**

func (*Client) WithToken

func (c *Client) WithToken(token string) *Client

WithToken returns a new client with the specified auth token.

type ConfigCache

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

ConfigCache provides thread-safe caching for platform configuration. This reduces API calls and improves performance for frequently accessed config values. **Validates: Requirements 4.1, 4.2, 4.3, 4.4**

func GetGlobalConfigCache

func GetGlobalConfigCache() *ConfigCache

GetGlobalConfigCache returns the global config cache instance.

func NewConfigCache

func NewConfigCache(ttl time.Duration) *ConfigCache

NewConfigCache creates a new configuration cache with the specified TTL.

func (*ConfigCache) Get

func (cc *ConfigCache) Get(ctx context.Context, client *Client) (*PlatformConfig, error)

Get retrieves the cached configuration, fetching from the backend if expired or not cached.

func (*ConfigCache) GetDefaultPort

func (cc *ConfigCache) GetDefaultPort(ctx context.Context, client *Client, serviceType string) int

GetDefaultPort returns the default port for a given service type from the cached config. Falls back to 8080 if the type is not found or config is unavailable. **Validates: Requirements 4.1**

func (*ConfigCache) GetDomain

func (cc *ConfigCache) GetDomain(ctx context.Context, client *Client) string

GetDomain returns the platform domain from the cached config. Falls back to "localhost" if config is unavailable. **Validates: Requirements 4.2**

func (*ConfigCache) GetStatusMapping

func (cc *ConfigCache) GetStatusMapping(ctx context.Context, client *Client, status string) *StatusMapping

GetStatusMapping returns the status mapping for a given status from the cached config. Returns nil if the status is not found or config is unavailable. **Validates: Requirements 4.3**

func (*ConfigCache) GetSupportedDBTypes

func (cc *ConfigCache) GetSupportedDBTypes(ctx context.Context, client *Client) []DatabaseTypeDef

GetSupportedDBTypes returns the list of supported database types from the cached config. Returns an empty slice if config is unavailable. **Validates: Requirements 4.4**

func (*ConfigCache) Invalidate

func (cc *ConfigCache) Invalidate()

Invalidate clears the cached configuration, forcing a refresh on next access.

type CreateAppRequest

type CreateAppRequest struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	IconURL     string `json:"icon_url"`
}

CreateAppRequest is the request body for creating an app.

type CreateOrgRequest

type CreateOrgRequest struct {
	Name        string `json:"name"`
	Slug        string `json:"slug,omitempty"`
	Description string `json:"description,omitempty"`
	IconURL     string `json:"icon_url,omitempty"`
}

CreateOrgRequest is the request body for creating an organization.

type CreateSecretRequest

type CreateSecretRequest struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

CreateSecretRequest is the request body for creating a secret.

type CreateServiceRequest

type CreateServiceRequest struct {
	Name          string            `json:"name"`
	SourceType    string            `json:"source_type"`
	GitRepo       string            `json:"git_repo,omitempty"`
	GitRef        string            `json:"git_ref,omitempty"`
	FlakeURI      string            `json:"flake_uri,omitempty"`
	BuildStrategy BuildStrategy     `json:"build_strategy,omitempty"`
	BuildConfig   *BuildConfig      `json:"build_config,omitempty"`
	Database      *DatabaseConfig   `json:"database,omitempty"`
	Resources     *ResourceSpec     `json:"resources,omitempty"` // Direct CPU/memory specification
	Replicas      int               `json:"replicas"`
	EnvVars       map[string]string `json:"env_vars,omitempty"`
	DependsOn     []string          `json:"depends_on,omitempty"`
}

CreateServiceRequest is the request body for creating a service.

type DashboardStats

type DashboardStats struct {
	TotalApps         int
	ActiveDeployments int
	HealthyNodes      int
	RunningBuilds     int
}

DashboardStats holds aggregated stats for the dashboard.

type DashboardStatsResponse

type DashboardStatsResponse struct {
	ActiveDeployments int               `json:"active_deployments"`
	TotalApps         int               `json:"total_apps"`
	TotalServices     int               `json:"total_services"`
	NodeHealth        NodeHealthSummary `json:"node_health"`
}

DashboardStatsResponse holds pre-calculated dashboard statistics from the backend.

type DatabaseConfig

type DatabaseConfig struct {
	Type    string `json:"type"`
	Version string `json:"version"`
}

DatabaseConfig represents a database configuration.

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. **Validates: Requirements 4.4**

type Deployment

type Deployment struct {
	ID          string    `json:"id"`
	AppID       string    `json:"app_id"`
	ServiceName string    `json:"service_name"`
	Version     int       `json:"version"`
	GitRef      string    `json:"git_ref"`
	GitCommit   string    `json:"git_commit,omitempty"`
	Status      string    `json:"status"`
	NodeID      string    `json:"node_id,omitempty"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
}

Deployment represents a deployment from the API.

type Domain

type Domain struct {
	ID         string    `json:"id"`
	AppID      string    `json:"app_id"`
	Service    string    `json:"service"`
	Domain     string    `json:"domain"`
	IsWildcard bool      `json:"is_wildcard"`
	Verified   bool      `json:"verified"`
	CreatedAt  time.Time `json:"created_at"`
	UpdatedAt  time.Time `json:"updated_at"`
}

Domain represents a custom domain mapping.

type GitHubConfigStatus

type GitHubConfigStatus struct {
	Configured bool    `json:"configured"`
	ConfigType string  `json:"config_type,omitempty"` // "app" or "oauth"
	AppID      *int64  `json:"app_id,omitempty"`
	Slug       *string `json:"slug,omitempty"`
}

GitHubConfigStatus represents the configuration state of the GitHub integration.

type GitHubInstallation

type GitHubInstallation struct {
	ID           int64  `json:"id"`
	AccountLogin string `json:"account_login"`
	AccountType  string `json:"account_type"`
}

GitHubInstallation represents an installation of the GitHub App.

type GitHubRepository

type GitHubRepository struct {
	ID            int64  `json:"id"`
	Name          string `json:"name"`
	FullName      string `json:"full_name"`
	HTMLURL       string `json:"html_url"`
	Description   string `json:"description"`
	DefaultBranch string `json:"default_branch"`
}

GitHubRepository represents a repository from the GitHub API.

type Invitation

type Invitation struct {
	ID         string `json:"id"`
	Email      string `json:"email"`
	Token      string `json:"token,omitempty"`
	InvitedBy  string `json:"invited_by"`
	Role       string `json:"role"`
	Status     string `json:"status"`
	ExpiresAt  string `json:"expires_at"`
	AcceptedAt string `json:"accepted_at,omitempty"`
	CreatedAt  string `json:"created_at"`
}

Invitation represents an invitation to join the platform.

type Log

type Log struct {
	ID           string    `json:"id"`
	DeploymentID string    `json:"deployment_id"`
	Source       string    `json:"source"`
	Level        string    `json:"level"`
	Message      string    `json:"message"`
	Timestamp    time.Time `json:"timestamp"`
}

Log represents a log entry.

type LoginRequest

type LoginRequest struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

LoginRequest is the request body for login.

type Node

type Node struct {
	ID            string         `json:"id"`
	Hostname      string         `json:"hostname"`
	Address       string         `json:"address"`
	Healthy       bool           `json:"healthy"`
	Resources     *NodeResources `json:"resources,omitempty"`
	LastHeartbeat time.Time      `json:"last_heartbeat"`
}

Node represents a compute node from the API.

type NodeHealth

type NodeHealth struct {
	Name       string
	Address    string
	Healthy    bool
	CPUPercent int
	MemPercent int
}

NodeHealth holds node health display data.

type NodeHealthSummary

type NodeHealthSummary struct {
	Total     int `json:"total"`
	Healthy   int `json:"healthy"`
	Unhealthy int `json:"unhealthy"`
}

NodeHealthSummary holds node health statistics.

type NodeResources

type NodeResources struct {
	CPUTotal        float64 `json:"cpu_total"`
	CPUAvailable    float64 `json:"cpu_available"`
	MemoryTotal     int64   `json:"memory_total"`
	MemoryAvailable int64   `json:"memory_available"`
}

NodeResources represents resource availability.

type Organization

type Organization struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Slug        string `json:"slug"`
	Description string `json:"description"`
	IconURL     string `json:"icon_url"`
}

Organization represents an organization from the API.

type PlatformConfig

type PlatformConfig struct {
	Domain            string                   `json:"domain"`
	DefaultPorts      map[string]int           `json:"default_ports"`
	StatusMappings    map[string]StatusMapping `json:"status_mappings"`
	DefaultResources  ResourceSpec             `json:"default_resources"`
	SupportedDBTypes  []DatabaseTypeDef        `json:"supported_db_types"`
	MaxServicesPerApp int                      `json:"max_services_per_app"`
}

PlatformConfig holds platform-wide configuration from the backend. **Validates: Requirements 4.1, 4.2, 4.3, 4.4**

type RecentDeployment

type RecentDeployment struct {
	AppName     string
	ServiceName string
	Status      string
	TimeAgo     string
}

RecentDeployment holds data for recent deployments display.

type RegisterRequest

type RegisterRequest struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

RegisterRequest is the request body for registration.

type ResourceSpec

type ResourceSpec struct {
	CPU    string `json:"cpu"`    // e.g., "0.5", "1", "2"
	Memory string `json:"memory"` // e.g., "256Mi", "1Gi"
}

ResourceSpec represents direct resource allocation.

type Secret

type Secret struct {
	Key       string    `json:"key"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

Secret represents a secret/env var for an app.

type Service

type Service struct {
	Name       string          `json:"name"`
	SourceType string          `json:"source_type"`
	GitRepo    string          `json:"git_repo,omitempty"`
	GitRef     string          `json:"git_ref,omitempty"`
	FlakeURI   string          `json:"flake_uri,omitempty"`
	Database   *DatabaseConfig `json:"database,omitempty"`

	// Build & Runtime
	BuildStrategy BuildStrategy     `json:"build_strategy,omitempty"`
	BuildConfig   *BuildConfig      `json:"build_config,omitempty"`
	Resources     *ResourceSpec     `json:"resources,omitempty"` // Direct CPU/memory specification
	Replicas      int               `json:"replicas"`
	Port          int               `json:"port,omitempty"` // Container port the app listens on
	EnvVars       map[string]string `json:"env_vars,omitempty"`
	DependsOn     []string          `json:"depends_on,omitempty"`
}

Service represents a service within an app.

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. **Validates: Requirements 4.3**

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 is the request body for updating an app.

type UpdateInfo added in v0.0.9

type UpdateInfo struct {
	CurrentVersion  string `json:"current_version"`
	LatestVersion   string `json:"latest_version"`
	UpdateAvailable bool   `json:"update_available"`
	ReleaseURL      string `json:"release_url,omitempty"`
	ReleaseNotes    string `json:"release_notes,omitempty"`
	PublishedAt     string `json:"published_at,omitempty"`
}

UpdateInfo contains information about available updates.

type UpdateOrgRequest

type UpdateOrgRequest struct {
	Name        string `json:"name,omitempty"`
	Slug        string `json:"slug,omitempty"`
	Description string `json:"description,omitempty"`
	IconURL     string `json:"icon_url,omitempty"`
}

UpdateOrgRequest is the request body for updating an organization.

type UserInfo

type UserInfo struct {
	ID        string `json:"id"`
	Email     string `json:"email"`
	Name      string `json:"name,omitempty"`
	AvatarURL string `json:"avatar_url,omitempty"`
	Role      string `json:"role"`
	InvitedBy string `json:"invited_by,omitempty"`
	CreatedAt int64  `json:"created_at"`
}

UserInfo represents a user in the system.

Jump to

Keyboard shortcuts

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