cloudformation

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangeSet

type ChangeSet struct {
	ChangeSetId     string
	ChangeSetName   string
	StackId         string
	StackName       string
	Status          string
	ExecutionStatus string
	Description     string
	CreationTime    time.Time
}

ChangeSet holds metadata for a CloudFormation change set.

type CloudFormationService

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

CloudFormationService is the cloudmock implementation of the AWS CloudFormation API.

func New

func New(accountID, region string) *CloudFormationService

New returns a new CloudFormationService for the given AWS account ID and region.

func (*CloudFormationService) Actions

func (s *CloudFormationService) Actions() []service.Action

Actions returns the list of CloudFormation API actions supported by this service.

func (*CloudFormationService) GetStackResources

func (s *CloudFormationService) GetStackResources() map[string][]StackResource

GetStackResources returns all resources across all stacks for topology queries.

func (*CloudFormationService) GetStackResourcesSummary

func (s *CloudFormationService) GetStackResourcesSummary() (stackNames []string, resourceTypes [][]string, logicalIDs [][]string)

GetStackResourcesSummary returns parallel slices for topology building.

func (*CloudFormationService) HandleRequest

HandleRequest routes an incoming CloudFormation request to the appropriate handler. CloudFormation uses query-string / form-encoded bodies; the Action is in the form body.

func (*CloudFormationService) HealthCheck

func (s *CloudFormationService) HealthCheck() error

HealthCheck always returns nil (no external dependencies).

func (*CloudFormationService) Name

func (s *CloudFormationService) Name() string

Name returns the AWS service name used for routing.

func (*CloudFormationService) SetLocator

func (s *CloudFormationService) SetLocator(locator ServiceLocator)

SetLocator wires the service locator, enabling real resource provisioning when CreateStack is called.

type Output

type Output struct {
	OutputKey   string
	OutputValue string
	Description string
	ExportName  string
}

Output holds a single CloudFormation stack output.

type Parameter

type Parameter struct {
	ParameterKey   string
	ParameterValue string
}

Parameter holds a single CloudFormation stack parameter.

type ProvisionedResource

type ProvisionedResource struct {
	LogicalId  string
	PhysicalId string // e.g., bucket name, table name, VPC ID
	Type       string
	Attributes map[string]string // for Fn::GetAtt
	Status     string
}

ProvisionedResource holds the result of provisioning a single CFN resource.

type Provisioner

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

Provisioner creates real resources in cloudmock services when a stack is created.

func NewProvisioner

func NewProvisioner(locator ServiceLocator, accountID, region string) *Provisioner

NewProvisioner returns a new Provisioner.

func (*Provisioner) DeleteResources

func (p *Provisioner) DeleteResources(resources []ProvisionedResource)

DeleteResources deletes provisioned resources in reverse dependency order.

func (*Provisioner) ProvisionStack

func (p *Provisioner) ProvisionStack(templateBody string, params map[string]string) ([]ProvisionedResource, error)

ProvisionStack parses a CFN template and creates real resources in dependency order. Returns the list of provisioned resources or an error.

type ServiceLocator

type ServiceLocator interface {
	Lookup(name string) (service.Service, error)
}

ServiceLocator provides access to other cloudmock services for resource provisioning.

type Stack

type Stack struct {
	StackId      string
	StackName    string
	TemplateBody string
	Parameters   []Parameter
	Tags         []Tag
	Outputs      []Output
	StackStatus  string
	CreationTime time.Time
	Description  string
	Resources    []StackResource
	Events       []StackEvent
	ChangeSets   map[string]*ChangeSet // keyed by ChangeSetName
}

Stack holds the full state of a CloudFormation stack.

type StackEvent

type StackEvent struct {
	EventId           string
	StackId           string
	StackName         string
	LogicalResourceId string
	ResourceType      string
	ResourceStatus    string
	Timestamp         time.Time
}

StackEvent represents a single lifecycle event for a stack.

type StackResource

type StackResource struct {
	LogicalResourceId  string
	PhysicalResourceId string
	ResourceType       string
	ResourceStatus     string
	Timestamp          time.Time
}

StackResource represents a resource parsed from the template.

type StackStore

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

StackStore manages all CloudFormation stacks in memory.

func NewStore

func NewStore(accountID, region string) *StackStore

NewStore creates a new StackStore.

func (*StackStore) AllStacks

func (s *StackStore) AllStacks() []*Stack

AllStacks returns all stacks (including DELETE_COMPLETE ones).

func (*StackStore) CreateChangeSet

func (s *StackStore) CreateChangeSet(stackName, changeSetName, description string) (*ChangeSet, error)

CreateChangeSet adds a change set to a stack.

func (*StackStore) CreateStack

func (s *StackStore) CreateStack(name, templateBody string, params []Parameter, tags []Tag) (*Stack, error)

CreateStack creates a new stack by parsing the template and recording metadata. If a provisioner is set, it also creates real resources in cloudmock services. Returns the new Stack or an error.

func (*StackStore) DeleteChangeSet

func (s *StackStore) DeleteChangeSet(stackName, changeSetName string) bool

DeleteChangeSet removes a change set from a stack.

func (*StackStore) DeleteStack

func (s *StackStore) DeleteStack(name string) bool

DeleteStack marks a stack as DELETE_COMPLETE and deletes provisioned resources. Returns false if not found.

func (*StackStore) ExecuteChangeSet

func (s *StackStore) ExecuteChangeSet(stackName, changeSetName string) bool

ExecuteChangeSet marks a change set as EXECUTED.

func (*StackStore) GetChangeSet

func (s *StackStore) GetChangeSet(stackName, changeSetName string) (*ChangeSet, bool)

GetChangeSet retrieves a change set from a stack.

func (*StackStore) GetStack

func (s *StackStore) GetStack(name string) (*Stack, bool)

GetStack returns a stack by name.

func (*StackStore) ListExports

func (s *StackStore) ListExports() []exportEntry

ListExports returns all Outputs that have an ExportName across all live stacks.

func (*StackStore) ListStacks

func (s *StackStore) ListStacks(statusFilters []string) []*Stack

ListStacks returns all stacks, optionally filtered by status.

func (*StackStore) SetProvisioner

func (s *StackStore) SetProvisioner(p *Provisioner)

SetProvisioner sets the resource provisioner for this store. When set, CreateStack will create real resources via cloudmock services.

type Tag

type Tag struct {
	Key   string
	Value string
}

Tag holds a single resource tag.

Jump to

Keyboard shortcuts

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