backend

package
v1.233.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package backend implements the `atmos aws cloudformation backend` verb group: create/describe/update/delete/list for the S3 artifact bucket used by the aws/cloudformation component type's template-packaging flow (a `kind: aws/s3` provision target). It is a verb-for-verb clone of cmd/terraform/backend, targeting the same registered S3 backend type (pkg/provisioner/backend/s3.go's backendTypeS3) — no new backend type is introduced. The Terraform-shape adapter that bridges CFN's `kind: aws/s3` provision-target vocabulary to the Terraform-shaped `backend_type`/`backend` contract pkg/provisioner/backend expects lives in pkg/component/aws/cloudformation/backend.go.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBackendCommand

func GetBackendCommand() *cobra.Command

GetBackendCommand returns the backend command for parent registration.

func ResetDependencies

func ResetDependencies()

ResetDependencies resets dependencies to production defaults (for test cleanup).

func SetConfigInitializer

func SetConfigInitializer(ci ConfigInitializer)

SetConfigInitializer sets the config initializer (for testing). If nil is passed, resets to default implementation.

func SetProvisioner

func SetProvisioner(p Provisioner)

SetProvisioner sets the provisioner (for testing). If nil is passed, resets to default implementation.

Types

type ConfigInitializer

type ConfigInitializer interface {
	// InitConfigAndAuth loads Atmos config and authenticates the active
	// identity for component/stack, returning a ConfigAndStacksInfo carrying
	// the resulting AuthManager/AuthContext (via e.PropagateAuth).
	InitConfigAndAuth(component, stack, identity string) (*schema.AtmosConfiguration, *schema.ConfigAndStacksInfo, error)
	// DescribeComponent returns the real stack-configured component section
	// (including provision.targets) for component/stack, authenticated via
	// info's AuthManager.
	DescribeComponent(atmosConfig *schema.AtmosConfiguration, info *schema.ConfigAndStacksInfo, component, stack string) (map[string]any, error)
	// DescribeComponentStatic returns the component section for component/stack
	// without authenticating and without evaluating templates or YAML functions,
	// for dry runs that must make no AWS calls. It fails for a component or stack
	// that does not exist.
	DescribeComponentStatic(component, stack string) (map[string]any, error)
}

ConfigInitializer abstracts CFN configuration/auth setup and component description for testability. It uses the SDK-native aws/cloudformation component's own auth idiom — e.SetupComponentAuthForCLI + e.PropagateAuth, the same helpers cmd/aws/cloudformation/list.go already calls — rather than cmd/terraform/backend's InitConfigAndAuth (auth.MergeComponentAuthFromConfig + CreateAndAuthenticateManagerWithAtmosConfigForStack), since CFN already has its own established idiom for this in the same command group.

type CreateBackendParams

type CreateBackendParams struct {
	RequestedIdentity string
	AtmosConfig       *schema.AtmosConfiguration
	Component         string
	Stack             string
	ComponentConfig   map[string]any
	AuthContext       *schema.AuthContext
	Target            string
	// contains filtered or unexported fields
}

CreateBackendParams contains parameters for the CreateBackend/UpdateBackend operations.

type DeleteBackendParams

type DeleteBackendParams struct {
	CreateBackendParams
	Force bool
}

DeleteBackendParams contains parameters for the DeleteBackend operation.

type DescribeBackendParams

type DescribeBackendParams struct {
	CreateBackendParams
	Format string
}

DescribeBackendParams contains parameters for the DescribeBackend operation.

type ListBackendsParams

type ListBackendsParams struct {
	RequestedIdentity string
	Stack             string
	AtmosConfig       *schema.AtmosConfiguration
	Component         string
	ComponentConfig   map[string]any
	AuthContext       *schema.AuthContext
	Format            string
}

ListBackendsParams contains parameters for the ListBackends operation.

type Provisioner

type Provisioner interface {
	CreateBackend(ctx context.Context, params *CreateBackendParams) error
	DeleteBackend(ctx context.Context, params *DeleteBackendParams) error
	DescribeBackend(ctx context.Context, params *DescribeBackendParams) error
	ListBackends(ctx context.Context, params *ListBackendsParams) error
	// BackendExists reports whether the target bucket already exists — used by
	// create/update to decide whether a confirmation prompt is needed before
	// reconciling (and overwriting) an existing bucket's defaults.
	BackendExists(ctx context.Context, params *CreateBackendParams) (bool, error)
}

Provisioner abstracts backend provisioning operations for testability.

Jump to

Keyboard shortcuts

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