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 ¶
- func DeleteCommand(config *Config) *cobra.Command
- func DescribeCommand(cfg *Config) *cobra.Command
- func DescribeComponent(component, stack string) (map[string]any, error)
- func InitConfigAndAuth(component, stack, identity string, globalFlags *global.Flags) (*schema.AtmosConfiguration, *schema.AuthContext, error)
- func ListCommand(cfg *Config) *cobra.Command
- func ProvisionSource(ctx context.Context, opts *ProvisionSourceOptions) error
- func PullCommand(cfg *Config) *cobra.Command
- type AuthCreator
- type AuthMerger
- type CommonOptions
- type ComponentDescriber
- type Config
- type ConfigLoader
- type Dependencies
- type ProvisionSourceOptions
- type SourceProvisioner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteCommand ¶
DeleteCommand creates a delete command for the given component type.
func DescribeCommand ¶
DescribeCommand creates a describe command for the given component type.
func DescribeComponent ¶
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 ¶
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 ¶
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 ¶
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.