api

package
v0.38.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package api is the HTTP client for the Volcano cloud API.

Index

Constants

View Source
const (

	// DefaultPage is the first page fetched by paginated API callers.
	DefaultPage = 1
	// DefaultLimit is the default number of resources fetched per page.
	DefaultLimit = 100
)
View Source
const (

	// CLIInstructionSuggestionVersionUpgrade signals a newer CLI is published; non-blocking.
	CLIInstructionSuggestionVersionUpgrade = "suggestion_version_upgrade"
	// CLIInstructionRequireVersionUpgrade signals this CLI version is no longer
	// supported. The API pairs it with an HTTP 426 on non-exempt routes.
	CLIInstructionRequireVersionUpgrade = "require_version_upgrade"

	// CLIInstructionLowCreditWarning signals the account's credit balance is
	// low; non-blocking. CLIInstructionNotEnoughCredit signals the account has
	// no credit left; the request itself is blocked by the API's own error
	// response (this instruction only adds explanatory context, it does not
	// gate anything CLI-side).
	CLIInstructionLowCreditWarning = "low_credit_warning"
	CLIInstructionNotEnoughCredit  = "not_enough_credit"

	// DeviceInstructionReauth signals the platform token needs re-authentication.
	DeviceInstructionReauth = "reauth"
)

Header names and instruction values for the CLI version protocol. This is the CLI's HTTP wire contract and is duplicated here because this repository has no shared Go module with the API. The claimed version is advisory input only and never a privilege: the CLI cannot make this request header trustworthy, and it does not use the value to grant authority.

Variables

View Source
var ErrNotFound = errors.New("not found")

ErrNotFound is returned by resolver lookups when no matching resource exists. Callers branch on it with errors.Is(err, api.ErrNotFound).

Functions

func DebugEnabled added in v0.4.0

func DebugEnabled() bool

DebugEnabled reports whether API tracing is on.

func Message added in v0.31.0

func Message(err error) string

Message returns the API's own message for the *Error wrapped in err, or "" if err is nil, does not wrap an *Error, or carries no message. Callers that act on which refusal a status stands for need the body, not just the code.

func ResetLastInstructionsForTest added in v0.1.0

func ResetLastInstructionsForTest()

ResetLastInstructionsForTest clears the process-global instructions state. Test-only: production never needs this, since each CLI invocation is a fresh process. Call it between test cases that expect LastInstructions() to start from the zero value — recordInstructions is intentionally sticky (see its doc comment): a response that omits a field never clears a previously recorded value for it, so tests must reset explicitly rather than relying on an unrelated response to clear prior state.

func ResetLastRefusalForTest added in v0.31.0

func ResetLastRefusalForTest()

ResetLastRefusalForTest clears the process-global refusal state. Test-only: each CLI invocation is a fresh process.

func SetDebug added in v0.4.0

func SetDebug(on bool)

SetDebug enables or disables API request/response tracing to stderr.

func Status

func Status(err error) int

Status returns the HTTP status code carried by an *Error wrapped in err, or 0 if err is nil or does not wrap an *Error.

func WebSignupURL added in v0.0.4

func WebSignupURL(webURL, email, next string) (string, error)

WebSignupURL builds the Volcano Web signup URL used by the CLI signup flow. next must be a same-origin relative path: Volcano Web's signup page rejects any next value that isn't (see isSafeInternalPath in volcano-web).

Types

type AccessTokenCreateInput added in v0.31.0

type AccessTokenCreateInput struct {
	Name      string
	Scope     string
	ExpiresAt *time.Time
}

AccessTokenCreateInput contains one project access token mint request.

type AccessTokenListInput added in v0.31.0

type AccessTokenListInput struct {
	Page           int
	Limit          int
	Search         string
	IncludeRevoked bool
}

AccessTokenListInput contains one project access token page request.

type Client

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

Client is a thin wrapper around the generated OpenAPI client.

func NewClient

func NewClient(apiURL, token string, opts ...Option) (*Client, error)

NewClient constructs a generated client with auth and error-normalization helpers.

func (*Client) ApplyProjectConfig added in v0.0.5

func (c *Client) ApplyProjectConfig(ctx context.Context, projectID uuid.UUID, manifestJSON []byte, dryRun bool) (*apiclient.ProjectConfigApplyResult, error)

ApplyProjectConfig uploads a full configuration manifest (pre-encoded JSON) and returns the server's per-resource apply report.

func (*Client) ConnectProjectGit added in v0.22.0

ConnectProjectGit binds a project to a repository. It is a full replace: it only binds, and never creates or deletes anything on the git provider.

func (*Client) CopyStorageObject

func (c *Client) CopyStorageObject(ctx context.Context, bucketName, from, to string) (*apiclient.StorageObject, error)

CopyStorageObject copies one object within a bucket.

func (*Client) CreateAccessToken added in v0.31.0

func (c *Client) CreateAccessToken(ctx context.Context, projectID uuid.UUID, input AccessTokenCreateInput) (*apiclient.CreatedProjectAccessToken, error)

CreateAccessToken mints one project access token. The response carries the plaintext secret, which the API returns only here.

func (*Client) CreateAnonKey added in v0.34.0

func (c *Client) CreateAnonKey(ctx context.Context, projectID uuid.UUID, name string) (*apiclient.AnonKey, error)

CreateAnonKey creates a publishable key with the server's auth-only default.

func (*Client) CreateDatabase

func (c *Client) CreateDatabase(ctx context.Context, projectID uuid.UUID, name, region, pgVersion, databaseType string) (*apiclient.Database, error)

CreateDatabase creates a database in a project.

func (*Client) CreateDatabaseBackup added in v0.23.0

func (c *Client) CreateDatabaseBackup(ctx context.Context, projectID uuid.UUID, databaseName, backupName string) (*apiclient.DatabaseBackup, error)

CreateDatabaseBackup captures the database as it is now.

func (*Client) CreateDatabaseBranch added in v0.21.0

func (c *Client) CreateDatabaseBranch(ctx context.Context, projectID uuid.UUID, databaseName, branchName string, ttlSeconds *int64) (*apiclient.DatabaseBranch, error)

CreateDatabaseBranch forks a branch off a database. The branch returns before it is connectable; poll GetDatabaseBranch until it reports active.

func (*Client) CreateDatabaseRestore added in v0.23.0

func (c *Client) CreateDatabaseRestore(ctx context.Context, projectID uuid.UUID, databaseName string, backupName *string, restoreTo *time.Time) (*apiclient.DatabaseRestore, error)

CreateDatabaseRestore replaces a database's data, either from a named backup or from its state at a point in time. Exactly one of backupName and restoreTo must be set. The restore returns before it finishes; the database is not connectable until it reports completed.

func (*Client) CreateDurableFunctionScheduler added in v0.26.0

func (c *Client) CreateDurableFunctionScheduler(
	ctx context.Context, projectID uuid.UUID, function string, input FunctionSchedulerInput,
) (*apiclient.FunctionScheduler, error)

CreateDurableFunctionScheduler creates one scheduler for a durable function. Each tick starts an execution rather than invoking the function.

func (*Client) CreateFrontendCustomDomain

func (c *Client) CreateFrontendCustomDomain(ctx context.Context, projectID, frontendID uuid.UUID, input FrontendCustomDomainInput) (*apiclient.FrontendCustomDomainResponse, error)

CreateFrontendCustomDomain attaches a BYOC custom domain to a frontend.

func (*Client) CreateFunctionScheduler

func (c *Client) CreateFunctionScheduler(ctx context.Context, projectID, functionID uuid.UUID, input FunctionSchedulerInput) (*apiclient.FunctionScheduler, error)

CreateFunctionScheduler creates one scheduler for a function.

func (*Client) CreateProject

func (c *Client) CreateProject(ctx context.Context, name, templateID string) (*apiclient.Project, error)

CreateProject creates a project for the authenticated user.

func (*Client) CreateSandboxTemplate added in v0.38.0

func (c *Client) CreateSandboxTemplate(ctx context.Context, project, key uuid.UUID, body apiclient.CreateSandboxTemplateRequest) (*apiclient.SandboxTemplate, error)

CreateSandboxTemplate calls the Sandbox CreateSandbox operation.

func (*Client) CreateServiceKey added in v0.0.4

func (c *Client) CreateServiceKey(ctx context.Context, projectID uuid.UUID, name string, permissions []string) (*apiclient.ServiceKey, error)

CreateServiceKey creates one service key in a project. When permissions is non-empty the key is scoped to exactly those operations; otherwise the server grants full access (["*"]).

func (*Client) CreateStorageBucket

func (c *Client) CreateStorageBucket(ctx context.Context, projectID uuid.UUID, input StorageBucketCreateInput) (*apiclient.StorageBucket, error)

CreateStorageBucket creates one bucket in the project.

func (*Client) CreateStoragePolicy

func (c *Client) CreateStoragePolicy(ctx context.Context, projectID uuid.UUID, bucketName string, input StoragePolicyCreateInput) (*apiclient.StoragePolicy, error)

CreateStoragePolicy attaches a new policy to a bucket.

func (*Client) CreateVariable

func (c *Client) CreateVariable(ctx context.Context, projectID uuid.UUID, name, value string) (*apiclient.Variable, error)

CreateVariable creates a variable in a project.

func (*Client) DeleteDatabase

func (c *Client) DeleteDatabase(ctx context.Context, projectID uuid.UUID, databaseName string) error

DeleteDatabase deletes one database by name.

func (*Client) DeleteDatabaseBackup added in v0.23.0

func (c *Client) DeleteDatabaseBackup(ctx context.Context, projectID uuid.UUID, databaseName, backupName string) error

DeleteDatabaseBackup deletes one backup by name.

func (*Client) DeleteDatabaseBranch added in v0.21.0

func (c *Client) DeleteDatabaseBranch(ctx context.Context, projectID uuid.UUID, databaseName, branchName string) error

DeleteDatabaseBranch deletes one branch by name.

func (*Client) DeleteDurableFunction added in v0.26.0

func (c *Client) DeleteDurableFunction(ctx context.Context, projectID uuid.UUID, function string) error

DeleteDurableFunction starts deleting one durable function by ID or name.

func (*Client) DeleteDurableFunctionScheduler added in v0.26.0

func (c *Client) DeleteDurableFunctionScheduler(
	ctx context.Context, projectID uuid.UUID, function string, schedulerID uuid.UUID,
) error

DeleteDurableFunctionScheduler deletes one scheduler of a durable function.

func (*Client) DeleteFrontend

func (c *Client) DeleteFrontend(ctx context.Context, projectID, frontendID uuid.UUID) error

DeleteFrontend starts deleting one frontend by ID.

func (*Client) DeleteFrontendCustomDomain

func (c *Client) DeleteFrontendCustomDomain(ctx context.Context, projectID, frontendID uuid.UUID) error

DeleteFrontendCustomDomain detaches the configured custom domain from a frontend.

func (*Client) DeleteFunction

func (c *Client) DeleteFunction(ctx context.Context, projectID, functionID uuid.UUID) error

DeleteFunction starts deleting one function by ID.

func (*Client) DeleteFunctionScheduler

func (c *Client) DeleteFunctionScheduler(ctx context.Context, projectID, functionID, schedulerID uuid.UUID) error

DeleteFunctionScheduler deletes one scheduler for a function.

func (*Client) DeleteProject

func (c *Client) DeleteProject(ctx context.Context, projectID uuid.UUID) error

DeleteProject starts project deletion.

func (*Client) DeleteSandboxTemplate added in v0.38.0

func (c *Client) DeleteSandboxTemplate(ctx context.Context, project, id uuid.UUID) error

DeleteSandboxTemplate calls the Sandbox DeleteSandbox operation.

func (*Client) DeleteStorageBucket

func (c *Client) DeleteStorageBucket(ctx context.Context, projectID uuid.UUID, bucketName string) error

DeleteStorageBucket removes one bucket from the project.

func (*Client) DeleteStorageObject

func (c *Client) DeleteStorageObject(ctx context.Context, bucketName, path string) error

DeleteStorageObject removes one object from a bucket.

func (*Client) DeleteStoragePolicy

func (c *Client) DeleteStoragePolicy(ctx context.Context, projectID uuid.UUID, bucketName string, policyID uuid.UUID) error

DeleteStoragePolicy removes one policy from a bucket.

func (*Client) DeleteVariable

func (c *Client) DeleteVariable(ctx context.Context, projectID uuid.UUID, name string) error

DeleteVariable deletes one variable by name.

func (*Client) DeployDurableFunction added in v0.26.0

func (c *Client) DeployDurableFunction(ctx context.Context, projectID uuid.UUID, fn DurableFunctionDeployInput) (*apiclient.DurableFunction, error)

DeployDurableFunction deploys one durable function source archive. It creates the function on the first call for a name and redeploys it after that.

func (*Client) DeployFrontend

func (c *Client) DeployFrontend(ctx context.Context, projectID uuid.UUID, input FrontendDeployInput) (*apiclient.Frontend, error)

DeployFrontend uploads one frontend source archive.

func (*Client) DeployFunction

func (c *Client) DeployFunction(ctx context.Context, projectID uuid.UUID, fn FunctionDeployInput) (*apiclient.Function, error)

DeployFunction deploys one function source archive.

func (*Client) DeployFunctionsBatch

func (c *Client) DeployFunctionsBatch(ctx context.Context, projectID uuid.UUID, functions []FunctionDeployInput) (*apiclient.BatchFunctionDeployResponse, error)

DeployFunctionsBatch deploys one batch of function source archives.

func (*Client) DisconnectProjectGit added in v0.22.0

func (c *Client) DisconnectProjectGit(ctx context.Context, projectID uuid.UUID) error

DisconnectProjectGit removes a project's repo connection. The repository itself is untouched.

func (*Client) DownloadStorageObject

func (c *Client) DownloadStorageObject(ctx context.Context, bucketName, path string) (*http.Response, error)

DownloadStorageObject opens a streaming download for one object. The caller is responsible for closing the response body.

func (*Client) ExchangePlatformToken

func (c *Client) ExchangePlatformToken(ctx context.Context, authAccessToken, clientID string) (*apiclient.PlatformExchangeResponse, error)

ExchangePlatformToken exchanges an auth-user device-flow token for a platform token.

func (*Client) ExecSandbox added in v0.38.0

ExecSandbox calls the Sandbox ExecuteSandbox operation.

func (*Client) ExecSandboxSession added in v0.38.0

func (c *Client) ExecSandboxSession(ctx context.Context, id, key uuid.UUID, body apiclient.SandboxCommandRequest) (*apiclient.SandboxCommandResult, error)

ExecSandboxSession calls the Sandbox ExecuteSandboxSession operation.

func (*Client) GetAccessToken added in v0.31.0

func (c *Client) GetAccessToken(ctx context.Context, projectID, tokenID uuid.UUID) (*apiclient.ProjectAccessToken, error)

GetAccessToken returns one project access token by ID.

func (*Client) GetAccessTokenUsage added in v0.31.0

func (c *Client) GetAccessTokenUsage(ctx context.Context, projectID, tokenID uuid.UUID, days int) (*apiclient.ProjectAccessTokenUsage, error)

GetAccessTokenUsage returns the daily request counts for one project access token.

func (*Client) GetDatabase

func (c *Client) GetDatabase(ctx context.Context, projectID uuid.UUID, databaseName string) (*apiclient.Database, error)

GetDatabase returns one database by name.

func (*Client) GetDatabaseBackup added in v0.23.0

func (c *Client) GetDatabaseBackup(ctx context.Context, projectID uuid.UUID, databaseName, backupName string) (*apiclient.DatabaseBackup, error)

GetDatabaseBackup returns one backup by name.

func (*Client) GetDatabaseBackupSchedule added in v0.23.0

func (c *Client) GetDatabaseBackupSchedule(ctx context.Context, projectID uuid.UUID, databaseName string) (*apiclient.DatabaseBackupSchedule, error)

GetDatabaseBackupSchedule returns the database's automated backup schedule.

func (*Client) GetDatabaseBranch added in v0.21.0

func (c *Client) GetDatabaseBranch(ctx context.Context, projectID uuid.UUID, databaseName, branchName string) (*apiclient.DatabaseBranch, error)

GetDatabaseBranch returns one branch by name.

func (*Client) GetDatabaseRestore added in v0.23.0

func (c *Client) GetDatabaseRestore(ctx context.Context, projectID uuid.UUID, databaseName string, restoreID uuid.UUID) (*apiclient.DatabaseRestore, error)

GetDatabaseRestore returns one restore by id, scoped to the database, so a restore id belonging to another database reads as not found.

func (*Client) GetDurableExecution added in v0.26.0

func (c *Client) GetDurableExecution(
	ctx context.Context, projectID uuid.UUID, function string, executionID uuid.UUID,
) (*apiclient.DurableExecution, error)

GetDurableExecution returns one durable execution, including its result once it has finished.

func (*Client) GetDurableFunction added in v0.26.0

func (c *Client) GetDurableFunction(ctx context.Context, projectID uuid.UUID, function string) (*apiclient.DurableFunction, error)

GetDurableFunction returns one durable function by ID or name.

func (*Client) GetFrontend

func (c *Client) GetFrontend(ctx context.Context, projectID, frontendID uuid.UUID) (*apiclient.Frontend, error)

GetFrontend returns one frontend by ID.

func (*Client) GetFrontendCustomDomain

func (c *Client) GetFrontendCustomDomain(ctx context.Context, projectID, frontendID uuid.UUID) (*apiclient.FrontendCustomDomainResponse, error)

GetFrontendCustomDomain returns the configured custom domain for a frontend.

func (*Client) GetFrontendDeploymentLogs

func (c *Client) GetFrontendDeploymentLogs(ctx context.Context, projectID, frontendID, deploymentID uuid.UUID, limit int, cursor string) (*apiclient.LogSearchResponse, error)

GetFrontendDeploymentLogs returns one build log search page for a frontend deployment.

func (*Client) GetFrontendLogs

func (c *Client) GetFrontendLogs(ctx context.Context, projectID, frontendID uuid.UUID, limit int, cursor string) (*apiclient.LogSearchResponse, error)

GetFrontendLogs returns one runtime log search page for a frontend.

func (*Client) GetFunction

func (c *Client) GetFunction(ctx context.Context, projectID, functionID uuid.UUID) (*apiclient.Function, error)

GetFunction returns one function by ID.

func (*Client) GetFunctionDeploymentLogs

func (c *Client) GetFunctionDeploymentLogs(ctx context.Context, projectID, functionID, deploymentID uuid.UUID, limit int, cursor string) (*apiclient.LogSearchResponse, error)

GetFunctionDeploymentLogs returns one build log search page for a function deployment.

func (*Client) GetFunctionLogs

func (c *Client) GetFunctionLogs(ctx context.Context, projectID, functionID uuid.UUID, limit int, cursor string) (*apiclient.LogSearchResponse, error)

GetFunctionLogs returns one runtime log search page for a function.

func (*Client) GetProject

func (c *Client) GetProject(ctx context.Context, projectID uuid.UUID) (*apiclient.Project, error)

GetProject returns one project by ID.

func (*Client) GetProjectConfigYAML added in v0.0.5

func (c *Client) GetProjectConfigYAML(ctx context.Context, projectID uuid.UUID) ([]byte, error)

GetProjectConfigYAML downloads the project configuration as the canonical YAML manifest rendered by the server, returned verbatim.

func (*Client) GetProjectGitConnection added in v0.22.0

func (c *Client) GetProjectGitConnection(ctx context.Context, projectID uuid.UUID) (*apiclient.ProjectGitConnection, error)

GetProjectGitConnection returns a project's repo connection. A project with no connection answers 404, which surfaces as an *Error carrying that status.

func (*Client) GetProjectGitDeploySettings added in v0.22.0

func (c *Client) GetProjectGitDeploySettings(ctx context.Context, projectID uuid.UUID) (*apiclient.ProjectGitDeploySettings, error)

GetProjectGitDeploySettings returns what a push to the connected repo's production branch deploys.

func (*Client) GetProjectUsage added in v0.34.0

func (c *Client) GetProjectUsage(ctx context.Context, projectID uuid.UUID) (*apiclient.ProjectUsageResponse, error)

GetProjectUsage returns aggregate usage for a project. The response also contains hourly and daily series; callers choose whether a command contract needs to render those details.

func (*Client) GetServiceKey added in v0.0.4

func (c *Client) GetServiceKey(ctx context.Context, projectID, keyID uuid.UUID) (*apiclient.ServiceKey, error)

GetServiceKey returns one service key by ID.

func (*Client) GetStorageBucket

func (c *Client) GetStorageBucket(ctx context.Context, projectID uuid.UUID, bucketName string) (*apiclient.StorageBucket, error)

GetStorageBucket returns one bucket by name.

func (*Client) GetStorageStats

func (c *Client) GetStorageStats(ctx context.Context, projectID uuid.UUID) (*apiclient.StorageStats, error)

GetStorageStats returns aggregate storage statistics for a project.

func (*Client) GetVariable

func (c *Client) GetVariable(ctx context.Context, projectID uuid.UUID, name string) (*apiclient.Variable, error)

GetVariable returns one variable by name.

func (*Client) InvokeFunction added in v0.0.4

func (c *Client) InvokeFunction(ctx context.Context, functionID uuid.UUID, input FunctionInvokeInput) (*apiclient.FunctionInvocationResponse, error)

InvokeFunction invokes one function by ID.

func (*Client) ListAccessTokens added in v0.31.0

func (c *Client) ListAccessTokens(ctx context.Context, projectID uuid.UUID, input AccessTokenListInput) (*apiclient.PaginatedProjectAccessTokens, error)

ListAccessTokens lists one project access token page.

func (*Client) ListAccessTokensUsage added in v0.31.0

func (c *Client) ListAccessTokensUsage(ctx context.Context, projectID uuid.UUID, days int) ([]apiclient.ProjectAccessTokenUsage, error)

ListAccessTokensUsage returns the daily request counts for every access token in a project, revoked tokens included.

func (*Client) ListAnonKeys added in v0.5.0

func (c *Client) ListAnonKeys(ctx context.Context, projectID uuid.UUID) ([]apiclient.AnonKey, error)

ListAnonKeys lists a project's anon keys — the publishable JWTs that go in the frontend/SDK Authorization header (the value an app build needs).

func (*Client) ListDatabaseBackups added in v0.23.0

func (c *Client) ListDatabaseBackups(ctx context.Context, projectID uuid.UUID, databaseName string) (*apiclient.DatabaseBackupList, error)

ListDatabaseBackups returns a database's backups along with the window a point-in-time restore may target.

func (*Client) ListDatabaseBranches added in v0.21.0

func (c *Client) ListDatabaseBranches(ctx context.Context, projectID uuid.UUID, databaseName string) ([]apiclient.DatabaseBranch, error)

ListDatabaseBranches returns every branch of a database.

func (*Client) ListDatabaseRestores added in v0.23.0

func (c *Client) ListDatabaseRestores(ctx context.Context, projectID uuid.UUID, databaseName string) (*apiclient.DatabaseRestoreList, error)

ListDatabaseRestores returns a database's restore history, newest first. This route keeps answering while a restore is running, which is the point of it.

func (*Client) ListDatabases

func (c *Client) ListDatabases(ctx context.Context, projectID uuid.UUID, page, limit int) (*apiclient.PaginatedDatabases, error)

ListDatabases lists one database page for a project.

func (*Client) ListDurableExecutions added in v0.26.0

func (c *Client) ListDurableExecutions(
	ctx context.Context, projectID uuid.UUID, function, status string, page, limit int,
) (*apiclient.PaginatedDurableExecutions, error)

ListDurableExecutions lists one execution page for a durable function. The statuses each entry carries are the last the platform observed rather than live state; fetch a single execution for that.

func (*Client) ListDurableFunctionSchedulers added in v0.26.0

func (c *Client) ListDurableFunctionSchedulers(
	ctx context.Context, projectID uuid.UUID, function string,
) (*apiclient.FunctionSchedulerListResponse, error)

ListDurableFunctionSchedulers lists schedulers for a durable function.

func (*Client) ListDurableFunctions added in v0.26.0

func (c *Client) ListDurableFunctions(ctx context.Context, projectID uuid.UUID, page, limit int) (*apiclient.PaginatedDurableFunctions, error)

ListDurableFunctions lists one durable function page for a project.

func (*Client) ListFrontendDeployments

func (c *Client) ListFrontendDeployments(ctx context.Context, projectID, frontendID uuid.UUID, page, limit int) (*apiclient.PaginatedFrontendDeployments, error)

ListFrontendDeployments lists one deployment page for a frontend.

func (*Client) ListFrontends

func (c *Client) ListFrontends(ctx context.Context, projectID uuid.UUID, page, limit int) (*apiclient.PaginatedFrontends, error)

ListFrontends lists one frontend page for a project.

func (*Client) ListFunctionDeployments

func (c *Client) ListFunctionDeployments(ctx context.Context, projectID, functionID uuid.UUID, page, limit int) (*apiclient.PaginatedFunctionDeployments, error)

ListFunctionDeployments lists one deployment page for a function.

func (*Client) ListFunctionRuntimes

func (c *Client) ListFunctionRuntimes(ctx context.Context) ([]apiclient.FunctionRuntimeOption, error)

ListFunctionRuntimes returns the function runtime catalog.

func (*Client) ListFunctionSchedulers

func (c *Client) ListFunctionSchedulers(ctx context.Context, projectID, functionID uuid.UUID) (*apiclient.FunctionSchedulerListResponse, error)

ListFunctionSchedulers lists schedulers for a function.

func (*Client) ListFunctions

func (c *Client) ListFunctions(ctx context.Context, projectID uuid.UUID, page, limit int) (*apiclient.PaginatedFunctions, error)

ListFunctions lists one function page for a project.

func (*Client) ListGitConnections added in v0.22.0

func (c *Client) ListGitConnections(ctx context.Context) ([]apiclient.GitConnection, error)

ListGitConnections returns the caller's stored git provider connections.

func (*Client) ListGitInstallationRepositories added in v0.22.0

func (c *Client) ListGitInstallationRepositories(ctx context.Context, connectionID uuid.UUID, installationID int64) ([]apiclient.GitRepository, error)

ListGitInstallationRepositories returns the repos reachable through one installation.

func (*Client) ListGitInstallations added in v0.22.0

func (c *Client) ListGitInstallations(ctx context.Context, connectionID uuid.UUID) ([]apiclient.GitInstallation, error)

ListGitInstallations returns the GitHub App installations a connection can reach. This is a live proxy to GitHub; nothing is persisted by the call.

func (*Client) ListProjects

func (c *Client) ListProjects(ctx context.Context, page, limit int) (*apiclient.PaginatedProjects, error)

ListProjects lists one project page for the authenticated user.

func (*Client) ListServiceKeys added in v0.0.4

func (c *Client) ListServiceKeys(ctx context.Context, projectID uuid.UUID, page, limit int) (*apiclient.PaginatedServiceKeys, error)

ListServiceKeys returns one service-key page for a project.

func (*Client) ListStorageBuckets

func (c *Client) ListStorageBuckets(ctx context.Context, projectID uuid.UUID) ([]apiclient.StorageBucket, error)

ListStorageBuckets returns every bucket in the project.

func (*Client) ListStorageObjects

func (c *Client) ListStorageObjects(ctx context.Context, bucketName string, opts StorageObjectListOptions) (*apiclient.StorageListResponse, error)

ListStorageObjects returns one cursor page of objects in a bucket.

func (*Client) ListStoragePolicies

func (c *Client) ListStoragePolicies(ctx context.Context, projectID uuid.UUID, bucketName string) ([]apiclient.StoragePolicy, error)

ListStoragePolicies returns every policy attached to a bucket.

func (*Client) ListVariables

func (c *Client) ListVariables(ctx context.Context, projectID uuid.UUID, page, limit int) (*apiclient.PaginatedVariables, error)

ListVariables lists one variable page for a project.

func (*Client) MoveStorageObject

func (c *Client) MoveStorageObject(ctx context.Context, bucketName, from, to string) (*apiclient.StorageObject, error)

MoveStorageObject renames one object within a bucket.

func (*Client) PollDeviceToken

func (c *Client) PollDeviceToken(ctx context.Context, clientID, deviceCode string) (*DeviceTokenPollResult, error)

PollDeviceToken polls the OAuth device token endpoint once.

func (*Client) ReadSandboxFile added in v0.38.0

ReadSandboxFile calls the Sandbox ReadSandboxSessionFile operation.

func (*Client) RedeployFrontend

func (c *Client) RedeployFrontend(ctx context.Context, projectID, frontendID uuid.UUID) (*apiclient.Frontend, error)

RedeployFrontend starts a new deployment using the last uploaded archive.

func (*Client) RenameProject added in v0.25.0

func (c *Client) RenameProject(ctx context.Context, projectID uuid.UUID, name string) (*apiclient.Project, error)

RenameProject changes a project's name.

func (*Client) ResetDatabaseBranch added in v0.21.0

func (c *Client) ResetDatabaseBranch(ctx context.Context, projectID uuid.UUID, databaseName, branchName string) (*apiclient.DatabaseBranch, error)

ResetDatabaseBranch discards a branch's changes and re-forks it from the parent's current state. The rewind runs in the background, so the branch comes back provisioning; poll GetDatabaseBranch until it reports active.

func (*Client) ResetDatabaseBranchPassword added in v0.21.0

func (c *Client) ResetDatabaseBranchPassword(ctx context.Context, projectID uuid.UUID, databaseName, branchName string) (*apiclient.DatabaseBranch, error)

ResetDatabaseBranchPassword rotates the branch role's password and returns the branch carrying the new connection string.

func (*Client) ResumeSandbox added in v0.38.0

func (c *Client) ResumeSandbox(ctx context.Context, id uuid.UUID) (*apiclient.SandboxSession, error)

ResumeSandbox calls the Sandbox ResumeSandboxSession operation.

func (*Client) RevokeAccessToken added in v0.31.0

func (c *Client) RevokeAccessToken(ctx context.Context, projectID, tokenID uuid.UUID) error

RevokeAccessToken revokes one project access token by ID.

func (*Client) SandboxAccess added in v0.38.0

SandboxAccess calls the Sandbox CreateSandboxSessionAccess operation.

func (*Client) SandboxPresets added in v0.38.0

func (c *Client) SandboxPresets(ctx context.Context) (*apiclient.SandboxPresetList, error)

SandboxPresets calls the Sandbox ListSandboxPresets operation.

func (*Client) SandboxSession added in v0.38.0

func (c *Client) SandboxSession(ctx context.Context, id uuid.UUID) (*apiclient.SandboxSession, error)

SandboxSession calls the Sandbox GetSandboxSession operation.

func (*Client) SandboxSessions added in v0.38.0

func (c *Client) SandboxSessions(ctx context.Context, project uuid.UUID, params *apiclient.ListSandboxSessionsParams) (*apiclient.SandboxSessionPage, error)

SandboxSessions calls the Sandbox ListSandboxSessions operation.

func (*Client) SandboxTemplate added in v0.38.0

func (c *Client) SandboxTemplate(ctx context.Context, project, id uuid.UUID) (*apiclient.SandboxTemplate, error)

SandboxTemplate calls the Sandbox GetSandbox operation.

func (*Client) SandboxTemplates added in v0.38.0

func (c *Client) SandboxTemplates(ctx context.Context, project uuid.UUID, params *apiclient.ListSandboxesParams) (*apiclient.SandboxTemplatePage, error)

SandboxTemplates calls the Sandbox ListSandboxes operation.

func (*Client) SetStorageObjectVisibility

func (c *Client) SetStorageObjectVisibility(ctx context.Context, bucketName, path string, isPublic bool) (*apiclient.StorageObject, error)

SetStorageObjectVisibility updates the public/private flag for one object.

func (*Client) StartDeviceAuthorization

func (c *Client) StartDeviceAuthorization(ctx context.Context, clientID string) (*apiclient.DeviceAuthorizationResponse, error)

StartDeviceAuthorization starts the OAuth device authorization flow.

func (*Client) StartDurableExecution added in v0.26.0

func (c *Client) StartDurableExecution(
	ctx context.Context, projectID uuid.UUID, function string, input DurableExecutionStartInput,
) (*apiclient.DurableExecution, error)

StartDurableExecution starts one durable execution and returns its handle. A durable execution outlives any request that could wait for it, so this never carries a result.

func (*Client) StartSandbox added in v0.38.0

func (c *Client) StartSandbox(ctx context.Context, project, key uuid.UUID, body apiclient.CreateSandboxSessionRequest) (*apiclient.SandboxSession, error)

StartSandbox calls the Sandbox CreateSandboxSession operation.

func (*Client) StopDurableExecution added in v0.26.0

func (c *Client) StopDurableExecution(
	ctx context.Context, projectID uuid.UUID, function string, executionID uuid.UUID,
) (*apiclient.DurableExecution, error)

StopDurableExecution stops one durable execution. Completed steps are not undone; the execution stops where it is.

func (*Client) StreamFrontendDeploymentLogs added in v0.0.4

func (c *Client) StreamFrontendDeploymentLogs(ctx context.Context, projectID, frontendID, deploymentID uuid.UUID, limit int, lastEventID string) (*ProjectLogStream, error)

StreamFrontendDeploymentLogs opens a build log stream for a frontend deployment.

func (*Client) StreamFrontendLogs added in v0.0.4

func (c *Client) StreamFrontendLogs(ctx context.Context, projectID, frontendID uuid.UUID, limit int, lastEventID string) (*ProjectLogStream, error)

StreamFrontendLogs opens a runtime log stream for a frontend.

func (*Client) StreamFunctionDeploymentLogs added in v0.0.4

func (c *Client) StreamFunctionDeploymentLogs(ctx context.Context, projectID, functionID, deploymentID uuid.UUID, limit int, lastEventID string) (*ProjectLogStream, error)

StreamFunctionDeploymentLogs opens a build log stream for a function deployment.

func (*Client) StreamFunctionLogs added in v0.0.4

func (c *Client) StreamFunctionLogs(ctx context.Context, projectID, functionID uuid.UUID, limit int, lastEventID string) (*ProjectLogStream, error)

StreamFunctionLogs opens a runtime log stream for a function.

func (*Client) SuspendSandbox added in v0.38.0

func (c *Client) SuspendSandbox(ctx context.Context, id uuid.UUID) (*apiclient.SandboxSession, error)

SuspendSandbox calls the Sandbox SuspendSandboxSession operation.

func (*Client) TerminateSandbox added in v0.38.0

func (c *Client) TerminateSandbox(ctx context.Context, id uuid.UUID) (*apiclient.SandboxSession, error)

TerminateSandbox calls the Sandbox TerminateSandboxSession operation.

func (*Client) UpdateDatabaseBackupSchedule added in v0.23.0

func (c *Client) UpdateDatabaseBackupSchedule(ctx context.Context, projectID uuid.UUID, databaseName string, entries []apiclient.DatabaseBackupScheduleEntry) (*apiclient.DatabaseBackupSchedule, error)

UpdateDatabaseBackupSchedule replaces the schedule wholesale. An empty entries slice stops scheduled backups. The API clamps retention to the plan's, so the schedule it returns can differ from the one sent.

func (*Client) UpdateDatabaseBranch added in v0.21.0

func (c *Client) UpdateDatabaseBranch(ctx context.Context, projectID uuid.UUID, databaseName, branchName string, ttlSeconds int64) (*apiclient.DatabaseBranch, error)

UpdateDatabaseBranch re-arms a branch's lifetime from now.

func (*Client) UpdateDurableFunctionScheduler added in v0.26.0

func (c *Client) UpdateDurableFunctionScheduler(
	ctx context.Context, projectID uuid.UUID, function string, schedulerID uuid.UUID, input FunctionSchedulerInput,
) (*apiclient.FunctionScheduler, error)

UpdateDurableFunctionScheduler updates one scheduler of a durable function.

func (*Client) UpdateFunctionScheduler

func (c *Client) UpdateFunctionScheduler(ctx context.Context, projectID, functionID, schedulerID uuid.UUID, input FunctionSchedulerInput) (*apiclient.FunctionScheduler, error)

UpdateFunctionScheduler updates one scheduler for a function.

func (*Client) UpdateFunctionVisibility

func (c *Client) UpdateFunctionVisibility(ctx context.Context, projectID, functionID uuid.UUID, isPublic bool) (*apiclient.Function, error)

UpdateFunctionVisibility updates one function's public/private visibility.

func (*Client) UpdateStorageBucket

func (c *Client) UpdateStorageBucket(ctx context.Context, projectID uuid.UUID, bucketName string, input StorageBucketUpdateInput) (*apiclient.StorageBucket, error)

UpdateStorageBucket updates one bucket's configuration.

func (*Client) UpdateVariable

func (c *Client) UpdateVariable(ctx context.Context, projectID uuid.UUID, name, value string) (*apiclient.Variable, error)

UpdateVariable updates one variable by name.

func (*Client) UploadStorageObject

func (c *Client) UploadStorageObject(ctx context.Context, bucketName, path, contentType string, content io.Reader) (*apiclient.StorageObject, error)

UploadStorageObject uploads one object to a bucket via a streaming multipart request. The body is assembled lazily through an io.Pipe so the caller's reader is consumed in fixed-size chunks rather than buffered in memory.

func (*Client) ValidateToken

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

ValidateToken validates the configured token by listing projects.

func (*Client) WriteSandboxFile added in v0.38.0

func (c *Client) WriteSandboxFile(ctx context.Context, id uuid.UUID, body apiclient.SandboxFileWriteRequest) error

WriteSandboxFile calls the Sandbox WriteSandboxSessionFile operation.

type DeviceTokenPollResult

type DeviceTokenPollResult struct {
	AccessToken      string
	Error            string
	ErrorDescription string
}

DeviceTokenPollResult is the normalized result of a device-token poll.

type DurableExecutionStartInput added in v0.26.0

type DurableExecutionStartInput struct {
	Input map[string]any
	Name  string
}

DurableExecutionStartInput contains one durable execution start request. Name is the idempotency key: repeating a start with the same one returns the execution that already exists rather than beginning a second.

type DurableFunctionDeployInput added in v0.26.0

type DurableFunctionDeployInput struct {
	Name          string
	Runtime       string
	Handler       string
	SourceArchive []byte
	IsPublic      *bool
	// VariableScope and Variables carry the manifest's declaration, nil when it
	// declared none — which leaves an existing function's scope alone.
	VariableScope *string
	Variables     *[]string
}

DurableFunctionDeployInput contains one packaged durable function source archive.

type Error

type Error struct {
	StatusCode int
	Message    string
}

Error is a normalized error returned for non-successful API responses.

func (*Error) Error

func (e *Error) Error() string

type FrontendCustomDomainInput

type FrontendCustomDomainInput struct {
	Domain              string
	CertificatePEM      string
	PrivateKeyPEM       string
	CertificateChainPEM string
}

FrontendCustomDomainInput contains one custom domain attach request.

type FrontendDeployInput

type FrontendDeployInput struct {
	Name          string
	Framework     string
	AppRoot       string
	VariableScope string
	Variables     []string
	Archive       []byte
}

FrontendDeployInput contains one packaged frontend source archive.

type FunctionDeployInput

type FunctionDeployInput struct {
	Name          string
	Runtime       string
	Handler       string
	SourceArchive []byte
	VariableScope *string
	Variables     *[]string
}

FunctionDeployInput contains one packaged function source archive. A nil VariableScope or Variables sends no field at all, which leaves the stored declaration on the server unchanged.

type FunctionInvokeInput added in v0.0.4

type FunctionInvokeInput struct {
	Payload map[string]any
}

FunctionInvokeInput contains one function invocation request.

type FunctionSchedulerInput

type FunctionSchedulerInput struct {
	Name           string
	CronExpression string
	Payload        map[string]any
	Regions        []string
	Enabled        *bool
}

FunctionSchedulerInput contains one function scheduler create or update request.

type Instructions added in v0.1.0

type Instructions struct {
	CLIInstruction    string
	LatestVersion     string
	CreditURL         string
	DeviceInstruction string
}

Instructions is a snapshot of the most recent VOL-180 protocol signals observed on any API response in this process.

func ConsumeCLIInstructions added in v0.1.0

func ConsumeCLIInstructions() Instructions

ConsumeCLIInstructions returns each observed CLI instruction/latest-version/ credit-URL combination once. Repeated API responses commonly carry the same combination, so retaining the last consumed one prevents a long-running command from rendering the same notice again after a poll or stream reconnect. CreditURL is part of the identity so a later response with the same instruction and version but a changed credit URL is treated as new information and rendered again, instead of being suppressed as a repeat. DeviceInstruction is returned unchanged because callers render the reauthentication hint from LastInstructions alongside command errors.

func LastInstructions added in v0.1.0

func LastInstructions() Instructions

LastInstructions returns the most recently observed VOL-180 instructions from any API response in this process. It retains the latest observed values after ConsumeCLIInstructions renders their one-shot notice so error paths can still use response metadata such as LatestVersion. It is the zero value if no API call has completed yet — e.g. local-only commands (init, help, version, completion) never populate this, since they never make a request.

A CLI process runs exactly one command per invocation, so "most recent" is simply "from the request(s) this command made" — there is no cross-command state to reconcile.

type Option

type Option func(*options)

Option configures a cloud API client.

func WithHTTPClient

func WithHTTPClient(httpClient apiclient.HttpRequestDoer) Option

WithHTTPClient injects the HTTP client used by the generated API client.

type ProjectConfigValidationError added in v0.0.5

type ProjectConfigValidationError struct {
	Errors []apiclient.ProjectConfigValidationError
}

ProjectConfigValidationError is returned when the server rejects a config manifest with 422. Nothing was applied; Errors carries the full list.

func (*ProjectConfigValidationError) Error added in v0.0.5

type ProjectLogStream added in v0.0.4

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

ProjectLogStream reads project log Server-Sent Events.

func (*ProjectLogStream) Close added in v0.0.4

func (s *ProjectLogStream) Close() error

Close closes the underlying response body.

func (*ProjectLogStream) Next added in v0.0.4

Next returns the next non-comment SSE event.

type ProjectLogStreamEvent added in v0.0.4

type ProjectLogStreamEvent struct {
	ID      string
	Type    string
	Data    string
	Log     *apiclient.LogSearchEvent
	Warning string
}

ProjectLogStreamEvent is one parsed project log stream event.

type Refusal added in v0.31.0

type Refusal struct {
	// ProjectID is the project the refused request addressed, empty when its
	// route was not project-scoped.
	ProjectID string
	// ProjectAccessToken reports whether the refused request carried a pt-
	// credential.
	ProjectAccessToken bool
}

Refusal describes the request behind the most recent 403 in this process.

It is read from the request as it goes out rather than resolved from the configuration afterwards, because the two can disagree: a command that takes a project ID as an argument addresses a project the configuration never selected, and a local-mode command sends no credential at all. A caller explaining a refusal has to describe what was sent.

Recorded process-wide instead of carried on Error for the same reason LastInstructions is: the error is built from a status and a body, neither of which names the request, and a CLI process runs exactly one command — so "most recent" is "this command's".

func LastRefusal added in v0.31.0

func LastRefusal() Refusal

LastRefusal returns the request behind the most recent 403 observed on any API response in this process. It is the zero value until one is refused.

type StorageBucketCreateInput

type StorageBucketCreateInput struct {
	Name             string
	AllowedMimeTypes []string
	FileSizeLimit    *int64
}

StorageBucketCreateInput captures fields supported by bucket creation.

type StorageBucketUpdateInput

type StorageBucketUpdateInput struct {
	AllowedMimeTypes *[]string
	FileSizeLimit    *int64
}

StorageBucketUpdateInput captures fields supported by bucket update.

type StorageObjectListOptions

type StorageObjectListOptions struct {
	Prefix string
	Limit  int
	Cursor string
}

StorageObjectListOptions controls the object list query.

type StoragePolicyCreateInput

type StoragePolicyCreateInput struct {
	Name       string
	Definition string
	Operation  apiclient.CreateStoragePolicyRequestOperation
}

StoragePolicyCreateInput captures fields supported by policy creation.

Jump to

Keyboard shortcuts

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