shared

package
v1.135.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package shared holds format helpers for variable subcommands.

Index

Constants

View Source
const SecuredPlaceholder = "<secured>"

SecuredPlaceholder is rendered in TTY tables in place of a secured variable's value.

Variables

This section is empty.

Functions

func DisplayEnvVariableValue

func DisplayEnvVariableValue(v backend.EnvVariable) string

DisplayEnvVariableValue redacts secured env variable values for TTY output.

func DisplayVariableValue

func DisplayVariableValue(v backend.PipelineVariable) string

DisplayVariableValue redacts secured pipeline variable values for TTY output.

func EnvVariableFields

func EnvVariableFields(f *factory.Factory, cfg format.OutputConfig) *format.Printer[backend.EnvVariable]

EnvVariableFields constructs the formatter for deployment scope variable lists (EnvVariable). Secured values are redacted in both TTY and JSON paths.

func VariableFields

VariableFields constructs the formatter for repository and workspace scope variable lists (PipelineVariable). Secured values are redacted via DisplayVariableValue in both TTY and JSON output paths.

Types

type VariableItem added in v1.36.0

type VariableItem struct {
	UUID    string
	Key     string
	Value   string
	Secured bool
}

VariableItem is a scope-agnostic view of a pipeline/workspace/deployment variable for use by callers that don't care which scope it came from. Value is empty whenever Secured is true.

type VariableOps added in v1.36.0

type VariableOps interface {
	// ListVariables returns all variables in the bound scope.
	ListVariables() ([]VariableItem, error)
	// GetVariableByKey returns the single variable matching key. Returns a
	// typed ErrNotFound DomainError when no variable with that key exists.
	GetVariableByKey(key string) (VariableItem, error)
	// SetVariable upserts the variable by key and returns the resulting item.
	SetVariable(key, value string, secured bool) (VariableItem, error)
	// DeleteVariableByKey removes the variable identified by key. For scopes
	// whose underlying API only accepts a UUID, the implementation performs
	// a list-then-find lookup and returns an error if the key is absent.
	DeleteVariableByKey(key string) error
}

VariableOps is the scope-agnostic interface for variable CRUD. The concrete implementation is selected by ResolveVariableOps based on scope.

func ResolveVariableOps added in v1.36.0

func ResolveVariableOps(scope string, client backend.Client, host, project, slug, envUUID string) (VariableOps, error)

ResolveVariableOps maps scope + backend client to the right VariableOps implementation. scope must be one of "repository", "workspace", or "deployment". For "deployment", envUUID must be non-empty.

The host argument is forwarded to the As* capability assertions so that any unsupported-on-host error carries the correct host label.

Jump to

Keyboard shortcuts

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