cmd

package
v0.32.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 52 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const EnvLab = "CLAIMS_LAB"

EnvLab is the default lab of claims secret (like --lab).

View Source
const EnvOrdersURL = "CLAIM_ORDERS_URL"

EnvOrdersURL names the order service like --orders-url.

View Source
const EnvRecoveryRecipient = "CLAIMS_SOPS_RECOVERY_RECIPIENT"

EnvRecoveryRecipient names the offline recovery recipient every rule must carry.

View Source
const LayoutSourcePath = "source-path"

LayoutSourcePath places every rendered document by the path the order names (stuttgart-things/claims#92). See internal/layout.

Variables

This section is empty.

Functions

func Execute

func Execute()

func GenerateFilename added in v0.2.0

func GenerateFilename(pattern string, info FileInfo) (string, error)

GenerateFilename creates a filename from pattern and file info

func ShowFullPreview added in v0.2.0

func ShowFullPreview(result RenderResult)

ShowFullPreview displays complete YAML for a single result

func WriteResults added in v0.2.0

func WriteResults(results []RenderResult, config OutputConfig) error

WriteResults writes render results to files based on the output configuration

func WriteSingleResult added in v0.2.0

func WriteSingleResult(templateName, resourceName, content string, config OutputConfig) error

WriteSingleResult writes a single render result using the output configuration This is a convenience function for backward compatibility with single-template rendering

Types

type ChangeConfig added in v0.19.0

type ChangeConfig struct {
	Kind        string
	Name        string
	Namespace   string
	SourcePath  string
	Size        string
	Reboot      string // now, evening, at, none -- or a time, which means at
	RebootAt    string
	RequestedBy string
	Reason      string

	RunID string // new spec.ansible.runID (re-runs the AnsibleRun)
	Retry bool   // count spec.ansible.runID up: unset -> 2, a number -> +1

	Repo   string // owner/name of the fleet repository ("" = the checkout's)
	Ref    string // branch the workflow runs on
	DryRun bool
	NoWait bool
	Merge  bool // wait for the PR's checks, then squash-merge it (claims#113)
	// contains filtered or unexported fields
}

ChangeConfig holds the inputs of a claim change.

type DeleteConfig added in v0.6.0

type DeleteConfig struct {
	ResourceName string
	Category     string
	RepoURL      string
	RegistryPath string

	Interactive bool
	DryRun      bool

	GitConfig *GitConfig
	PRConfig  *PRConfig

	// XR selects an XR deletion in an *-xrs directory (claims#93).
	XR *DeleteXRConfig
	// PickXR forces the interactive XR selection.
	PickXR bool
}

DeleteConfig holds configuration for the delete command

type DeleteResult added in v0.6.0

type DeleteResult struct {
	ResourceName string
	Category     string
	Path         string
	Error        error
}

DeleteResult holds the result of deleting a single claim

type DeleteXRConfig added in v0.18.0

type DeleteXRConfig struct {
	Kind        string
	Name        string
	Namespace   string
	SourcePath  string
	Reason      string
	RequestedBy string
}

DeleteXRConfig holds the XR-mode settings of `claims delete`.

type EncryptConfig added in v0.6.0

type EncryptConfig struct {
	// API configuration
	APIUrl string
	// Auth is the optional bearer-token authenticator (nil = no auth header).
	Auth *apiauth.Authenticator

	// Template selection
	Template string

	// Secret metadata
	SecretName      string
	SecretNamespace string

	// Parameter input
	ParamsFile      string
	InlineParamsRaw []string

	// Output configuration
	OutputDir       string
	FilenamePattern string
	DryRun          bool

	// Mode control
	Interactive bool

	// Git configuration
	GitConfig *GitConfig

	// PR configuration
	PRConfig *PRConfig
}

EncryptConfig holds configuration for the encrypt command

type EncryptResult added in v0.6.0

type EncryptResult struct {
	TemplateName    string
	SecretName      string
	SecretNamespace string
	OutputPath      string
	Content         string
	Error           error
}

EncryptResult holds the result of encrypting a single secret

type FileInfo added in v0.2.0

type FileInfo struct {
	TemplateName string
	ResourceName string
}

FileInfo holds information used for filename generation

type GitConfig added in v0.2.0

type GitConfig struct {
	Commit       bool
	Push         bool
	CreateBranch bool
	Message      string
	Branch       string
	Remote       string
	RepoURL      string
	User         string
	Token        string
}

GitConfig holds git-related configuration

type MergeConfig added in v0.25.0

type MergeConfig struct {
	Arg     string        // a claim/VM name, a branch, a PR number or URL
	Repo    string        // owner/name ("" = the checkout's, else the fleet default)
	Wait    bool          // wait for the checks
	Timeout time.Duration // how long --wait waits
	Yes     bool          // do not ask
	DryRun  bool          // show the PR, do not merge
	Token   string        // "" = ghclient.Token's order
	// contains filtered or unexported fields
}

MergeConfig holds the inputs of a merge.

type OutputConfig added in v0.2.0

type OutputConfig struct {
	Directory       string
	FilenamePattern string
	SingleFile      bool
	DryRun          bool
	FileMode        string // "overwrite" (default) or "append"
}

OutputConfig holds configuration for file output

type PRConfig added in v0.2.0

type PRConfig struct {
	Create      bool
	Title       string
	Description string
	Labels      []string
	BaseBranch  string
	Merge       bool // --merge: wait for the checks, then squash-merge (claims#113)
}

PRConfig holds pull request configuration

type RenderConfig added in v0.2.0

type RenderConfig struct {
	// API configuration
	APIUrl  string
	APIUrls []string // multiple endpoints parsed from CLAIM_API_URL
	// Auth is the optional bearer-token authenticator (nil = no auth header).
	// The same token is used for every endpoint in APIUrls.
	Auth *apiauth.Authenticator

	// Template selection
	Templates []string

	// Parameter input
	ParamsFile      string
	InlineParams    map[string]string
	InlineParamsRaw []string

	// Secret input
	InlineSecretsRaw []string
	SkipSecrets      bool
	CombineSecrets   bool

	// Output configuration
	OutputDir       string
	FilenamePattern string
	SingleFile      bool
	DryRun          bool
	FullPreview     bool   // review shows the complete YAML (--full)
	Stdout          bool   // print the rendered YAML to stdout, write nothing (--stdout)
	FileMode        string // "overwrite" (default) or "append"
	Layout          string // "" (output-dir + filename-pattern + registry) or "source-path"

	// Mode control
	Interactive bool

	// Git configuration
	GitConfig *GitConfig

	// PR configuration
	PRConfig *PRConfig
}

RenderConfig holds configuration for the render command

type RenderResult added in v0.2.0

type RenderResult struct {
	TemplateName string
	ResourceName string
	OutputPath   string
	Content      string
	Params       map[string]interface{}
	Error        error
}

RenderResult holds the result of rendering a single template

type RenderResults added in v0.2.0

type RenderResults struct {
	Results   []RenderResult
	OutputDir string
	GitCommit string
	PRUrl     string
}

RenderResults is a collection of render results

func (*RenderResults) FailedCount added in v0.2.0

func (r *RenderResults) FailedCount() int

FailedCount returns the number of failed renders

func (*RenderResults) HasErrors added in v0.2.0

func (r *RenderResults) HasErrors() bool

HasErrors returns true if any render result has an error

func (*RenderResults) SuccessCount added in v0.2.0

func (r *RenderResults) SuccessCount() int

SuccessCount returns the number of successful renders

type ReviewAction added in v0.2.0

type ReviewAction string

ReviewAction represents the user's choice in the review step

const (
	ReviewActionContinue ReviewAction = "continue"
	ReviewActionEdit     ReviewAction = "edit"
	ReviewActionCancel   ReviewAction = "cancel"
	ReviewActionFull     ReviewAction = "full"
)

func ReviewResults added in v0.2.0

func ReviewResults(results []RenderResult, full bool) (ReviewAction, int, error)

ReviewResults displays rendered results and allows user to continue, edit, view the full YAML, or cancel. full shows every resource untruncated. Returns the chosen action, the index of the template to edit (if action is edit), and any error

type SecretRenderResult added in v0.8.0

type SecretRenderResult struct {
	SecretName      string
	SecretNamespace string
	OutputPath      string
	Content         string
	Error           error
}

SecretRenderResult holds the result of generating and encrypting a secret

type TemplateParams added in v0.2.0

type TemplateParams struct {
	TemplateName string
	Params       map[string]any
	SecretValues map[string]string // collected secret values (interactive mode)
}

TemplateParams holds parameters for a single template

Jump to

Keyboard shortcuts

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