component

package
v1.196.0-test.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Count added in v1.196.0

func Count() int

Count returns the number of registered providers.

func ListProviders added in v1.196.0

func ListProviders() map[string][]ComponentProvider

ListProviders returns all registered providers grouped by category. The map key is the group name, and the value is a slice of providers in that group.

func ListTypes added in v1.196.0

func ListTypes() []string

ListTypes returns all registered component types sorted alphabetically. Example: ["helmfile", "mock", "packer", "terraform"].

func ProcessComponentFromContext

func ProcessComponentFromContext(
	component string,
	namespace string,
	tenant string,
	environment string,
	stage string,
	atmosCliConfigPath string,
	atmosBasePath string,
) (map[string]any, error)

ProcessComponentFromContext accepts context (namespace, tenant, environment, stage) and returns the component configuration in the stack.

func ProcessComponentInStack

func ProcessComponentInStack(
	component string,
	stack string,
	atmosCliConfigPath string,
	atmosBasePath string,
) (map[string]any, error)

ProcessComponentInStack accepts a component and a stack name and returns the component configuration in the stack.

func Register added in v1.196.0

func Register(provider ComponentProvider) error

Register adds a component provider to the registry. This is called during package init() for built-in components. If a provider with the same type already exists, it will be replaced (last registration wins, allowing plugin override).

Returns an error if the provider is nil or has an empty type.

func Reset added in v1.196.0

func Reset()

Reset clears the registry (for testing only). This should not be used in production code.

Types

type ComponentInfo added in v1.196.0

type ComponentInfo struct {
	Type        string
	Group       string
	Commands    []string
	Description string
}

ComponentInfo provides metadata about a component provider.

func GetInfo added in v1.196.0

func GetInfo() []ComponentInfo

GetInfo returns metadata for all registered component providers. Results are sorted by component type for consistent ordering.

type ComponentProvider added in v1.196.0

type ComponentProvider interface {
	// GetType returns the component type identifier (e.g., "terraform", "helmfile", "mock").
	GetType() string

	// GetGroup returns the component group for categorization.
	// Examples: "Infrastructure as Code", "Kubernetes", "Images", "Testing"
	GetGroup() string

	// GetBasePath returns the base directory path for this component type.
	// Example: For terraform, returns "components/terraform"
	GetBasePath(atmosConfig *schema.AtmosConfiguration) string

	// ListComponents discovers all components of this type in a stack.
	// Returns component names found in the stack configuration.
	ListComponents(ctx context.Context, stack string, stackConfig map[string]any) ([]string, error)

	// ValidateComponent validates component configuration.
	// Returns error if configuration is invalid for this component type.
	ValidateComponent(config map[string]any) error

	// Execute runs a command for this component type.
	// Context provides all necessary information for execution.
	Execute(ctx *ExecutionContext) error

	// GenerateArtifacts creates necessary files for component execution.
	// Examples: backend.tf for Terraform, varfile for Helmfile
	GenerateArtifacts(ctx *ExecutionContext) error

	// GetAvailableCommands returns list of commands this component type supports.
	// Example: For terraform: ["plan", "apply", "destroy", "workspace"]
	GetAvailableCommands() []string
}

ComponentProvider is the interface that component type implementations must satisfy to register with the Atmos component registry.

Component providers are registered via init() functions and enable extensible component type support without modifying core code.

func GetProvider added in v1.196.0

func GetProvider(componentType string) (ComponentProvider, bool)

GetProvider returns a component provider by type. Returns the provider and true if found, nil and false otherwise.

func MustGetProvider added in v1.196.0

func MustGetProvider(componentType string) ComponentProvider

MustGetProvider returns a component provider by type or panics if not found. This is useful in contexts where the component type is known to be registered.

type ComponentRegistry added in v1.196.0

type ComponentRegistry struct {
	// contains filtered or unexported fields
}

ComponentRegistry manages component provider registration. It is thread-safe and supports concurrent registration and access.

type ExecutionContext added in v1.196.0

type ExecutionContext struct {
	AtmosConfig         *schema.AtmosConfiguration
	ComponentType       string
	Component           string
	Stack               string
	Command             string
	SubCommand          string
	ComponentConfig     map[string]any
	ConfigAndStacksInfo schema.ConfigAndStacksInfo
	Args                []string
	Flags               map[string]any
}

ExecutionContext provides all necessary context for component execution.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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