api

package
v0.24.1 Latest Latest
Warning

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

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

Documentation

Overview

Package api wraps the Miabi /api/v1 HTTP surface, unwrapping its {success,data,error} envelope.

Index

Constants

View Source
const (
	StatusSucceeded = "succeeded"
	StatusRunning   = "running" // legacy terminal success
	StatusFailed    = "failed"
	// StatusCanary is not terminal: it waits for a human to promote or abort it.
	StatusCanary = "canary"
)

"running" is a legacy terminal success; any status that is not terminal is in progress.

View Source
const (
	BackupPending   = "pending"
	BackupRunning   = "running"
	BackupCompleted = "completed"
	BackupFailed    = "failed"
)

Backup statuses: "running" is in flight here but terminal for a deployment.

View Source
const BackupRunTimeout = 30 * time.Minute

BackupRunTimeout is long because the server runs a manual backup inline in the request.

View Source
const FileTransferTimeout = 30 * time.Minute

FileTransferTimeout replaces the 30s control-plane timeout, too short for large files on slow links.

View Source
const MaxEventPage = 100

MaxEventPage is the largest page the workspace events feed serves.

View Source
const MaxListedVolumeFiles = 5000

MaxListedVolumeFiles mirrors the panel's unreported listing cap; a listing this long may be truncated.

View Source
const MaxServerWait = 900 * time.Second

MaxServerWait is the longest ?wait= the server accepts on deploy and rollback.

View Source
const MaxVolumeUploadBytes = 512 << 20

MaxVolumeUploadBytes mirrors the panel's cap so an oversized file fails before it is sent.

View Source
const MigrationImportTimeout = 2 * time.Minute

MigrationImportTimeout covers /migrations and /migrations/probe, which reach the source before answering.

View Source
const RestoreTimeout = 60 * time.Minute

RestoreTimeout exceeds the 30s default because the panel restores inline before answering.

Variables

View Source
var Version = "dev"

Version is stamped at build time (see .goreleaser.yaml); used in User-Agent.

Functions

func IsBackupFailure added in v0.12.0

func IsBackupFailure(status string) bool

func IsBackupTerminal added in v0.12.0

func IsBackupTerminal(status string) bool

func IsFailure

func IsFailure(status string) bool

func IsRunTerminal added in v0.17.0

func IsRunTerminal(status string) bool

func IsSettled added in v0.17.0

func IsSettled(status string) bool

IsSettled is also true for a canary, which will not move until someone promotes it.

func IsTerminal

func IsTerminal(status string) bool

func MigrationRunDone added in v0.22.0

func MigrationRunDone(status string) bool

func MigrationSettled added in v0.16.0

func MigrationSettled(status string) bool

MigrationSettled reports whether it stopped moving on its own: cut over, waiting for a person, or ended.

Types

type APIError

type APIError struct {
	StatusCode int    `json:"status_code"`
	Code       string `json:"code"`
	Message    string `json:"message"`
	Detail     string `json:"error"`
}

func (*APIError) Error

func (e *APIError) Error() string

type Alert added in v0.17.0

type Alert struct {
	ID          uint      `json:"id"`
	Category    string    `json:"category"`
	Severity    string    `json:"severity"`
	State       string    `json:"state"` // firing | acknowledged | resolved
	Title       string    `json:"title"`
	Body        string    `json:"body"`
	Count       int64     `json:"count"`
	SubjectType string    `json:"subject_type"`
	SubjectRef  string    `json:"subject_ref"`
	FirstSeen   time.Time `json:"first_seen"`
	LastSeen    time.Time `json:"last_seen"`
}

type App

type App struct {
	ID          uint   `json:"id"`
	Name        string `json:"name"`
	DisplayName string `json:"display_name"`
	Image       string `json:"image"`
	Tag         string `json:"tag"`
	// SourceType is "image" or "git".
	SourceType       string    `json:"source_type"`
	GitRepo          string    `json:"git_repo,omitempty"`
	GitRef           string    `json:"git_ref,omitempty"`
	Status           string    `json:"status"`
	CurrentReleaseID *uint     `json:"current_release_id"`
	CreatedAt        time.Time `json:"created_at"`
}

type AppDatabase added in v0.18.0

type AppDatabase struct {
	LogicalDatabase
	Kind         string `json:"kind"`
	InstanceName string `json:"instance_name"`
	Engine       string `json:"engine"`
	Host         string `json:"host"`
	Port         int    `json:"port"`
}

AppDatabase is a logical database (kind "database") or a whole instance (kind "instance", ids are its).

type ApplyFailure

type ApplyFailure struct {
	Kind   string `json:"kind"`
	Name   string `json:"name"`
	Action string `json:"action"`
	Error  string `json:"error"`
}

type ApplyRequest

type ApplyRequest struct {
	Manifests string `json:"manifests"`
	Prune     bool   `json:"prune"`
	DryRun    bool   `json:"dry_run"`
	// Delete removes exactly the resources the bundle names instead of converging.
	Delete bool `json:"delete,omitempty"`
	// Force changes resources a GitOps project owns; its next sync reverts them.
	Force bool `json:"force,omitempty"`
}

type ApplyResult

type ApplyResult struct {
	Plan     *Plan          `json:"plan"`
	Applied  int            `json:"applied"`
	DryRun   bool           `json:"dry_run"`
	Failures []ApplyFailure `json:"failures,omitempty"`
}

type AttachVolumeRequest added in v0.12.0

type AttachVolumeRequest struct {
	VolumeID uint   `json:"volume_id"`
	Path     string `json:"path"`
}

type Backup added in v0.17.0

type Backup struct {
	ID          uint       `json:"id"`
	Number      int        `json:"number"`
	Status      string     `json:"status"`
	Trigger     string     `json:"trigger"`
	Destination string     `json:"destination"`
	SizeBytes   int64      `json:"size_bytes"`
	Comment     string     `json:"comment,omitempty"`
	Error       string     `json:"error,omitempty"`
	CreatedAt   time.Time  `json:"created_at"`
	FinishedAt  *time.Time `json:"finished_at,omitempty"`
}

type Change

type Change struct {
	Action string `json:"action"` // create | update | delete | noop
	Kind   string `json:"kind"`
	Name   string `json:"name"`
	Reason string `json:"reason,omitempty"`
}

type Client

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

func New

func New(o Options) (*Client, error)

New fails on an unreadable CA bundle rather than silently falling back to the system roots.

func (*Client) AckAlert added in v0.17.0

func (c *Client) AckAlert(ctx context.Context, ws string, id uint) (*Alert, error)

AckAlert acknowledges an alert: it stays active but stops re-notifying.

func (*Client) Alerts added in v0.17.0

func (c *Client) Alerts(ctx context.Context, ws string, activeOnly bool) ([]Alert, error)

Alerts with activeOnly keeps the firing and acknowledged ones.

func (*Client) App

func (c *Client) App(ctx context.Context, ws string, app string) (*App, error)

func (*Client) AppDatabases added in v0.18.0

func (c *Client) AppDatabases(ctx context.Context, ws string, app string) ([]AppDatabase, error)

func (*Client) AppEvents added in v0.17.0

func (c *Client) AppEvents(ctx context.Context, ws string, app string, limit int) ([]Event, error)

func (*Client) AppMigrations added in v0.16.0

func (c *Client) AppMigrations(ctx context.Context, ws string, app string) ([]Migration, error)

func (*Client) Apply

func (c *Client) Apply(ctx context.Context, ws string, manifests string, prune, force bool) (*ApplyResult, error)

func (*Client) Apps

func (c *Client) Apps(ctx context.Context, ws string) ([]App, error)

func (*Client) AttachDatabase added in v0.18.0

func (c *Client) AttachDatabase(ctx context.Context, ws string, app string, dbID uint, req LinkDatabaseRequest) (*LinkDatabaseResult, error)

func (*Client) AttachVolume added in v0.12.0

func (c *Client) AttachVolume(ctx context.Context, ws string, app string, req AttachVolumeRequest) error

AttachVolume only flags the app for a redeploy; it does not restart it.

func (*Client) Backups added in v0.17.0

func (c *Client) Backups(ctx context.Context, ws string, id, dbID uint) ([]Backup, error)

func (*Client) CancelWorkspaceMigration added in v0.22.0

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

CancelWorkspaceMigration closes ws's open migration, so its code stops working; ws "" closes the install's.

func (*Client) ClaimLoginToken added in v0.10.0

func (c *Client) ClaimLoginToken(ctx context.Context, code string) (*LoginToken, error)

ClaimLoginToken is public (the one-time code is the credential), so it works on a client without a token.

func (*Client) Config added in v0.10.0

func (c *Client) Config(ctx context.Context, ws string, id uint) (*Config, error)

func (*Client) ConfigData added in v0.10.0

func (c *Client) ConfigData(ctx context.Context, ws string, id uint) (map[string]string, error)

ConfigData returns a config's decrypted files (admin only, audited).

func (*Client) ConfigUsage added in v0.10.0

func (c *Client) ConfigUsage(ctx context.Context, ws string, id uint) ([]SecretUsage, error)

func (*Client) Configs added in v0.10.0

func (c *Client) Configs(ctx context.Context, ws string) ([]Config, error)

Configs returns keys and digests only, never content.

func (*Client) CreateApp added in v0.10.0

func (c *Client) CreateApp(ctx context.Context, ws string, req CreateAppRequest) (*App, error)

func (*Client) CreateConfig added in v0.10.0

func (c *Client) CreateConfig(ctx context.Context, ws string, req CreateConfigRequest) (*Config, error)

func (*Client) CreateDatabase added in v0.10.0

func (c *Client) CreateDatabase(ctx context.Context, ws string, req CreateDatabaseRequest) (*DatabaseInstance, error)

func (*Client) CreateLogicalDatabase added in v0.10.0

func (c *Client) CreateLogicalDatabase(ctx context.Context, ws string, id uint, req CreateLogicalDatabaseRequest) (*CreateLogicalDatabaseResult, error)

func (*Client) CreateSecret added in v0.10.0

func (c *Client) CreateSecret(ctx context.Context, ws string, req CreateSecretRequest) (*Secret, error)

func (*Client) CreateVolume added in v0.12.0

func (c *Client) CreateVolume(ctx context.Context, ws string, req CreateVolumeRequest) (*Volume, error)

func (*Client) Database added in v0.10.0

func (c *Client) Database(ctx context.Context, ws string, id uint) (*DatabaseInstance, error)

func (*Client) DatabaseCredentials added in v0.10.0

func (c *Client) DatabaseCredentials(ctx context.Context, ws string, id uint) (*ConnectionInfo, error)

func (*Client) DatabaseEngines added in v0.10.0

func (c *Client) DatabaseEngines(ctx context.Context, ws string) ([]EngineDefault, error)

func (*Client) Databases added in v0.10.0

func (c *Client) Databases(ctx context.Context, ws string) ([]DatabaseInstance, error)

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, ws string, manifests string) (*ApplyResult, error)

Delete removes exactly the resources the bundle names.

func (*Client) DeleteApp added in v0.10.0

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

func (*Client) DeleteConfig added in v0.10.0

func (c *Client) DeleteConfig(ctx context.Context, ws string, id uint) error

func (*Client) DeleteDatabaseInstance added in v0.10.0

func (c *Client) DeleteDatabaseInstance(ctx context.Context, ws string, id uint) error

func (*Client) DeleteLogicalDatabase added in v0.10.0

func (c *Client) DeleteLogicalDatabase(ctx context.Context, ws string, id, dbID uint) error

func (*Client) DeleteSecret added in v0.10.0

func (c *Client) DeleteSecret(ctx context.Context, ws string, id uint) error

func (*Client) DeleteVolume added in v0.12.0

func (c *Client) DeleteVolume(ctx context.Context, ws string, id uint) error

DeleteVolume fails with 409 while an application still mounts the volume.

func (*Client) DeleteVolumeBackup added in v0.12.0

func (c *Client) DeleteVolumeBackup(ctx context.Context, ws string, id, backupID uint) error

func (*Client) DeleteVolumeFile added in v0.12.0

func (c *Client) DeleteVolumeFile(ctx context.Context, ws string, id uint, path string) error

DeleteVolumeFile is recursive for directories.

func (*Client) Deploy

func (c *Client) Deploy(ctx context.Context, ws string, app string, req DeployRequest, wait time.Duration) (*DeployResult, error)

Deploy: a server may answer before the deployment settles despite wait, so callers must still poll.

func (*Client) DeployStack added in v0.23.0

func (c *Client) DeployStack(ctx context.Context, ws string, id uint, outdatedOnly bool) ([]StackDeployResult, error)

func (*Client) Deployment

func (c *Client) Deployment(ctx context.Context, ws string, app string, depID uint) (*Deployment, error)

Deployment falls back to the recent list when the server lacks the per-deployment GET (404/405).

func (*Client) DeploymentByNumber added in v0.10.0

func (c *Client) DeploymentByNumber(ctx context.Context, ws string, app string, number int) (*Deployment, error)

DeploymentByNumber maps the per-app number users pass to the deployment, whose ID API paths use.

func (*Client) Deployments

func (c *Client) Deployments(ctx context.Context, ws string, app string) ([]Deployment, error)

func (*Client) DetachDatabase added in v0.18.0

func (c *Client) DetachDatabase(ctx context.Context, ws string, app string, dbID uint) error

func (*Client) DetachVolume added in v0.12.0

func (c *Client) DetachVolume(ctx context.Context, ws string, app string, volumeID uint) error

DetachVolume keeps the volume's data.

func (*Client) DownloadVolumeFile added in v0.12.0

func (c *Client) DownloadVolumeFile(ctx context.Context, ws string, id uint, path string, dst io.Writer) (int64, error)

DownloadVolumeFile streams so a file up to the panel's 512 MiB cap is never held in memory.

func (*Client) EnvVars added in v0.10.0

func (c *Client) EnvVars(ctx context.Context, ws string, app string) ([]EnvVar, error)

EnvVars returns secret values masked; the API never returns them in plaintext.

func (*Client) FindConfigByName added in v0.10.0

func (c *Client) FindConfigByName(ctx context.Context, ws, name string) (*Config, error)

FindConfigByName returns nil, not an error, when no config has that name.

func (*Client) FindSecretByName added in v0.10.0

func (c *Client) FindSecretByName(ctx context.Context, ws, name string) (*Secret, error)

FindSecretByName returns nil, not an error, when no secret has that name.

func (*Client) FindVolumeBackup added in v0.12.0

func (c *Client) FindVolumeBackup(ctx context.Context, ws string, id, backupID uint) (*VolumeBackup, error)

FindVolumeBackup filters the history because there is no single-backup endpoint.

func (*Client) FindVolumeByName added in v0.12.0

func (c *Client) FindVolumeByName(ctx context.Context, ws, name string) (*Volume, error)

FindVolumeByName returns the named volume, or nil when none exists.

func (*Client) ImportEnv

func (c *Client) ImportEnv(ctx context.Context, ws string, app string, req ImportEnvRequest) error

func (*Client) ImportStack added in v0.23.0

func (c *Client) ImportStack(ctx context.Context, ws string, req ImportStackRequest) (*StackImportResult, error)

func (*Client) ImportWorkspace added in v0.22.0

func (c *Client) ImportWorkspace(ctx context.Context, body MigrationImport) (*MigrationRun, error)

func (*Client) InvalidateBuildCache added in v0.11.0

func (c *Client) InvalidateBuildCache(ctx context.Context, ws string, app string) error

func (*Client) LinkDatabaseInstance added in v0.18.0

func (c *Client) LinkDatabaseInstance(ctx context.Context, ws string, app string, instID uint, req LinkDatabaseRequest) (*LinkDatabaseResult, error)

func (*Client) LogicalDatabaseConnection added in v0.10.0

func (c *Client) LogicalDatabaseConnection(ctx context.Context, ws string, id, dbID uint) (*ConnectionInfo, error)

func (*Client) LogicalDatabases added in v0.10.0

func (c *Client) LogicalDatabases(ctx context.Context, ws string, id uint) ([]LogicalDatabase, error)

func (*Client) Me

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

func (*Client) Migration added in v0.16.0

func (c *Client) Migration(ctx context.Context, ws string, id uint) (*Migration, error)

func (*Client) MigrationAction added in v0.16.0

func (c *Client) MigrationAction(ctx context.Context, ws string, id uint, action string) (*Migration, error)

func (*Client) MigrationRun added in v0.22.0

func (c *Client) MigrationRun(ctx context.Context, id uint) (*MigrationRun, error)

func (*Client) MigrationStatus added in v0.22.0

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

func (*Client) Migrations added in v0.16.0

func (c *Client) Migrations(ctx context.Context, ws string) ([]Migration, error)

func (*Client) PinVolumeBackup added in v0.15.0

func (c *Client) PinVolumeBackup(ctx context.Context, ws string, id, backupID uint, pinned bool) (*VolumeBackup, error)

func (*Client) PipelineRun added in v0.17.0

func (c *Client) PipelineRun(ctx context.Context, ws string, runID uint) (*PipelineRun, error)

func (*Client) PipelineVersioning added in v0.21.0

func (c *Client) PipelineVersioning(ctx context.Context, ws, pipeline string) (*VersionPolicy, error)

func (*Client) Pipelines added in v0.11.0

func (c *Client) Pipelines(ctx context.Context, ws string) ([]Pipeline, error)

func (*Client) PlanApply

func (c *Client) PlanApply(ctx context.Context, ws string, manifests string, prune, force bool) (*Plan, error)

func (*Client) PlanDelete

func (c *Client) PlanDelete(ctx context.Context, ws string, manifests string) (*Plan, error)

func (*Client) PlanMigration added in v0.16.0

func (c *Client) PlanMigration(ctx context.Context, ws string, app string, body StartMigration) (*MigrationPlan, error)

func (*Client) ProbeMigration added in v0.22.0

func (c *Client) ProbeMigration(ctx context.Context, src MigrationSource) (*MigrationProbe, error)

func (*Client) ReleaseByVersion added in v0.10.0

func (c *Client) ReleaseByVersion(ctx context.Context, ws string, app string, version int) (*Release, error)

ReleaseByVersion resolves a version to the release, since rollback takes the release ID.

func (*Client) Releases

func (c *Client) Releases(ctx context.Context, ws string, app string) ([]Release, error)

func (*Client) RerunPipelineRun added in v0.11.0

func (c *Client) RerunPipelineRun(ctx context.Context, ws string, runID uint, req RerunPipelineRequest) (*PipelineRun, error)

func (*Client) ResolveAlert added in v0.17.0

func (c *Client) ResolveAlert(ctx context.Context, ws string, id uint) (*Alert, error)

func (*Client) ResolveConfigID added in v0.10.0

func (c *Client) ResolveConfigID(ctx context.Context, ws, ref string) (uint, error)

func (*Client) ResolveDatabaseID added in v0.10.0

func (c *Client) ResolveDatabaseID(ctx context.Context, ws, ref string) (uint, error)

func (*Client) ResolveLogicalDatabaseID added in v0.17.0

func (c *Client) ResolveLogicalDatabaseID(ctx context.Context, ws string, id uint, ref string) (uint, error)

ResolveLogicalDatabaseID selects the instance's only database when ref is empty.

func (*Client) ResolveSecretID added in v0.10.0

func (c *Client) ResolveSecretID(ctx context.Context, ws, ref string) (uint, error)

func (*Client) ResolveStackID added in v0.23.0

func (c *Client) ResolveStackID(ctx context.Context, ws, ref string) (uint, error)

func (*Client) ResolveVolumeID added in v0.12.0

func (c *Client) ResolveVolumeID(ctx context.Context, ws, ref string) (uint, error)

func (*Client) ResolveWorkspaceName added in v0.10.0

func (c *Client) ResolveWorkspaceName(ctx context.Context, ref, fallback string) (string, error)

ResolveWorkspaceName falls back to fallback, then the sole visible workspace; it always returns a name.

func (*Client) RestartApp added in v0.10.0

func (c *Client) RestartApp(ctx context.Context, ws string, app string) error

func (*Client) RestartDatabase added in v0.10.0

func (c *Client) RestartDatabase(ctx context.Context, ws string, id uint) error

func (*Client) RestoreVolumeBackup added in v0.12.0

func (c *Client) RestoreVolumeBackup(ctx context.Context, ws string, id, backupID uint) error

RestoreVolumeBackup overwrites the volume and blocks for the whole restore.

func (*Client) ResyncAppPipeline added in v0.10.0

func (c *Client) ResyncAppPipeline(ctx context.Context, ws string, app string) (*ResyncPipelineResult, error)

func (*Client) RevealSecret added in v0.10.0

func (c *Client) RevealSecret(ctx context.Context, ws string, id uint) (string, error)

RevealSecret returns a secret's decrypted value (admin only, audited).

func (*Client) Rollback

func (c *Client) Rollback(ctx context.Context, ws string, app string, req RollbackRequest, wait time.Duration) (*DeployResult, error)

func (*Client) RunBackup added in v0.17.0

func (c *Client) RunBackup(ctx context.Context, ws string, id, dbID uint, comment string) (*Backup, error)

RunBackup returns the finished record; its status says whether the backup succeeded.

func (*Client) RunVolumeBackup added in v0.12.0

func (c *Client) RunVolumeBackup(ctx context.Context, ws string, id uint) (*VolumeBackup, error)

RunVolumeBackup only enqueues: the returned record is pending, not finished.

func (*Client) SealingKey added in v0.19.0

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

func (*Client) SecretUsage added in v0.10.0

func (c *Client) SecretUsage(ctx context.Context, ws string, id uint) ([]SecretUsage, error)

func (*Client) Secrets added in v0.10.0

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

Secrets asks for a large page so the paginated list arrives in one call; values never come back.

func (*Client) SetAppSource added in v0.10.0

func (c *Client) SetAppSource(ctx context.Context, ws string, app string, req SetAppSourceRequest) (*SetAppSourceResult, error)

SetAppSource replaces the whole source: the server clears the fields of the source being left.

func (*Client) SetEnv

func (c *Client) SetEnv(ctx context.Context, ws string, app string, req SetEnvRequest) error

func (*Client) Stack added in v0.23.0

func (c *Client) Stack(ctx context.Context, ws string, id uint) (*Stack, error)

Stack returns one stack with its member apps; the API addresses stacks by id or uid, not name.

func (*Client) Stacks added in v0.23.0

func (c *Client) Stacks(ctx context.Context, ws string) ([]StackListItem, error)

func (*Client) StartApp added in v0.10.0

func (c *Client) StartApp(ctx context.Context, ws string, app string) error

func (*Client) StartDatabase added in v0.10.0

func (c *Client) StartDatabase(ctx context.Context, ws string, id uint) error

func (*Client) StartMigration added in v0.16.0

func (c *Client) StartMigration(ctx context.Context, ws string, app string, body StartMigration) (*Migration, error)

func (*Client) StartWorkspaceMigration added in v0.22.0

func (c *Client) StartWorkspaceMigration(ctx context.Context, ws string, body MigrationStartRequest) (*MigrationStarted, error)

StartWorkspaceMigration with ws "" opens the install (platform admin); starting again replaces the code.

func (*Client) StopApp added in v0.10.0

func (c *Client) StopApp(ctx context.Context, ws string, app string) error

func (*Client) StopDatabase added in v0.10.0

func (c *Client) StopDatabase(ctx context.Context, ws string, id uint) error

func (*Client) SwitchVersionSeries added in v0.21.0

func (c *Client) SwitchVersionSeries(ctx context.Context, ws, policy, series string) (*VersionPolicy, error)

func (*Client) TrafficSummary added in v0.17.0

func (c *Client) TrafficSummary(ctx context.Context, ws string, appID uint, rng string) (*TrafficSummary, error)

TrafficSummary's rng is 15m, 1h, 24h, 7d…; empty means the server default of 24h.

func (*Client) TriggerPipeline added in v0.11.0

func (c *Client) TriggerPipeline(ctx context.Context, ws, pipeline string, req TriggerPipelineRequest) (*PipelineRun, error)

TriggerPipeline takes the pipeline's numeric id or uid.

func (*Client) UnfreezeWorkspace added in v0.22.0

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

UnfreezeWorkspace lifts the freeze a migration put on ws, rolling the migration back on the source.

func (*Client) UnlinkDatabaseInstance added in v0.18.0

func (c *Client) UnlinkDatabaseInstance(ctx context.Context, ws string, app string, instID uint) error

func (*Client) UpdateConfig added in v0.10.0

func (c *Client) UpdateConfig(ctx context.Context, ws string, id uint, req UpdateConfigRequest) (*Config, error)

func (*Client) UpdateSecret added in v0.10.0

func (c *Client) UpdateSecret(ctx context.Context, ws string, id uint, req UpdateSecretRequest) (*Secret, error)

func (*Client) UpdateVersionPolicy added in v0.21.0

func (c *Client) UpdateVersionPolicy(ctx context.Context, ws, policy string, s VersionSettings) (*VersionPolicy, error)

func (*Client) UpgradeDatabase added in v0.10.0

func (c *Client) UpgradeDatabase(ctx context.Context, ws string, id uint, req UpgradeDatabaseRequest) (*DatabaseInstance, error)

func (*Client) UploadVolumeFile added in v0.12.0

func (c *Client) UploadVolumeFile(ctx context.Context, ws string, id uint, subdir, name string, content io.Reader) (string, error)

UploadVolumeFile overwrites an existing file; subdir may be empty.

func (*Client) VerifyVolumeBackup added in v0.15.0

func (c *Client) VerifyVolumeBackup(ctx context.Context, ws string, id, backupID uint) (*VerifyResult, error)

VerifyVolumeBackup checks presence, size and, for a sealed recovery point, that the passphrase opens it.

func (*Client) VersionAllocations added in v0.21.0

func (c *Client) VersionAllocations(ctx context.Context, ws, policy string, size int) ([]VersionAllocation, error)

func (*Client) Volume added in v0.12.0

func (c *Client) Volume(ctx context.Context, ws string, id uint) (*VolumeDetail, error)

Volume takes a numeric id only, unlike the file routes; resolve names with ResolveVolumeID.

func (*Client) VolumeBackupConfigured added in v0.12.0

func (c *Client) VolumeBackupConfigured(ctx context.Context, ws string, id uint) (bool, error)

func (*Client) VolumeBackupLogs added in v0.12.0

func (c *Client) VolumeBackupLogs(ctx context.Context, ws string, id, backupID uint) ([]byte, error)

func (*Client) VolumeBackups added in v0.12.0

func (c *Client) VolumeBackups(ctx context.Context, ws string, id uint) ([]VolumeBackup, error)

func (*Client) VolumeFiles added in v0.12.0

func (c *Client) VolumeFiles(ctx context.Context, ws string, id uint) ([]VolumeFile, error)

func (*Client) Volumes added in v0.12.0

func (c *Client) Volumes(ctx context.Context, ws string) ([]Volume, error)

Volumes fetches every volume at once; the endpoint is not paginated.

func (*Client) WaitForDeploy

func (c *Client) WaitForDeploy(ctx context.Context, ws string, app string, depID uint, onUpdate func(status string)) (*Deployment, error)

WaitForDeploy also stops on a canary awaiting promotion, which will not move on its own.

func (*Client) WaitForMigration added in v0.16.0

func (c *Client) WaitForMigration(ctx context.Context, ws string, id uint, onPhase func(*Migration)) (*Migration, error)

func (*Client) WaitForMigrationRun added in v0.22.0

func (c *Client) WaitForMigrationRun(ctx context.Context, id uint, every time.Duration, onChange func(*MigrationRun)) (*MigrationRun, error)

func (*Client) WaitForPipelineRun added in v0.17.0

func (c *Client) WaitForPipelineRun(ctx context.Context, ws string, runID uint, onUpdate func(status string)) (*PipelineRun, error)

func (*Client) WaitForVolumeBackup added in v0.12.0

func (c *Client) WaitForVolumeBackup(ctx context.Context, ws string, id, backupID uint, onUpdate func(status string)) (*VolumeBackup, error)

func (*Client) Workspace added in v0.17.0

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

func (*Client) WorkspaceEvents added in v0.17.0

func (c *Client) WorkspaceEvents(ctx context.Context, ws string, limit int) ([]Event, error)

WorkspaceEvents pages are zero-based on the server.

func (*Client) WorkspaceMigration added in v0.22.0

func (c *Client) WorkspaceMigration(ctx context.Context, ws string) (*MigrationOverview, error)

WorkspaceMigration returns ws's migration state on the source; ws "" returns the install's.

func (*Client) WorkspaceOverview added in v0.17.0

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

func (*Client) WorkspaceStorage added in v0.12.0

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

func (*Client) WorkspaceUsage added in v0.17.0

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

WorkspaceUsage is passed through as-is because its shape grows with every plan limit.

func (*Client) Workspaces

func (c *Client) Workspaces(ctx context.Context) ([]Workspace, error)

type Config added in v0.10.0

type Config struct {
	ID          uint           `json:"id"`
	UID         string         `json:"uid"`
	Name        string         `json:"name"`
	DisplayName string         `json:"display_name"`
	Description string         `json:"description"`
	Digest      string         `json:"digest"`
	Mode        string         `json:"mode"`
	Sensitive   bool           `json:"sensitive"`
	Delimiters  []string       `json:"delimiters,omitempty"`
	Version     int            `json:"version"`
	Managed     bool           `json:"managed"`
	Keys        []string       `json:"keys"`
	Sizes       map[string]int `json:"sizes"`
	CreatedAt   time.Time      `json:"created_at"`
	UpdatedAt   time.Time      `json:"updated_at"`
}

Config content never comes back on list or get, only keys, sizes and the digest.

type ConfigReveal added in v0.10.0

type ConfigReveal struct {
	Data map[string]string `json:"data"`
}

type ConnectionInfo added in v0.10.0

type ConnectionInfo struct {
	Host     string `json:"host"`
	Port     int    `json:"port"`
	Username string `json:"username"`
	Password string `json:"password"`
	Database string `json:"database"`
	URI      string `json:"uri"`
}

type CreateAppRequest added in v0.10.0

type CreateAppRequest struct {
	DisplayName string   `json:"display_name"`
	Name        string   `json:"name,omitempty"`
	ServerID    uint     `json:"server_id,omitempty"`
	SourceType  string   `json:"source_type,omitempty"`
	Image       string   `json:"image,omitempty"`
	Tag         string   `json:"tag,omitempty"`
	GitRepo     string   `json:"git_repo,omitempty"`
	GitRef      string   `json:"git_ref,omitempty"`
	BuildMethod string   `json:"build_method,omitempty"`
	Port        int      `json:"port,omitempty"`
	Command     []string `json:"command,omitempty"`
}

CreateAppRequest: the server derives Name from DisplayName when Name is empty.

type CreateConfigRequest added in v0.10.0

type CreateConfigRequest struct {
	Name        string            `json:"name"`
	DisplayName string            `json:"display_name,omitempty"`
	Description string            `json:"description,omitempty"`
	Data        map[string]string `json:"data"`
	Mode        string            `json:"mode,omitempty"`
	Sensitive   bool              `json:"sensitive,omitempty"`
	Delimiters  []string          `json:"delimiters,omitempty"`
}

type CreateDatabaseRequest added in v0.10.0

type CreateDatabaseRequest struct {
	Name     string `json:"name"`
	Engine   string `json:"engine"`
	Version  string `json:"version,omitempty"`
	ServerID uint   `json:"server_id,omitempty"`
	SizeMB   int    `json:"size_mb,omitempty"`
}

type CreateLogicalDatabaseRequest added in v0.10.0

type CreateLogicalDatabaseRequest struct {
	Name          string `json:"name"`
	ApplicationID *uint  `json:"application_id"`
}

type CreateLogicalDatabaseResult added in v0.10.0

type CreateLogicalDatabaseResult struct {
	Database    LogicalDatabase `json:"database"`
	EnvInjected bool            `json:"env_injected"`
}

type CreateSecretRequest added in v0.10.0

type CreateSecretRequest struct {
	Name        string `json:"name"`
	Value       string `json:"value"`
	Description string `json:"description,omitempty"`
}

type CreateVolumeRequest added in v0.12.0

type CreateVolumeRequest struct {
	Name     string `json:"name"`
	ServerID uint   `json:"server_id,omitempty"`
	SizeMB   int    `json:"size_mb,omitempty"`
	// DriverOpts are the backend's mount options (NFS/CIFS: device, o; host: path), encrypted and never returned.
	Driver     string            `json:"driver,omitempty"`
	DriverOpts map[string]string `json:"driver_opts,omitempty"`
}

CreateVolumeRequest is final: a volume has no update endpoint.

type DatabaseInstance added in v0.10.0

type DatabaseInstance struct {
	ID          uint      `json:"id"`
	Name        string    `json:"name"`
	DisplayName string    `json:"display_name"`
	Engine      string    `json:"engine"`
	Version     string    `json:"version"`
	Status      string    `json:"status"`
	ServerID    uint      `json:"server_id"`
	ServerName  string    `json:"server_name,omitempty"`
	Host        string    `json:"host"`
	Port        int       `json:"port"`
	AdminUser   string    `json:"admin_user"`
	SizeBytes   int64     `json:"size_bytes,omitempty"`
	NetworkName string    `json:"network_name,omitempty"`
	CreatedAt   time.Time `json:"created_at"`
}

type DeployRequest

type DeployRequest struct {
	Tag        string `json:"tag,omitempty"`
	Strategy   string `json:"strategy,omitempty"`
	RegistryID *uint  `json:"registry_id,omitempty"`
	// NoCache rebuilds every layer for this deploy only (git-source apps).
	NoCache bool `json:"no_cache,omitempty"`
}

DeployRequest carries no image (the app owns it), only a tag/registry/strategy override.

type DeployResult added in v0.17.0

type DeployResult struct {
	Kind       string       `json:"kind"` // deployment | pipeline_run
	Deployment *Deployment  `json:"deployment,omitempty"`
	Run        *PipelineRun `json:"run,omitempty"`
	// WaitTimedOut is set when the server was asked to wait and gave up first.
	WaitTimedOut bool `json:"wait_timed_out,omitempty"`
}

DeployResult sets exactly one of Deployment and Run: a repo-owned pipeline deploys by running it.

type Deployment

type Deployment struct {
	ID uint `json:"id"`
	// Number is the per-app number users see; ID is the durable key API paths use.
	Number        int        `json:"number"`
	ApplicationID uint       `json:"application_id"`
	Status        string     `json:"status"`
	Image         string     `json:"image"`
	Trigger       string     `json:"trigger"`
	Strategy      string     `json:"strategy"`
	Error         string     `json:"error"`
	StartedAt     *time.Time `json:"started_at"`
	FinishedAt    *time.Time `json:"finished_at"`
	CreatedAt     time.Time  `json:"created_at"`
	Current       bool       `json:"current"`
}

type EngineDefault added in v0.10.0

type EngineDefault struct {
	Engine  string `json:"engine"`
	Image   string `json:"image"`
	Version string `json:"version"`
}

type EnvVar added in v0.10.0

type EnvVar struct {
	Key      string `json:"key"`
	Value    string `json:"value"`
	IsSecret bool   `json:"is_secret"`
}

The server masks secret values, so Value is never their plaintext.

type Event added in v0.17.0

type Event struct {
	ID            uint              `json:"id"`
	SubjectType   string            `json:"subject_type,omitempty"`
	ApplicationID uint              `json:"application_id,omitempty"`
	DatabaseID    uint              `json:"database_id,omitempty"`
	Type          string            `json:"type"`
	Severity      string            `json:"severity"`
	Message       string            `json:"message"`
	Metadata      map[string]string `json:"metadata,omitempty"`
	AppName       string            `json:"app_name,omitempty"`
	DatabaseName  string            `json:"database_name,omitempty"`
	CreatedAt     time.Time         `json:"created_at"`
}

Event.AppName is only filled on the workspace-wide feed.

type ImportEnvRequest

type ImportEnvRequest struct {
	Content  string `json:"content"`
	IsSecret bool   `json:"is_secret"`
}

type ImportStackRequest added in v0.23.0

type ImportStackRequest struct {
	Name    string `json:"name"`
	Compose string `json:"compose"`
	// Env is the .env content: it fills ${VAR} references and is what env_file: .env loads.
	Env      string `json:"env,omitempty"`
	Location string `json:"location,omitempty"`
}

type LinkDatabaseRequest added in v0.18.0

type LinkDatabaseRequest struct {
	EnvPrefix string            `json:"env_prefix,omitempty"`
	EnvMap    map[string]string `json:"env_map,omitempty"`
}

LinkDatabaseRequest.EnvMap renames a connection field's env var; an empty name skips that field.

type LinkDatabaseResult added in v0.18.0

type LinkDatabaseResult struct {
	EnvInjected bool     `json:"env_injected"`
	EnvVars     []string `json:"env_vars"`
}

type LogicalDatabase added in v0.10.0

type LogicalDatabase struct {
	ID            uint              `json:"id"`
	InstanceID    uint              `json:"instance_id"`
	Name          string            `json:"name"`
	Username      string            `json:"username"`
	Status        string            `json:"status"`
	ApplicationID *uint             `json:"application_id"`
	EnvPrefix     string            `json:"env_prefix,omitempty"`
	EnvMap        map[string]string `json:"env_map,omitempty"`
	EnvVars       []string          `json:"env_vars,omitempty"`
	SizeBytes     int64             `json:"size_bytes,omitempty"`
	CreatedAt     time.Time         `json:"created_at"`
}

type LoginToken added in v0.10.0

type LoginToken struct {
	Token     string `json:"token"`
	ServerURL string `json:"server_url"`
	ExpiresAt string `json:"expires_at"`
}

type Me

type Me struct {
	ID       uint   `json:"id"`
	Name     string `json:"name"`
	Username string `json:"username"`
	Email    string `json:"email"`
	Role     string `json:"role"`
	Auth     struct {
		Method      string   `json:"method"`       // api_key | jwt
		APIKeyID    *uint    `json:"api_key_id"`   // when method=api_key
		WorkspaceID *uint    `json:"workspace_id"` // set only for workspace-bound keys
		Scopes      []string `json:"scopes"`
	} `json:"auth"`
}

type Migration added in v0.16.0

type Migration struct {
	ID       uint          `json:"id"`
	AppName  string        `json:"app_name"`
	Status   string        `json:"status"`
	Phase    string        `json:"phase"`
	Plan     MigrationPlan `json:"plan"`
	Progress struct {
		Items []struct {
			Kind   string `json:"kind"`
			Name   string `json:"name"`
			Status string `json:"status"`
			Bytes  int64  `json:"bytes"`
			Total  int64  `json:"total"`
		} `json:"items"`
		EstimatedDowntimeSeconds int    `json:"estimated_downtime_seconds"`
		Message                  string `json:"message"`
	} `json:"progress"`
	Report struct {
		Notes []string `json:"notes"`
	} `json:"report"`
	Error         string     `json:"error"`
	FinalizeAfter *time.Time `json:"finalize_after"`
	CreatedAt     time.Time  `json:"created_at"`
}

type MigrationDBChoice added in v0.16.0

type MigrationDBChoice struct {
	InstanceID       uint   `json:"instance_id"`
	Strategy         string `json:"strategy"`
	TargetInstanceID uint   `json:"target_instance_id,omitempty"`
}

type MigrationDBItem added in v0.16.0

type MigrationDBItem struct {
	InstanceID   uint     `json:"instance_id"`
	InstanceName string   `json:"instance_name"`
	Engine       string   `json:"engine"`
	Version      string   `json:"version"`
	Exclusive    bool     `json:"exclusive"`
	Strategies   []string `json:"strategies"`
	Strategy     string   `json:"strategy"`
}

type MigrationExport added in v0.22.0

type MigrationExport struct {
	ID         uint      `json:"id"`
	Workspace  string    `json:"workspace"`
	Status     string    `json:"status"`
	Phase      string    `json:"phase,omitempty"`
	Error      string    `json:"error,omitempty"`
	Freeze     bool      `json:"freeze"`
	Data       bool      `json:"data"`
	Completed  bool      `json:"completed"`
	ImportedBy string    `json:"imported_by,omitempty"`
	CreatedAt  time.Time `json:"created_at"`
}

type MigrationImport added in v0.22.0

type MigrationImport struct {
	MigrationSource
	SourceWorkspace string `json:"source_workspace,omitempty"`
	NewWorkspace    string `json:"new_workspace,omitempty"`
	RestoreData     bool   `json:"restore_data"`
	DeployApps      bool   `json:"deploy_apps"`
	Freeze          bool   `json:"freeze"`
	Rehearse        bool   `json:"rehearse"`
	RetireSource    bool   `json:"retire_source"`
}

type MigrationIssue added in v0.16.0

type MigrationIssue struct {
	Code     string `json:"code"`
	Message  string `json:"message"`
	Resource string `json:"resource,omitempty"`
}

type MigrationOverview added in v0.22.0

type MigrationOverview struct {
	Enabled      bool              `json:"enabled"`
	Window       *MigrationWindow  `json:"window"`
	Frozen       bool              `json:"frozen"`
	FrozenReason string            `json:"frozen_reason,omitempty"`
	Exports      []MigrationExport `json:"exports"`
	URL          string            `json:"url,omitempty"`
}

type MigrationPlan added in v0.16.0

type MigrationPlan struct {
	Location      string `json:"location"`
	LocationLabel string `json:"location_label"`
	Volumes       []struct {
		VolumeID     uint   `json:"volume_id"`
		Name         string `json:"name"`
		Action       string `json:"action"`
		UsedBytes    int64  `json:"used_bytes"`
		StorageClass string `json:"storage_class"`
	} `json:"volumes"`
	Databases []MigrationDBItem `json:"databases"`
	Blockers  []MigrationIssue  `json:"blockers"`
	Warnings  []MigrationIssue  `json:"warnings"`
	CopyBytes int64             `json:"copy_bytes"`
}

type MigrationProbe added in v0.22.0

type MigrationProbe struct {
	InstallID string `json:"install_id"`
	Version   string `json:"version"`
	Schema    int    `json:"schema"`
	// CodeWorkspace is the workspace a workspace code was started for; empty for an instance code.
	CodeWorkspace string               `json:"code_workspace,omitempty"`
	Workspaces    []MigrationWorkspace `json:"workspaces"`
}

type MigrationReportItem added in v0.22.0

type MigrationReportItem struct {
	Kind   string `json:"kind"`
	Name   string `json:"name"`
	Action string `json:"action"`
	Detail string `json:"detail,omitempty"`
}

type MigrationRun added in v0.22.0

type MigrationRun struct {
	ID                uint   `json:"id"`
	WorkspaceID       uint   `json:"workspace_id"`
	TargetWorkspaceID uint   `json:"target_workspace_id,omitempty"`
	Ref               string `json:"ref,omitempty"`
	Status            string `json:"status"`
	Phase             string `json:"phase,omitempty"`
	SourceWorkspace   string `json:"source_workspace,omitempty"`
	RestoreData       bool   `json:"restore_data"`
	DeployApps        bool   `json:"deploy_apps"`
	Artifacts         int    `json:"artifacts"`
	SizeBytes         int64  `json:"size_bytes"`
	Report            struct {
		Items []MigrationReportItem `json:"items,omitempty"`
		Notes []string              `json:"notes,omitempty"`
	} `json:"report"`
	Migration *struct {
		SourceURL      string `json:"source_url,omitempty"`
		SourceVersion  string `json:"source_version,omitempty"`
		Freeze         bool   `json:"freeze,omitempty"`
		Rehearse       bool   `json:"rehearse,omitempty"`
		RetireSource   bool   `json:"retire_source,omitempty"`
		SourceRetired  bool   `json:"source_retired,omitempty"`
		SourceUnfrozen bool   `json:"source_unfrozen,omitempty"`
		BatchID        string `json:"batch_id,omitempty"`
	} `json:"migration,omitempty"`
	Error      string     `json:"error,omitempty"`
	StartedAt  *time.Time `json:"started_at"`
	FinishedAt *time.Time `json:"finished_at"`
	CreatedAt  time.Time  `json:"created_at"`
}

type MigrationSource added in v0.22.0

type MigrationSource struct {
	Code        string `json:"code"`
	InsecureTLS bool   `json:"insecure_skip_tls_verify"`
	CABundle    string `json:"ca_bundle,omitempty"`
}

MigrationSource.CABundle is PEM text, not a path.

type MigrationStartRequest added in v0.22.0

type MigrationStartRequest struct {
	ExpiresInHours int `json:"expires_in_hours,omitempty"`
}

type MigrationStarted added in v0.22.0

type MigrationStarted struct {
	Code      string    `json:"code"`
	SourceURL string    `json:"source_url,omitempty"`
	Workspace string    `json:"workspace,omitempty"`
	ExpiresAt time.Time `json:"expires_at"`
}

MigrationStarted is an open migration as started; Code is shown only once.

type MigrationStatus added in v0.22.0

type MigrationStatus struct {
	Enabled bool   `json:"enabled"`
	URL     string `json:"url,omitempty"`
}

MigrationStatus is GET /migrations/status: whether MIABI_MIGRATION_ENABLED is set on a server.

type MigrationWindow added in v0.22.0

type MigrationWindow struct {
	StartedAt  time.Time  `json:"started_at"`
	ExpiresAt  *time.Time `json:"expires_at"`
	LastUsedAt *time.Time `json:"last_used_at"`
}

type MigrationWorkspace added in v0.22.0

type MigrationWorkspace struct {
	Name        string `json:"name"`
	DisplayName string `json:"display_name,omitempty"`
	Frozen      bool   `json:"frozen,omitempty"`
	Apps        int    `json:"apps"`
	Databases   int    `json:"databases"`
	Volumes     int    `json:"volumes"`
	SizeBytes   int64  `json:"size_bytes"`
}

type Options added in v0.10.0

type Options struct {
	BaseURL      string
	Token        string
	CAFile       string
	InsecureSkip bool
	Verbose      bool
}

type OverviewApp added in v0.17.0

type OverviewApp struct {
	ID     uint   `json:"id"`
	Name   string `json:"name"`
	Status string `json:"status"`
	Health string `json:"health"` // healthy | unhealthy | unknown
}

type Pipeline added in v0.11.0

type Pipeline struct {
	ID          uint      `json:"id"`
	Name        string    `json:"name"`
	DisplayName string    `json:"display_name"`
	Enabled     bool      `json:"enabled"`
	Source      string    `json:"source,omitempty"` // manual | repo
	CreatedAt   time.Time `json:"created_at"`
}

type PipelineRun added in v0.11.0

type PipelineRun struct {
	ID         uint       `json:"id"`
	PipelineID uint       `json:"pipeline_id"`
	Number     int        `json:"number"`
	Status     string     `json:"status"`
	Trigger    string     `json:"trigger,omitempty"`
	Branch     string     `json:"branch,omitempty"`
	Commit     string     `json:"commit,omitempty"`
	Version    string     `json:"version,omitempty"`
	ImageTag   string     `json:"image_tag,omitempty"`
	NoCache    bool       `json:"no_cache,omitempty"`
	Error      string     `json:"error,omitempty"`
	StartedAt  *time.Time `json:"started_at,omitempty"`
	FinishedAt *time.Time `json:"finished_at,omitempty"`
	CreatedAt  time.Time  `json:"created_at"`
}

type Plan

type Plan struct {
	Changes []Change `json:"changes"`
}

type Release

type Release struct {
	ID            uint      `json:"id"`
	ApplicationID uint      `json:"application_id"`
	DeploymentID  uint      `json:"deployment_id"`
	Version       int       `json:"version"`
	Image         string    `json:"image"`
	Active        bool      `json:"active"`
	Digest        *string   `json:"digest"`
	CreatedAt     time.Time `json:"created_at"`
}

type RerunPipelineRequest added in v0.11.0

type RerunPipelineRequest struct {
	NoCache bool `json:"no_cache,omitempty"`
}

type ResyncPipelineResult added in v0.10.0

type ResyncPipelineResult struct {
	Pipeline *struct {
		Name       string `json:"name"`
		SourcePath string `json:"source_path"`
		SourceRef  string `json:"source_ref"`
	} `json:"pipeline"`
	Changed bool `json:"changed"`
	Adopted bool `json:"adopted"`
}

ResyncPipelineResult.Changed is false when the stored document already matched: a no-op, not a failure.

type RollbackRequest

type RollbackRequest struct {
	ReleaseID uint `json:"release_id"`
}

type ScopeError added in v0.17.0

type ScopeError struct {
	*APIError
	Scope string
}

ScopeError is a 403 for a missing API key scope, not the caller's workspace role.

func (*ScopeError) Error added in v0.17.0

func (e *ScopeError) Error() string

func (*ScopeError) Unwrap added in v0.17.0

func (e *ScopeError) Unwrap() error

type SealingKey added in v0.19.0

type SealingKey struct {
	Version   int    `json:"version"`
	PublicKey string `json:"public_key"`
}

type Secret added in v0.10.0

type Secret struct {
	ID          uint   `json:"id"`
	UID         string `json:"uid"`
	Name        string `json:"name"`
	DisplayName string `json:"display_name"`
	Description string `json:"description"`
	// Version bumps on each value rotation.
	Version int `json:"version"`
	// Managed secrets belong to a platform resource; rotate them via the owner, not by hand.
	Managed bool `json:"managed"`
	// SealedKeyVersion is set when the value came from a sealed value in a manifest.
	SealedKeyVersion int       `json:"sealed_key_version,omitempty"`
	CreatedAt        time.Time `json:"created_at"`
	UpdatedAt        time.Time `json:"updated_at"`
}

Secret values are write-only over the API; Name is the handle env refs use (${{ secrets.NAME }}).

type SecretReveal added in v0.10.0

type SecretReveal struct {
	Value string `json:"value"`
}

type SecretUsage added in v0.10.0

type SecretUsage struct {
	ID   uint   `json:"id"`
	Name string `json:"name"`
}

type SetAppSourceRequest added in v0.10.0

type SetAppSourceRequest struct {
	SourceType string `json:"source_type"`

	Image      string `json:"image,omitempty"`
	Tag        string `json:"tag,omitempty"`
	RegistryID *uint  `json:"registry_id,omitempty"`

	GitRepo         string `json:"git_repo,omitempty"`
	GitRef          string `json:"git_ref,omitempty"`
	GitRepositoryID *uint  `json:"git_repository_id,omitempty"`
	BuildMethod     string `json:"build_method,omitempty"`
	Builder         string `json:"builder,omitempty"`
}

SetAppSourceRequest is a whole-source replacement; the server clears the other source's fields.

type SetAppSourceResult added in v0.10.0

type SetAppSourceResult struct {
	Application App          `json:"application"`
	Change      SourceChange `json:"change"`
}

type SetEnvRequest

type SetEnvRequest struct {
	Key      string `json:"key"`
	Value    string `json:"value"`
	IsSecret bool   `json:"is_secret"`
}

type SourceChange added in v0.10.0

type SourceChange struct {
	From string `json:"from"`
	To   string `json:"to"`
	// Switched is false when only the details changed (a new tag, a different branch).
	Switched bool `json:"switched"`
	// PipelineRemoved is true when leaving git dropped a repo-owned pipeline.
	PipelineRemoved bool `json:"pipeline_removed"`
	// RedeployRequired is true when the running container no longer matches the source.
	RedeployRequired bool `json:"redeploy_required"`
}

SourceChange is worth surfacing: none of it shows in the app record afterwards.

type Stack added in v0.23.0

type Stack struct {
	ID          uint      `json:"id"`
	UID         string    `json:"uid,omitempty"`
	Name        string    `json:"name"`
	DisplayName string    `json:"display_name"`
	Description string    `json:"description,omitempty"`
	ClusterID   uint      `json:"cluster_id"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
	Apps        []App     `json:"apps,omitempty"`
}

type StackDeployResult added in v0.23.0

type StackDeployResult struct {
	AppID        uint   `json:"app_id"`
	AppName      string `json:"app_name"`
	Status       string `json:"status"`
	DeploymentID uint   `json:"deployment_id,omitempty"`
	Error        string `json:"error,omitempty"`
}

StackDeployResult is one member app's outcome; Status is queued or failed.

type StackImportResult added in v0.23.0

type StackImportResult struct {
	Stack         *Stack              `json:"stack"`
	Created       []string            `json:"created"`
	Volumes       []string            `json:"volumes"`
	PortRequests  int                 `json:"port_requests"`
	PortConflicts []StackPortConflict `json:"port_conflicts"`
	Skipped       []StackImportSkip   `json:"skipped"`
	Warnings      []string            `json:"warnings"`
}

type StackImportSkip added in v0.23.0

type StackImportSkip struct {
	Service string `json:"service"`
	Reason  string `json:"reason"`
}

type StackListItem added in v0.23.0

type StackListItem struct {
	Stack
	AppCount int64             `json:"app_count"`
	Status   StackStatusCounts `json:"status"`
}

type StackPortConflict added in v0.23.0

type StackPortConflict struct {
	Service  string `json:"service"`
	HostPort int    `json:"host_port"`
	Protocol string `json:"protocol"`
	UsedBy   string `json:"used_by"`
}

type StackStatusCounts added in v0.23.0

type StackStatusCounts struct {
	Total   int `json:"total"`
	Running int `json:"running"`
	Stopped int `json:"stopped"`
	Failed  int `json:"failed"`
	Other   int `json:"other"`
}

type StartMigration added in v0.16.0

type StartMigration struct {
	Location      string              `json:"location"`
	Databases     []MigrationDBChoice `json:"databases,omitempty"`
	CutoverMode   string              `json:"cutover_mode,omitempty"`
	BandwidthKBps int                 `json:"bandwidth_kbps,omitempty"`
}

type TrafficSummary added in v0.17.0

type TrafficSummary struct {
	Totals struct {
		Requests     int64   `json:"requests"`
		ErrorRate    float64 `json:"error_rate"` // 0..1
		AvgLatencyMS float64 `json:"avg_latency_ms"`
		P95LatencyMS float64 `json:"p95_latency_ms"`
		P99LatencyMS float64 `json:"p99_latency_ms"`
	} `json:"totals"`
	Status struct {
		S2xx int64 `json:"s2xx"`
		S3xx int64 `json:"s3xx"`
		S4xx int64 `json:"s4xx"`
		S5xx int64 `json:"s5xx"`
	} `json:"status"`
}

type TriggerPipelineRequest added in v0.11.0

type TriggerPipelineRequest struct {
	Branch  string `json:"branch,omitempty"`
	Commit  string `json:"commit,omitempty"`
	NoCache bool   `json:"no_cache,omitempty"`
	// Bump (patch|minor|major) or Version (exact, admins only) override this run's version.
	Bump    string `json:"bump,omitempty"`
	Version string `json:"version,omitempty"`
}

type UpdateConfigRequest added in v0.10.0

type UpdateConfigRequest struct {
	Data        map[string]string `json:"data,omitempty"`
	DisplayName string            `json:"display_name,omitempty"`
	Description string            `json:"description,omitempty"`
	Mode        string            `json:"mode,omitempty"`
	Delimiters  []string          `json:"delimiters,omitempty"`
}

type UpdateSecretRequest added in v0.10.0

type UpdateSecretRequest struct {
	Value       string `json:"value"`
	Description string `json:"description"`
}

UpdateSecretRequest: a blank Value keeps the stored value; a new one rotates the secret.

type UpgradeDatabaseRequest added in v0.10.0

type UpgradeDatabaseRequest struct {
	Version  string `json:"version"`
	StopApps bool   `json:"stop_apps,omitempty"`
}

type VerifyResult added in v0.15.0

type VerifyResult struct {
	Ref        string   `json:"ref"`
	OK         bool     `json:"ok"`
	Checked    int      `json:"checked"`
	Missing    []string `json:"missing,omitempty"`
	Resized    []string `json:"resized,omitempty"`
	EnvelopeOK bool     `json:"envelope_ok"`
	Error      string   `json:"error,omitempty"`
}

type VersionAllocation added in v0.21.0

type VersionAllocation struct {
	Version    string    `json:"version"`
	Tag        string    `json:"tag"`
	Series     string    `json:"series,omitempty"`
	Branch     string    `json:"branch,omitempty"`
	Prerelease bool      `json:"prerelease"`
	Status     string    `json:"status"`
	RunNumber  int       `json:"run_number,omitempty"`
	Digest     string    `json:"digest,omitempty"`
	Note       string    `json:"note,omitempty"`
	CreatedAt  time.Time `json:"created_at"`
}

type VersionBranches added in v0.21.0

type VersionBranches struct {
	Release []string          `json:"release,omitempty"`
	Others  string            `json:"others,omitempty"`
	Series  map[string]string `json:"series,omitempty"`
}

type VersionPolicy added in v0.21.0

type VersionPolicy struct {
	ID              uint              `json:"id"`
	UID             string            `json:"uid"`
	Scheme          string            `json:"scheme"`
	Template        string            `json:"template"`
	Series          string            `json:"series,omitempty"`
	Bump            string            `json:"bump"`
	Start           string            `json:"start,omitempty"`
	CalverFormat    string            `json:"calver_format,omitempty"`
	ReleaseBranches []string          `json:"release_branches,omitempty"`
	OtherBranches   string            `json:"other_branches"`
	BranchSeries    map[string]string `json:"branch_series,omitempty"`
	FloatingTags    []string          `json:"floating_tags,omitempty"`
	BumpFromCommits bool              `json:"bump_from_commits"`
	ManagedBy       string            `json:"managed_by,omitempty"`
	Current         string            `json:"current,omitempty"`
	OwnerKind       string            `json:"owner_kind,omitempty"`
	Repository      string            `json:"repository,omitempty"`
	Next            string            `json:"next,omitempty"`
}

func (VersionPolicy) Settings added in v0.21.0

func (p VersionPolicy) Settings() VersionSettings

type VersionSettings added in v0.21.0

type VersionSettings struct {
	Scheme          string          `json:"scheme"`
	Template        string          `json:"template,omitempty"`
	Series          string          `json:"series,omitempty"`
	Bump            string          `json:"bump,omitempty"`
	Start           string          `json:"start,omitempty"`
	CalverFormat    string          `json:"calver_format,omitempty"`
	Branches        VersionBranches `json:"branches"`
	FloatingTags    []string        `json:"floating_tags,omitempty"`
	BumpFromCommits bool            `json:"bump_from_commits,omitempty"`
}

type Volume added in v0.12.0

type Volume struct {
	ID          uint   `json:"id"`
	UID         string `json:"uid"`
	Name        string `json:"name"`
	DisplayName string `json:"display_name"`
	// DockerName is the underlying Docker volume, which is not the handle.
	DockerName string `json:"docker_name"`
	// ServerID 0 is the local control-plane node.
	ServerID       uint       `json:"server_id"`
	ServerName     string     `json:"server_name,omitempty"`
	Mountpoint     string     `json:"mountpoint,omitempty"`
	SizeBytes      int64      `json:"size_bytes"`
	UsedBytes      int64      `json:"used_bytes"`
	UsedMeasuredAt *time.Time `json:"used_measured_at,omitempty"`
	// Driver is local (rwo) or nfs | cifs | host (rwx).
	Driver     string `json:"driver"`
	AccessMode string `json:"access_mode"`
	HostPath   string `json:"host_path,omitempty"`
	// Imported marks a volume that adopted a pre-existing external Docker volume.
	Imported  bool      `json:"imported"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

Volume.UsedBytes is measured, SizeBytes declared; a nil UsedMeasuredAt means never measured, not empty.

type VolumeBackup added in v0.12.0

type VolumeBackup struct {
	ID          uint `json:"id"`
	WorkspaceID uint `json:"workspace_id"`
	VolumeID    uint `json:"volume_id"`
	ServerID    uint `json:"server_id"`
	// VolumeName is the Docker volume that was archived, not the handle.
	VolumeName string `json:"volume_name"`
	Status     string `json:"status"`  // pending | running | completed | failed
	Trigger    string `json:"trigger"` // manual | scheduled
	S3Bucket   string `json:"s3_bucket,omitempty"`
	S3Path     string `json:"s3_path,omitempty"`
	Filename   string `json:"filename,omitempty"`
	SizeBytes  int64  `json:"size_bytes"`
	// Logs is the tail the record carries; the full log is a separate download.
	Logs       string     `json:"logs,omitempty"`
	Error      string     `json:"error,omitempty"`
	StartedAt  *time.Time `json:"started_at,omitempty"`
	FinishedAt *time.Time `json:"finished_at,omitempty"`
	CreatedAt  time.Time  `json:"created_at"`

	// Ref names a recovery point (Enterprise); empty on a plain archive.
	Ref          string     `json:"ref,omitempty"`
	Consistency  string     `json:"consistency,omitempty"` // hot
	Encrypted    bool       `json:"encrypted"`
	Pinned       bool       `json:"pinned"`
	VerifiedAt   *time.Time `json:"verified_at,omitempty"`
	VerifyStatus string     `json:"verify_status,omitempty"` // ok | failed; empty = never
	VerifyError  string     `json:"verify_error,omitempty"`
}

type VolumeBackupStatus added in v0.12.0

type VolumeBackupStatus struct {
	S3Configured bool `json:"s3_configured"`
	Entitled     bool `json:"entitled"`
	Mutable      bool `json:"mutable"`
	Sealing      bool `json:"sealing"`
}

type VolumeDetail added in v0.12.0

type VolumeDetail struct {
	// Inlined for yaml.v3, which otherwise nests the anonymous struct under "volume"; encoding/json flattens it.
	Volume `yaml:",inline"`
	Exists bool          `json:"exists"`
	InUse  bool          `json:"in_use"`
	UsedBy []VolumeUsage `json:"used_by"`
}

type VolumeFile added in v0.12.0

type VolumeFile struct {
	Path    string `json:"path"`
	Size    int64  `json:"size"`
	ModTime int64  `json:"mod_time"`
	IsDir   bool   `json:"is_dir"`
}

VolumeFile paths are relative to the volume root; ModTime is unix seconds; directories report size 0.

type VolumeUploadResult added in v0.12.0

type VolumeUploadResult struct {
	Path string `json:"path"`
}

type VolumeUsage added in v0.12.0

type VolumeUsage struct {
	AppID          uint   `json:"app_id"`
	AppName        string `json:"app_name"`
	AppDisplayName string `json:"app_display_name"`
	Path           string `json:"path"`
}

type Workspace

type Workspace struct {
	ID          uint   `json:"id"`
	UID         string `json:"uid"`
	Name        string `json:"name"`
	DisplayName string `json:"display_name"`
	Role        string `json:"role"`
}

type WorkspaceOverview added in v0.17.0

type WorkspaceOverview struct {
	Apps         []OverviewApp `json:"apps"`
	TotalApps    int           `json:"total_apps"`
	Running      int           `json:"running"`
	Failed       int           `json:"failed"`
	Databases    int           `json:"databases"`
	Stacks       int           `json:"stacks"`
	RecentEvents []Event       `json:"recent_events"`
}

type WorkspaceStorage added in v0.12.0

type WorkspaceStorage struct {
	DeclaredBytes int64      `json:"declared_bytes"`
	UsedBytes     int64      `json:"used_bytes"`
	LimitMB       int        `json:"limit_mb"`
	MeasuredAt    *time.Time `json:"measured_at,omitempty"`
	VolumeCount   int64      `json:"volume_count"`
}

WorkspaceStorage.LimitMB is -1 when unlimited.

Jump to

Keyboard shortcuts

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