provisioner

package
v1.202.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsupportedProvisionerType = errors.New("unsupported provisioner type")

Error types for provisioning operations.

Functions

func DeleteBackendWithParams

func DeleteBackendWithParams(params *DeleteBackendParams) error

DeleteBackendWithParams deletes a backend using a params struct.

func DescribeBackend

func DescribeBackend(atmosConfig *schema.AtmosConfiguration, component string, opts interface{}) error

DescribeBackend returns the backend configuration from stack.

func ExecuteProvisioners

func ExecuteProvisioners(
	ctx context.Context,
	event HookEvent,
	atmosConfig *schema.AtmosConfiguration,
	componentConfig map[string]any,
	authContext *schema.AuthContext,
) error

ExecuteProvisioners executes all provisioners registered for a specific hook event. Returns an error if any provisioner fails (fail-fast behavior).

func ListBackends

func ListBackends(atmosConfig *schema.AtmosConfiguration, opts interface{}) error

ListBackends lists all backends in a stack.

func ProvisionWithParams

func ProvisionWithParams(params *ProvisionParams) error

Provision provisions infrastructure resources using a params struct. It validates the provisioner type, loads component configuration, and executes the provisioner.

func RegisterProvisioner

func RegisterProvisioner(p Provisioner) error

RegisterProvisioner registers a provisioner for a specific hook event. Provisioners self-declare when they should run by specifying a hook event. Returns an error if Func is nil or HookEvent is empty.

Types

type DeleteBackendParams

type DeleteBackendParams struct {
	AtmosConfig       *schema.AtmosConfiguration
	Component         string
	Stack             string
	Force             bool
	DescribeComponent ExecuteDescribeComponentFunc
	AuthContext       *schema.AuthContext
}

DeleteBackendParams contains parameters for the DeleteBackend function.

type ExecuteDescribeComponentFunc

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

ExecuteDescribeComponentFunc is a function that describes a component from a stack. This allows us to inject the describe component logic without circular dependencies.

type HookEvent

type HookEvent string

HookEvent represents when a provisioner should run. This is a string type alias compatible with pkg/hooks.HookEvent to avoid circular dependencies. Use pkg/hooks.HookEvent constants (e.g., hooks.BeforeTerraformInit) when registering provisioners.

type ProvisionParams

type ProvisionParams struct {
	AtmosConfig       *schema.AtmosConfiguration
	ProvisionerType   string
	Component         string
	Stack             string
	DescribeComponent ExecuteDescribeComponentFunc
	AuthContext       *schema.AuthContext
}

ProvisionParams contains parameters for the Provision function.

type Provisioner

type Provisioner struct {
	// Type is the provisioner type (e.g., "backend", "component").
	Type string

	// HookEvent declares when this provisioner should run.
	// Must not be empty; use pkg/hooks.HookEvent constants.
	HookEvent HookEvent

	// Func is the provisioning function to execute.
	// Must not be nil.
	Func ProvisionerFunc
}

Provisioner represents a self-registering provisioner. All fields are validated at registration time by RegisterProvisioner.

func GetProvisionersForEvent

func GetProvisionersForEvent(event HookEvent) []Provisioner

GetProvisionersForEvent returns all provisioners registered for a specific hook event.

type ProvisionerFunc

type ProvisionerFunc func(
	ctx context.Context,
	atmosConfig *schema.AtmosConfiguration,
	componentConfig map[string]any,
	authContext *schema.AuthContext,
) error

ProvisionerFunc is a function that provisions infrastructure. It receives the Atmos configuration, component configuration, and auth context. Returns an error if provisioning fails.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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