cloudformation

package
v1.33.3 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package cloudformation provides a client to make API requests to AWS CloudFormation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseTemplateDescriptions added in v1.1.0

func ParseTemplateDescriptions(body string) (descriptionFor map[string]string, err error)

ParseTemplateDescriptions parses a YAML CloudFormation template to retrieve all human readable descriptions associated with a resource. It assumes that all description comments are defined immediately under the logical ID of the resource.

For example, if a resource in a template is defined as:

Cluster:
  # An ECS Cluster to hold your services.
  Type: AWS::ECS::Cluster

The output will be descriptionFor["Cluster"] = "An ECS Cluster to hold your services."

Types

type ChangeSetDescription added in v1.1.0

type ChangeSetDescription struct {
	ExecutionStatus string
	StatusReason    string
	CreationTime    time.Time
	Changes         []*cloudformation.Change
}

ChangeSetDescription is the output of the DescribeChangeSet action.

type CloudFormation

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

CloudFormation represents a client to make requests to AWS CloudFormation.

func New

New creates a new CloudFormation client.

func (*CloudFormation) CancelUpdateStack added in v1.29.0

func (c *CloudFormation) CancelUpdateStack(stackName string) error

CancelUpdateStack attempts to cancel the update for a CloudFormation stack specified by the stackName. Returns an error if failed to cancel CloudFormation stack update.

func (*CloudFormation) Create

func (c *CloudFormation) Create(stack *Stack) (changeSetID string, err error)

Create deploys a new CloudFormation stack using Change Sets. If the stack already exists in a failed state, deletes the stack and re-creates it.

func (*CloudFormation) CreateAndWait

func (c *CloudFormation) CreateAndWait(stack *Stack) error

CreateAndWait calls Create and then WaitForCreate.

func (*CloudFormation) Delete

func (c *CloudFormation) Delete(stackName string) error

Delete removes an existing CloudFormation stack. If the stack doesn't exist then do nothing.

func (*CloudFormation) DeleteAndWait

func (c *CloudFormation) DeleteAndWait(stackName string) error

DeleteAndWait calls Delete then blocks until the stack is deleted or until the max attempt window expires.

func (*CloudFormation) DeleteAndWaitWithRoleARN added in v0.5.0

func (c *CloudFormation) DeleteAndWaitWithRoleARN(stackName, roleARN string) error

DeleteAndWaitWithRoleARN is DeleteAndWait but with a role ARN that AWS CloudFormation assumes to delete the stack.

func (*CloudFormation) Describe

func (c *CloudFormation) Describe(name string) (*StackDescription, error)

Describe returns a description of an existing stack. If the stack does not exist, returns ErrStackNotFound.

func (*CloudFormation) DescribeChangeSet added in v1.1.0

func (c *CloudFormation) DescribeChangeSet(changeSetID, stackName string) (*ChangeSetDescription, error)

DescribeChangeSet gathers and returns all changes for a change set.

func (*CloudFormation) ErrorEvents added in v0.6.0

func (c *CloudFormation) ErrorEvents(stackName string) ([]StackEvent, error)

ErrorEvents returns the list of events with "failed" status in **chronological order**

func (*CloudFormation) Events

func (c *CloudFormation) Events(stackName string) ([]StackEvent, error)

Events returns the list of stack events in **chronological** order.

func (*CloudFormation) Exists added in v1.5.0

func (c *CloudFormation) Exists(name string) (bool, error)

Exists returns true if the CloudFormation stack exists, false otherwise. If an error occurs for another reason than ErrStackNotFound, then returns the error.

func (*CloudFormation) ListStacksWithTags added in v1.1.0

func (c *CloudFormation) ListStacksWithTags(tags map[string]string) ([]StackDescription, error)

ListStacksWithTags returns all the stacks in the current AWS account and region with the specified matching tags. If a tag key is provided but the value is empty, the method will match tags with any value for the given key.

func (*CloudFormation) Metadata added in v1.5.0

func (c *CloudFormation) Metadata(opt MetadataOpts) (string, error)

Metadata returns the Metadata property of the CloudFormation stack(set)'s template. If the stack does not exist, returns ErrStackNotFound.

func (*CloudFormation) Outputs added in v1.3.0

func (c *CloudFormation) Outputs(stack *Stack) (map[string]string, error)

Outputs returns the outputs of a stack description.

func (*CloudFormation) StackResources added in v1.5.0

func (c *CloudFormation) StackResources(name string) ([]*StackResource, error)

StackResources returns the list of resources created as part of a CloudFormation stack.

func (*CloudFormation) TemplateBody added in v0.5.0

func (c *CloudFormation) TemplateBody(name string) (string, error)

TemplateBody returns the template body of an existing stack. If the stack does not exist, returns ErrStackNotFound.

func (*CloudFormation) TemplateBodyFromChangeSet added in v1.1.0

func (c *CloudFormation) TemplateBodyFromChangeSet(changeSetID, stackName string) (string, error)

TemplateBodyFromChangeSet returns the template body of a stack based on a change set. If the stack does not exist, then returns ErrStackNotFound.

func (*CloudFormation) Update

func (c *CloudFormation) Update(stack *Stack) (changeSetID string, err error)

Update updates an existing CloudFormation with the new configuration. If there are no changes for the stack, deletes the empty change set and returns ErrChangeSetEmpty.

func (*CloudFormation) UpdateAndWait

func (c *CloudFormation) UpdateAndWait(stack *Stack) error

UpdateAndWait calls Update and then blocks until the stack is updated or until the max attempt window expires.

func (*CloudFormation) WaitForCreate

func (c *CloudFormation) WaitForCreate(ctx context.Context, stackName string) error

WaitForCreate blocks until the stack is created or until the max attempt window expires.

func (*CloudFormation) WaitForUpdate added in v0.5.0

func (c *CloudFormation) WaitForUpdate(ctx context.Context, stackName string) error

WaitForUpdate blocks until the stack is updated or until the max attempt window expires.

type ErrChangeSetEmpty

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

ErrChangeSetEmpty occurs when the change set does not contain any new or updated resources.

func NewMockErrChangeSetEmpty added in v1.10.0

func NewMockErrChangeSetEmpty() *ErrChangeSetEmpty

NewMockErrChangeSetEmpty creates a mock ErrChangeSetEmpty.

func (*ErrChangeSetEmpty) Error

func (e *ErrChangeSetEmpty) Error() string

type ErrChangeSetNotExecutable added in v0.6.0

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

ErrChangeSetNotExecutable occurs when the change set cannot be executed.

func (*ErrChangeSetNotExecutable) Error added in v0.6.0

func (e *ErrChangeSetNotExecutable) Error() string

type ErrStackAlreadyExists

type ErrStackAlreadyExists struct {
	Name  string
	Stack *StackDescription
}

ErrStackAlreadyExists occurs when a CloudFormation stack already exists with a given name.

func (*ErrStackAlreadyExists) Error

func (e *ErrStackAlreadyExists) Error() string

type ErrStackNotFound

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

ErrStackNotFound occurs when a CloudFormation stack does not exist.

func (*ErrStackNotFound) Error

func (e *ErrStackNotFound) Error() string

type ErrStackUpdateInProgress added in v0.5.0

type ErrStackUpdateInProgress struct {
	Name string
}

ErrStackUpdateInProgress occurs when we try to update a stack that's already being updated.

func (*ErrStackUpdateInProgress) Error added in v0.5.0

func (e *ErrStackUpdateInProgress) Error() string

type MetadataOpts added in v1.5.0

MetadataOpts sets up optional parameters for Metadata function.

func MetadataWithStackName added in v1.5.0

func MetadataWithStackName(name string) MetadataOpts

MetadataWithStackName sets up the stack name for cloudformation.GetTemplateSummaryInput.

func MetadataWithStackSetName added in v1.5.0

func MetadataWithStackSetName(name string) MetadataOpts

MetadataWithStackSetName sets up the stack set name for cloudformation.GetTemplateSummaryInput.

type Stack

type Stack struct {
	Name string
	// contains filtered or unexported fields
}

Stack represents a AWS CloudFormation stack.

func NewStack

func NewStack(name, template string, opts ...StackOption) *Stack

NewStack creates a stack with the given name and template body.

func NewStackWithURL added in v1.7.0

func NewStackWithURL(name, templateURL string, opts ...StackOption) *Stack

NewStackWithURL creates a stack with a URL to the template.

type StackDescription

type StackDescription cloudformation.Stack

StackDescription is an alias the SDK's Stack type.

func (*StackDescription) SDK

SDK returns the underlying struct from the AWS SDK.

type StackEvent

type StackEvent cloudformation.StackEvent

StackEvent is an alias the SDK's StackEvent type.

type StackOption

type StackOption func(s *Stack)

StackOption allows you to initialize a Stack with additional properties.

func WithDisableRollback added in v1.16.0

func WithDisableRollback() StackOption

WithDisableRollback disables CloudFormation's automatic stack rollback upon failure for the stack.

func WithParameters

func WithParameters(params map[string]string) StackOption

WithParameters passes parameters to a stack.

func WithRoleARN

func WithRoleARN(roleARN string) StackOption

WithRoleARN specifies the role that CloudFormation will assume when creating the stack.

func WithTags

func WithTags(tags map[string]string) StackOption

WithTags applies the tags to a stack.

type StackResource added in v1.5.0

type StackResource cloudformation.StackResource

StackResource is an alias the SDK's StackResource type.

type StackStatus added in v0.6.0

type StackStatus string

StackStatus represents the status of a stack.

func (StackStatus) InProgress added in v0.6.0

func (ss StackStatus) InProgress() bool

InProgress returns true if the stack is currently being updated.

func (StackStatus) IsFailure added in v1.21.1

func (ss StackStatus) IsFailure() bool

IsFailure returns true if the resource failed to mutate.

func (StackStatus) IsSuccess added in v1.21.1

func (ss StackStatus) IsSuccess() bool

IsSuccess returns true if the resource mutated successfully.

func (StackStatus) String added in v1.21.1

func (ss StackStatus) String() string

String implements the fmt.Stringer interface.

func (StackStatus) UpsertInProgress added in v1.2.0

func (ss StackStatus) UpsertInProgress() bool

UpsertInProgress returns true if the resource is updating or being created.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
Package stackset provides a client to make API requests to an AWS CloudFormation StackSet resource.
Package stackset provides a client to make API requests to an AWS CloudFormation StackSet resource.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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