Documentation
¶
Index ¶
- Variables
- func FormatDeployment(d *cobaltapi.Deployment) string
- func FormatDeploymentID(d cobaltapi.Deployment) string
- type APIError
- type Client
- func (c *Client) AddDomain(ctx context.Context, project string, req cobaltapi.DomainAddRequest) (*cobaltapi.Domain, error)
- func (c *Client) CancelDeployment(ctx context.Context, id int64) error
- func (c *Client) CreateAPIKey(ctx context.Context, req cobaltapi.APIKeyCreateRequest) (*cobaltapi.APIKeyCreateResponse, error)
- func (c *Client) CreateDeployment(ctx context.Context, project string, req cobaltapi.DeploymentCreateRequest) (*cobaltapi.DeploymentCreateResponse, error)
- func (c *Client) CreatePendingApp(ctx context.Context, req cobaltapi.PendingAppCreateRequest) (*cobaltapi.PendingAppCreateResponse, error)
- func (c *Client) CreateProject(ctx context.Context, req cobaltapi.ProjectCreateRequest) (*cobaltapi.Project, error)
- func (c *Client) CreateRollback(ctx context.Context, project string, req cobaltapi.RollbackRequest) (*cobaltapi.Deployment, error)
- func (c *Client) CreateUpgrade(ctx context.Context, req cobaltapi.ServerUpgradeRequest) (*cobaltapi.ServerUpgrade, error)
- func (c *Client) DeleteAPIKey(ctx context.Context, id int64) error
- func (c *Client) DeleteEnvVar(ctx context.Context, project, key string, redeploy bool) error
- func (c *Client) DeleteProject(ctx context.Context, name string) error
- func (c *Client) DeployOutput(ctx context.Context, deploymentID int64, offset int64) (*http.Response, error)
- func (c *Client) DeployOutputURL(deploymentID int64, offset int64) string
- func (c *Client) ExportVolume(ctx context.Context, project, volume string) (*http.Response, error)
- func (c *Client) FindAppByOwner(ctx context.Context, owner string) (*cobaltapi.GithubApp, error)
- func (c *Client) GetDeployment(ctx context.Context, id int64) (*cobaltapi.Deployment, error)
- func (c *Client) GetEnvVar(ctx context.Context, project, key string) (*cobaltapi.EnvVar, error)
- func (c *Client) GetMetaInfo(ctx context.Context) (*cobaltapi.MetaInfo, error)
- func (c *Client) GetProject(ctx context.Context, name string) (*cobaltapi.Project, error)
- func (c *Client) GetScale(ctx context.Context, project string) (*cobaltapi.ScaleInfo, error)
- func (c *Client) GetUpgrade(ctx context.Context, id string) (*cobaltapi.ServerUpgrade, error)
- func (c *Client) ImportVolume(ctx context.Context, project, volume string, data []byte) (*http.Response, error)
- func (c *Client) ListAPIKeys(ctx context.Context) ([]cobaltapi.APIKey, error)
- func (c *Client) ListApps(ctx context.Context) ([]cobaltapi.GithubApp, error)
- func (c *Client) ListCommandRuns(ctx context.Context, project string, limit int) ([]cobaltapi.CommandRun, error)
- func (c *Client) ListDeployments(ctx context.Context, project string, limit int) ([]cobaltapi.Deployment, error)
- func (c *Client) ListDomains(ctx context.Context, project string) ([]cobaltapi.Domain, error)
- func (c *Client) ListEnvVars(ctx context.Context, project string) ([]cobaltapi.EnvVar, error)
- func (c *Client) ListProjectCrons(ctx context.Context, project string) ([]cobaltapi.ProjectCron, error)
- func (c *Client) ListProjects(ctx context.Context) ([]cobaltapi.Project, error)
- func (c *Client) ListRepos(ctx context.Context) ([]cobaltapi.GithubAppRepo, error)
- func (c *Client) ListVolumes(ctx context.Context, project string) ([]cobaltapi.Volume, error)
- func (c *Client) LogsSSE(ctx context.Context, project string, service string) (*http.Response, error)
- func (c *Client) MostRecentDeployment(ctx context.Context, project string) (*cobaltapi.Deployment, error)
- func (c *Client) MostRecentInFlightDeployment(ctx context.Context, project string) (*cobaltapi.Deployment, error)
- func (c *Client) PostBytes(ctx context.Context, path string, data []byte) (*http.Response, error)
- func (c *Client) PostRaw(ctx context.Context, path string, contentType string, body io.Reader) (*http.Response, error)
- func (c *Client) PruneApps(ctx context.Context) (*cobaltapi.PruneResponse, error)
- func (c *Client) RemoveDomain(ctx context.Context, project, domain string) error
- func (c *Client) RenameProject(ctx context.Context, name string, req cobaltapi.ProjectRenameRequest) (*cobaltapi.Project, error)
- func (c *Client) RunWS(ctx context.Context, project, command, service string, tty bool) (*websocket.Conn, string, error)
- func (c *Client) ServerStats(ctx context.Context) (cobaltapi.ServerStats, error)
- func (c *Client) ServerStatsSSE(ctx context.Context) (*http.Response, error)
- func (c *Client) SetEnvVars(ctx context.Context, project string, req cobaltapi.EnvSetRequest) ([]cobaltapi.EnvVar, error)
- func (c *Client) SetMetaHost(ctx context.Context, host string) (*cobaltapi.MetaInfo, error)
- func (c *Client) SetScale(ctx context.Context, project string, req cobaltapi.ScaleSetRequest) (*cobaltapi.ScaleInfo, error)
- func (c *Client) StreamGet(ctx context.Context, path string) (*http.Response, error)
- func (c *Client) UpdateProjectSource(ctx context.Context, name string, req cobaltapi.ProjectUpdateSourceRequest) (*cobaltapi.Project, error)
- func (c *Client) UpgradeDaemon(ctx context.Context, req UpgradeDaemonRequest) error
- func (c *Client) UpgradeOutput(ctx context.Context, id string) (*http.Response, error)
- type UpgradeDaemonRequest
Constants ¶
This section is empty.
Variables ¶
var OpenBrowser = browser.OpenURL
Functions ¶
func FormatDeployment ¶
func FormatDeployment(d *cobaltapi.Deployment) string
func FormatDeploymentID ¶
func FormatDeploymentID(d cobaltapi.Deployment) string
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CancelDeployment ¶
func (*Client) CreateAPIKey ¶
func (c *Client) CreateAPIKey(ctx context.Context, req cobaltapi.APIKeyCreateRequest) (*cobaltapi.APIKeyCreateResponse, error)
func (*Client) CreateDeployment ¶
func (c *Client) CreateDeployment(ctx context.Context, project string, req cobaltapi.DeploymentCreateRequest) (*cobaltapi.DeploymentCreateResponse, error)
func (*Client) CreatePendingApp ¶
func (c *Client) CreatePendingApp(ctx context.Context, req cobaltapi.PendingAppCreateRequest) (*cobaltapi.PendingAppCreateResponse, error)
func (*Client) CreateProject ¶
func (*Client) CreateRollback ¶ added in v0.6.0
func (c *Client) CreateRollback(ctx context.Context, project string, req cobaltapi.RollbackRequest) (*cobaltapi.Deployment, error)
CreateRollback enqueues a rollback to the previous successful deployment (req.To = 0) or to a specific deployment number (req.To > 0). Returns the new queued deployment row.
func (*Client) CreateUpgrade ¶ added in v0.9.0
func (c *Client) CreateUpgrade(ctx context.Context, req cobaltapi.ServerUpgradeRequest) (*cobaltapi.ServerUpgrade, error)
CreateUpgrade triggers a self-upgrade on the daemon. Returns the upgrade row's metadata (id + initial status); follow the actual progress via FollowUpgradeOutput.
func (*Client) DeleteEnvVar ¶
func (*Client) DeleteProject ¶
func (*Client) DeployOutput ¶
func (*Client) DeployOutputURL ¶
func (*Client) ExportVolume ¶
func (*Client) FindAppByOwner ¶
func (*Client) GetDeployment ¶
func (*Client) GetMetaInfo ¶
func (*Client) GetProject ¶
func (*Client) GetUpgrade ¶ added in v0.9.0
GetUpgrade fetches the current state of an upgrade row. Used post-stream to read the terminal status (which the SSE close doesn't carry — only the bytes of the log do).
func (*Client) ImportVolume ¶
func (*Client) ListAPIKeys ¶
func (*Client) ListCommandRuns ¶ added in v0.4.0
func (c *Client) ListCommandRuns(ctx context.Context, project string, limit int) ([]cobaltapi.CommandRun, error)
ListCommandRuns returns the project's `cobalt run` audit log, newest first. limit caps the result; pass 0 for the server's default (50).
func (*Client) ListDeployments ¶
func (*Client) ListDomains ¶
func (*Client) ListEnvVars ¶
func (*Client) ListProjectCrons ¶ added in v0.6.0
func (c *Client) ListProjectCrons(ctx context.Context, project string) ([]cobaltapi.ProjectCron, error)
ListProjectCrons returns the cron services currently registered for a project, with each one's next-fire time.
func (*Client) ListProjects ¶
func (*Client) ListVolumes ¶
func (*Client) MostRecentDeployment ¶
func (*Client) MostRecentInFlightDeployment ¶
func (*Client) RemoveDomain ¶
func (*Client) RenameProject ¶
func (*Client) RunWS ¶
func (c *Client) RunWS(ctx context.Context, project, command, service string, tty bool) (*websocket.Conn, string, error)
RunWS opens the cobalt-run WebSocket. Subprotocol negotiation: the daemon advertises both v2 and v1; we offer v2 first, falling back to v1 only if a (very) old server doesn't speak v2. The returned subprotocol tells the caller which framer to use.
tty controls whether ?tty=1 is added to the URL — the daemon then allocates a real PTY for the container and bridges its master end. Only meaningful in v2; v1 servers ignore the flag.
func (*Client) ServerStats ¶ added in v1.1.0
ServerStats fetches one host + per-container usage snapshot. Blocks ~2s: the daemon gives docker a CPU sampling window.
func (*Client) ServerStatsSSE ¶ added in v1.1.0
ServerStatsSSE opens the live snapshot stream (one ServerStats JSON event every ~2s). The caller owns resp.Body.
func (*Client) SetEnvVars ¶
func (*Client) SetMetaHost ¶
func (*Client) UpdateProjectSource ¶ added in v0.16.0
func (*Client) UpgradeDaemon ¶
func (c *Client) UpgradeDaemon(ctx context.Context, req UpgradeDaemonRequest) error
type UpgradeDaemonRequest ¶
type UpgradeDaemonRequest struct {
Image string `json:"image,omitempty"`
}