cloudformation

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2021 License: Apache-2.0 Imports: 11 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) 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) 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) 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) 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 (*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 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.

type StackDescription

type StackDescription cloudformation.Stack

StackDescription represents an existing AWS CloudFormation stack.

func (*StackDescription) SDK

SDK returns the underlying struct from the AWS SDK.

type StackEvent

type StackEvent cloudformation.StackEvent

StackEvent represents a stack event for a resource.

type StackOption

type StackOption func(s *Stack)

StackOption allows you to initialize a Stack with additional properties.

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 StackStatus added in v0.6.0

type StackStatus string

StackStatus represents the status of a stack.

func (StackStatus) Failure added in v1.1.0

func (ss StackStatus) Failure() bool

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) Success added in v1.1.0

func (ss StackStatus) Success() bool

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