cmd

package
v1.203.0 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package cmd provides reusable CLI command builders for source provisioning. These builders create Cobra commands parameterized by component type, enabling terraform, helmfile, and packer to share the same implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteCommand

func DeleteCommand(config *Config) *cobra.Command

DeleteCommand creates a delete command for the given component type.

func DescribeCommand

func DescribeCommand(cfg *Config) *cobra.Command

DescribeCommand creates a describe command for the given component type.

func DescribeComponent

func DescribeComponent(component, stack string) (map[string]any, error)

DescribeComponent returns the component configuration from stack.

func InitConfigAndAuth

func InitConfigAndAuth(component, stack, identity string, globalFlags *global.Flags) (*schema.AtmosConfiguration, *schema.AuthContext, error)

InitConfigAndAuth initializes Atmos configuration and optional authentication. Returns atmosConfig, authContext, and error. The globalFlags parameter wires CLI global flags (--base-path, --config, --config-path, --profile) to the configuration loader.

func ListCommand

func ListCommand(cfg *Config) *cobra.Command

ListCommand creates a list command for the given component type.

func ProvisionSource

func ProvisionSource(ctx context.Context, opts *ProvisionSourceOptions) error

ProvisionSource vendors a component source based on the source configuration.

func PullCommand

func PullCommand(cfg *Config) *cobra.Command

PullCommand creates a pull command for the given component type.

Types

type AuthCreator

type AuthCreator interface {
	// CreateAuthManager creates and authenticates an auth manager.
	CreateAuthManager(identity string, authConfig *schema.AuthConfig, flagValue string) (auth.AuthManager, error)
}

AuthCreator creates authentication managers.

type AuthMerger

type AuthMerger interface {
	// MergeComponentAuth merges component auth config with global auth config.
	MergeComponentAuth(globalAuth *schema.AuthConfig, componentConfig map[string]any, atmosConfig *schema.AtmosConfiguration, sectionName string) (*schema.AuthConfig, error)
}

AuthMerger merges authentication configuration.

type CommonOptions

type CommonOptions struct {
	global.Flags
	Stack    string
	Identity string
	Force    bool
}

CommonOptions contains the standard flags shared by all source commands.

func ParseCommonFlags

func ParseCommonFlags(cmd *cobra.Command, parser *flags.StandardParser) (*CommonOptions, error)

ParseCommonFlags parses common flags (stack, identity, force) using StandardParser with Viper precedence.

type ComponentDescriber

type ComponentDescriber interface {
	// DescribeComponent returns the component configuration from stack.
	DescribeComponent(component, stack string) (map[string]any, error)
}

ComponentDescriber describes components from stacks.

type Config

type Config struct {
	// ComponentType identifies the component type (e.g., "terraform", "helmfile", "packer").
	ComponentType string
	// TypeLabel is the display name for the component type (e.g., "Terraform", "Helmfile", "Packer").
	TypeLabel string
}

Config holds component-type-specific configuration for source commands.

type ConfigLoader

type ConfigLoader interface {
	// InitCliConfig initializes the CLI configuration.
	InitCliConfig(configInfo schema.ConfigAndStacksInfo, validate bool) (schema.AtmosConfiguration, error)
}

ConfigLoader loads Atmos configuration.

type Dependencies

type Dependencies struct {
	ConfigLoader ConfigLoader
	Describer    ComponentDescriber
	AuthMerger   AuthMerger
	AuthCreator  AuthCreator
	Provisioner  SourceProvisioner
}

Dependencies holds all external dependencies for source commands.

type ProvisionSourceOptions

type ProvisionSourceOptions struct {
	AtmosConfig     *schema.AtmosConfiguration
	ComponentType   string // "terraform", "helmfile", "packer"
	Component       string
	Stack           string
	ComponentConfig map[string]any
	AuthContext     *schema.AuthContext
	Force           bool
}

ProvisionSourceOptions holds parameters for provisioning a component source.

type SourceProvisioner

type SourceProvisioner interface {
	// Provision vendors a component source.
	Provision(ctx context.Context, params *source.ProvisionParams) error
}

SourceProvisioner provisions component sources.

Jump to

Keyboard shortcuts

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