output

package
v0.46.1 Latest Latest
Warning

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

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

Documentation

Overview

Package output formats command results for human and machine consumers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccessToken added in v0.31.0

func AccessToken(w io.Writer, token *apiclient.ProjectAccessToken)

AccessToken renders one project access token.

func AccessTokenCreated added in v0.31.0

func AccessTokenCreated(w io.Writer, token *apiclient.CreatedProjectAccessToken)

AccessTokenCreated renders a newly minted project access token, including the plaintext secret the API returns only once.

func AccessTokenUsage added in v0.31.0

func AccessTokenUsage(w io.Writer, usage *apiclient.ProjectAccessTokenUsage)

AccessTokenUsage renders the daily request counts for one access token. The series is zero-filled by the API, so every day in the window prints.

func AccessTokens added in v0.31.0

func AccessTokens(w io.Writer, page *apiclient.PaginatedProjectAccessTokens, commandPrefix ...string)

AccessTokens renders one project access token list page.

func AccessTokensUsage added in v0.31.0

func AccessTokensUsage(w io.Writer, usage []apiclient.ProjectAccessTokenUsage)

AccessTokensUsage renders the windowed request count of every access token in a project.

func AnonKeys added in v0.5.0

func AnonKeys(w io.Writer, keys []apiclient.AnonKey)

AnonKeys renders a project's anon keys. The key value is the publishable JWT for the frontend/SDK Authorization header, so it is printed in full.

func Database

func Database(w io.Writer, database *apiclient.Database, showConnectionString bool)

Database renders one database.

func DatabaseBackup added in v0.23.0

func DatabaseBackup(w io.Writer, backup *apiclient.DatabaseBackup)

DatabaseBackup renders one backup.

func DatabaseBackupCreated added in v0.23.0

func DatabaseBackupCreated(w io.Writer, backup *apiclient.DatabaseBackup, databaseName string)

DatabaseBackupCreated renders a backup that was just taken. A backup is restorable as soon as it is returned, so there is no status to wait on.

func DatabaseBackupSchedule added in v0.23.0

func DatabaseBackupSchedule(w io.Writer, schedule *apiclient.DatabaseBackupSchedule, databaseName string)

DatabaseBackupSchedule renders a database's automated backup schedule.

func DatabaseBackups added in v0.23.0

func DatabaseBackups(w io.Writer, list *apiclient.DatabaseBackupList, databaseName string)

DatabaseBackups renders a database's backups and the window a point-in-time restore may target.

func DatabaseBranch added in v0.21.0

func DatabaseBranch(w io.Writer, branch *apiclient.DatabaseBranch, showConnectionString bool)

DatabaseBranch renders one branch.

func DatabaseBranchCreated added in v0.21.0

func DatabaseBranchCreated(w io.Writer, branch *apiclient.DatabaseBranch, databaseName string, commandPrefix ...string)

DatabaseBranchCreated renders a branch that was just forked. The branch is still provisioning at this point, so there is no connection string to show.

func DatabaseBranchRotatedConnectionString added in v0.23.0

func DatabaseBranchRotatedConnectionString(w io.Writer, branch *apiclient.DatabaseBranch, databaseName string, commandPrefix ...string)

DatabaseBranchRotatedConnectionString renders the connection string a password rotation returned. That string is the only copy of the new credential the user gets, so an absent one is called out rather than skipped.

func DatabaseBranches added in v0.21.0

func DatabaseBranches(w io.Writer, branches []apiclient.DatabaseBranch, databaseName string)

DatabaseBranches renders a database's branch list. The list endpoint omits connection strings, so there is nothing to reveal here.

func DatabaseCreated

func DatabaseCreated(w io.Writer, database *apiclient.Database, showConnectionString bool)

DatabaseCreated renders a newly created database.

func DatabaseRestore added in v0.23.0

func DatabaseRestore(w io.Writer, restore *apiclient.DatabaseRestore, databaseName string)

DatabaseRestore renders one restore, including why it failed when it did.

func DatabaseRestoreStarted added in v0.23.0

func DatabaseRestoreStarted(w io.Writer, restore *apiclient.DatabaseRestore, databaseName string, commandPrefix ...string)

DatabaseRestoreStarted renders an accepted restore. The follow-up command watches the restore rather than the database, because that is what carries the reason when one does not finish.

func DatabaseRestores added in v0.23.0

func DatabaseRestores(w io.Writer, list *apiclient.DatabaseRestoreList, databaseName string)

DatabaseRestores renders a database's restore history.

func Databases

func Databases(w io.Writer, page *apiclient.PaginatedDatabases, showConnectionString bool, commandPrefix ...string)

Databases renders one database list page.

func DurableApproval added in v0.44.0

func DurableApproval(w io.Writer, approval *apiclient.DurableApproval)

DurableApproval renders one approval: what the workflow asked, where it came from, and the decision once a person has made one. The workflow wrote the text, so it is printed without its control characters.

func DurableApprovalStats added in v0.44.0

func DurableApprovalStats(w io.Writer, stats *apiclient.DurableApprovalStats)

DurableApprovalStats renders approval counts for a window, overall and for the workflows that asked most.

func DurableApprovals added in v0.44.0

func DurableApprovals(w io.Writer, page *apiclient.PaginatedDurableApprovals, status, nextCommand string)

DurableApprovals renders one approval page. status is the filter the page was fetched under, empty for every status, and nextCommand is the list command with its filters, so the next-page hint pages the same set.

func DurableExecution added in v0.26.0

func DurableExecution(w io.Writer, execution *apiclient.DurableExecution)

DurableExecution renders one execution, including its outcome once it has one.

func DurableExecutions added in v0.26.0

func DurableExecutions(w io.Writer, functionName, status string, page *apiclient.PaginatedDurableExecutions, commandPrefix ...string)

DurableExecutions renders one execution list page for a durable function. status is the filter the page was fetched under, so the next-page hint keeps paging the same set rather than the unfiltered one.

func DurableFunction added in v0.26.0

func DurableFunction(w io.Writer, fn *apiclient.DurableFunction)

DurableFunction renders one durable function.

func DurableFunctions added in v0.26.0

func DurableFunctions(w io.Writer, page *apiclient.PaginatedDurableFunctions, commandPrefix ...string)

DurableFunctions renders one durable function list page.

func DurableSchedulers added in v0.26.0

func DurableSchedulers(w io.Writer, functionName string, resp *apiclient.FunctionSchedulerListResponse)

DurableSchedulers renders the schedulers of one durable function. A tick starts an execution, so the run columns say when the scheduler last started one rather than when the function last ran.

func Errorf added in v0.13.0

func Errorf(w io.Writer, format string, args ...any)

Errorf prints an error line (prefix in red when color is on).

func FormatTimeAgo

func FormatTimeAgo(t time.Time) string

FormatTimeAgo returns a compact relative timestamp or "-".

func FormatTimestamp

func FormatTimestamp(t time.Time) string

FormatTimestamp returns a local RFC3339 timestamp or "-".

func Frontend

func Frontend(w io.Writer, fe *apiclient.Frontend, routes []FrontendRouteEntry)

Frontend renders one frontend detail view and its function routes.

func FrontendCustomDomain

func FrontendCustomDomain(w io.Writer, domain *apiclient.FrontendCustomDomainResponse)

FrontendCustomDomain renders one custom domain detail view.

func FrontendCustomDomains

func FrontendCustomDomains(w io.Writer, entries []FrontendCustomDomainEntry)

FrontendCustomDomains renders custom domains configured for frontends.

func FrontendRoute added in v0.42.0

func FrontendRoute(w io.Writer, route FrontendRouteEntry)

FrontendRoute renders one frontend function route.

func FrontendRoutes added in v0.42.0

func FrontendRoutes(w io.Writer, frontend string, routes []FrontendRouteEntry)

FrontendRoutes renders a frontend's function routes.

func Frontends

func Frontends(w io.Writer, page *apiclient.PaginatedFrontends, commandPrefix ...string)

Frontends renders one frontend list page.

func Function

func Function(w io.Writer, fn *apiclient.Function, routedFrom []FunctionRouteSource)

Function renders one function and the frontend routes that forward to it.

func FunctionRuntimes

func FunctionRuntimes(w io.Writer, runtimes []apiclient.FunctionRuntimeOption)

FunctionRuntimes renders function runtime options.

func FunctionVisibility added in v0.37.0

func FunctionVisibility(visibility apiclient.FunctionVisibility, isPublic bool) string

FunctionVisibility names a function's visibility level. Servers that predate levels send only is_public, whose false meant what authenticated means now.

func Functions

func Functions(w io.Writer, page *apiclient.PaginatedFunctions, commandPrefix ...string)

Functions renders one function list page.

func GitConnected added in v0.22.0

func GitConnected(w io.Writer, binding GitBinding)

GitConnected renders a repository binding that was just made, followed by what a push to the production branch will actually deploy. Settings are optional: a connect still succeeded if reading them afterwards did not.

func GitConnection added in v0.22.0

func GitConnection(w io.Writer, binding GitBinding)

GitConnection renders an existing binding without claiming anything changed.

func GitDisconnected added in v0.22.0

func GitDisconnected(w io.Writer, repoFullName string)

GitDisconnected renders a removed binding. The repository is untouched, which is worth saying: "disconnect" reads as destructive and is not.

func GitNotConnected added in v0.22.0

func GitNotConnected(w io.Writer, project, connectCommand string)

GitNotConnected renders a project with no repository bound. This is a state, not a failure, so it reads as an answer and says what would change it.

func GitStatus added in v0.22.0

func GitStatus(w io.Writer, binding GitBinding)

GitStatus renders a binding as a plain report. It deliberately does not read as an outcome — nothing was just done — and it names no GitHub account, because answering that would mean contacting the provider, which the command behind it does not do.

func LocalModeDockerUnavailable

func LocalModeDockerUnavailable(w io.Writer)

LocalModeDockerUnavailable renders Docker setup guidance for local mode.

func LocalModeNotRunning

func LocalModeNotRunning(w io.Writer)

LocalModeNotRunning renders the local-mode status when the stack is stopped.

func LocalModeStatus

func LocalModeStatus(w io.Writer, details LocalModeStatusDetails)

LocalModeStatus renders local-mode service status and metadata.

func LogEvents

func LogEvents(w io.Writer, events []apiclient.LogEvent)

LogEvents renders function log events.

func LogSearchEvents added in v0.0.4

func LogSearchEvents(w io.Writer, events []apiclient.LogSearchEvent)

LogSearchEvents renders function log search events.

func Note

func Note(w io.Writer, format string, args ...any)

Note prints an informational note line (dimmed when color is on).

func PrintLogStreamEvent added in v0.0.4

func PrintLogStreamEvent(w io.Writer, event *api.ProjectLogStreamEvent)

PrintLogStreamEvent renders one parsed project log stream event.

func PrintSearchLogs added in v0.0.4

func PrintSearchLogs(w io.Writer, fetch SearchLogsFetcher) error

PrintSearchLogs renders paginated searched log events from fetch until the response signals no more pages or the cursor cannot be advanced.

func PrintSearchLogsSkipping added in v0.0.4

func PrintSearchLogsSkipping(w io.Writer, fetch SearchLogsFetcher, skip map[string]struct{}) error

PrintSearchLogsSkipping renders paginated searched log events, excluding IDs already present in skip.

func Project

func Project(w io.Writer, project *apiclient.Project)

Project renders one project.

func ProjectConfigApplyReport added in v0.0.5

func ProjectConfigApplyReport(w io.Writer, result *apiclient.ProjectConfigApplyResult)

ProjectConfigApplyReport renders the server's config apply (or dry-run) report: per-section action counts, per-entry errors and notices, and prominent warnings for skipped and missing resources.

func ProjectConfigValidationErrors added in v0.0.5

func ProjectConfigValidationErrors(w io.Writer, errs []apiclient.ProjectConfigValidationError)

ProjectConfigValidationErrors renders the server's 422 validation error list, one line per entry.

func ProjectUsage added in v0.34.0

func ProjectUsage(w io.Writer, usage *apiclient.ProjectUsageResponse)

ProjectUsage renders aggregate current-month and all-time totals. The API's hourly and daily series are intentionally not rendered until the command has an explicit detailed mode.

func Projects

func Projects(w io.Writer, cfg *config.Config, page *apiclient.PaginatedProjects)

Projects renders one project list page.

func Scheduler

func Scheduler(w io.Writer, scheduler *apiclient.FunctionScheduler)

Scheduler renders one scheduler.

func Schedulers

Schedulers renders schedulers configured for a function.

func ServiceKey added in v0.34.0

func ServiceKey(w io.Writer, key *apiclient.ServiceKey, showKey bool)

ServiceKey renders metadata and optionally a returned plaintext key.

func ServiceKeys added in v0.34.0

func ServiceKeys(w io.Writer, page *apiclient.PaginatedServiceKeys, projectID string, showKey bool, commandPrefix ...string)

ServiceKeys renders one service-key page. Plaintext requires showKey.

func StorageBucket

func StorageBucket(w io.Writer, bucket *apiclient.StorageBucket)

StorageBucket renders one bucket detail view.

func StorageBuckets

func StorageBuckets(w io.Writer, buckets []apiclient.StorageBucket)

StorageBuckets renders one bucket list.

func StorageObject

func StorageObject(w io.Writer, bucketName string, object *apiclient.StorageObject)

StorageObject renders one object detail view.

func StorageObjects

func StorageObjects(w io.Writer, bucketName string, page *apiclient.StorageListResponse, commandPrefix ...string)

StorageObjects renders one cursor page of objects.

func StoragePolicies

func StoragePolicies(w io.Writer, bucketName string, policies []apiclient.StoragePolicy)

StoragePolicies renders one policy list.

func StoragePolicy

func StoragePolicy(w io.Writer, bucketName string, policy *apiclient.StoragePolicy)

StoragePolicy renders one policy detail view.

func StorageStats

func StorageStats(w io.Writer, stats *apiclient.StorageStats)

StorageStats renders aggregate project storage usage.

func Success

func Success(w io.Writer, format string, args ...any)

Success prints a check-marked success line (mark in volcano when color is on).

func Truncate

func Truncate(value string, maxLen int) string

Truncate shortens value to maxLen using an ellipsis when practical.

func Variable

func Variable(w io.Writer, variable *apiclient.Variable)

Variable renders one project variable.

func Variables

func Variables(w io.Writer, page *apiclient.PaginatedVariables, commandPrefix ...string)

Variables renders one variable list page.

func VerifiedDomains added in v0.41.0

func VerifiedDomains(w io.Writer, domains []apiclient.VerifiedDomain)

VerifiedDomains renders the account's verified domains.

func Warning

func Warning(w io.Writer, format string, args ...any)

Warning prints a warning line (prefix in amber when color is on).

Types

type FrontendCustomDomainEntry

type FrontendCustomDomainEntry struct {
	FrontendName string
	FrontendID   string
	Domain       apiclient.FrontendCustomDomainResponse
}

FrontendCustomDomainEntry contains one frontend custom domain row.

type FrontendRouteEntry added in v0.42.0

type FrontendRouteEntry struct {
	ID          string
	PathPrefix  string
	StripPrefix bool
	// Function is the target's name, or its ID when the name is unknown.
	Function string
	// Visibility is empty when the target is unknown.
	Visibility string
}

FrontendRouteEntry is one frontend function route and the function it forwards to.

type FunctionRouteSource added in v0.42.0

type FunctionRouteSource struct {
	Frontend   string
	PathPrefix string
}

FunctionRouteSource is a frontend path that forwards requests to a function.

type GitBinding added in v0.22.0

type GitBinding struct {
	Connection *apiclient.ProjectGitConnection
	Settings   *apiclient.ProjectGitDeploySettings
	// Project labels the project that was bound.
	Project string
	// GitHubAccount is the connected GitHub account whose stored token the
	// platform reads the repository with. Empty when it is not known, as it is
	// not for a binding that was only read back.
	GitHubAccount string
	// InstallationAccount is the account the App installation belongs to. It is
	// reported only when it differs from the repository's owner, which is the
	// case worth pointing out.
	InstallationAccount string
	// SettingsErr is why Settings could not be read, when they could not. The
	// binding is unaffected by that failure, so it is reported as a warning
	// rather than swallowed: "nothing to say about what a push deploys" and
	// "could not find out" are different states, and only one of them is safe
	// to read as "no deploy configured".
	SettingsErr error
}

GitBinding is everything worth reporting about a binding: what was bound, which project it was bound to, and which GitHub identity it was bound through. The project and the GitHub identity are chosen by the CLI rather than named by the user, which is why they are reported rather than assumed.

type LocalModeServiceStatus

type LocalModeServiceStatus struct {
	Name    string
	Running bool
}

LocalModeServiceStatus is one local-mode service status row.

type LocalModeStatusDetails

type LocalModeStatusDetails struct {
	Services    []LocalModeServiceStatus
	ProjectID   string
	UserID      string
	APIURL      string
	AnonKey     string
	ServiceKey  string
	DatabaseURL string
	PSQLCommand string
}

LocalModeStatusDetails contains the data rendered by `volcano status`.

type SearchLogsFetcher added in v0.0.4

type SearchLogsFetcher func(cursor string) (*apiclient.LogSearchResponse, error)

SearchLogsFetcher fetches one page of searched log events. An empty cursor requests the first page.

Jump to

Keyboard shortcuts

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