client

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrStackNotFound = errors.New("stack does not exist")

Functions

This section is empty.

Types

type Cfnctl

type Cfnctl struct {
	AutoApprove       bool
	VarsFile          string
	StackName         string
	ChangesetName     string
	TemplateBody      string
	TemplatePath      string
	Parameters        []types.Parameter
	Output            io.Writer
	Svc               CloudformationAPI
	DoDeleteChangeset bool
}

Cfnctl provides access to all actions in the programs lifecycle

func New

func New(option ...Option) *Cfnctl

New creates a new client

func (*Cfnctl) ApplyChangeSet

func (c *Cfnctl) ApplyChangeSet() error

ApplyChangeSet executes a CloudFormation changeset

func (*Cfnctl) ChangeSetExists

func (c *Cfnctl) ChangeSetExists(stackName, changesetName string) (bool, error)

ChangeSetExists checks whether a CloudFormation changeset exists or not

func (*Cfnctl) CreateChangeSet

func (c *Cfnctl) CreateChangeSet() error

CreateChangeSet creates a CloudFormation changeset

func (*Cfnctl) DeleteChangeSet

func (c *Cfnctl) DeleteChangeSet() error

DeleteChangeSet deletes a CloudFormation changeset

func (*Cfnctl) DescribeChangeSet

func (c *Cfnctl) DescribeChangeSet() ([]types.Change, error)

DescribeChangeSet describes a CloudFormation changeset

func (*Cfnctl) DescribeStack

func (c *Cfnctl) DescribeStack() (string, error)

DescribeStack describes a CloudFormation stack If the stack doesn't exist, an ValidationError is returned.

func (*Cfnctl) DescribeStackResources

func (c *Cfnctl) DescribeStackResources() ([]types.StackResource, error)

DescribeStackResources describes the resources from a particular CloudFormation stack

func (*Cfnctl) DestroyStack

func (c *Cfnctl) DestroyStack() error

Deletes a specified stack. Once the call completes successfully, stack deletion starts. Deleted stacks do not show up in the DescribeStacks API if the deletion has been completed successfully

func (*Cfnctl) IsStackCreated

func (c *Cfnctl) IsStackCreated() (bool, error)

IsStackCreated checks whether a CloudFormation stack is created or not

func (*Cfnctl) ListChangeSet

func (c *Cfnctl) ListChangeSet() (types.ChangeSetStatus, error)

ListChangeSet lists all changesets. Can be used to get status if changeset created or not

func (*Cfnctl) ListExportValues

func (c *Cfnctl) ListExportValues() ([]types.Export, error)

func (*Cfnctl) ValidateCFTemplate

func (c *Cfnctl) ValidateCFTemplate() error

ValidateCFTemplate validates a particular CloudFormation template

type CloudformationAPI

type CloudformationAPI interface {
	ExecuteChangeSet(ctx context.Context, params *cloudformation.ExecuteChangeSetInput, optFns ...func(*cloudformation.Options)) (*cloudformation.ExecuteChangeSetOutput, error)
	CreateChangeSet(ctx context.Context, params *cloudformation.CreateChangeSetInput, optFns ...func(*cloudformation.Options)) (*cloudformation.CreateChangeSetOutput, error)
	DescribeChangeSet(ctx context.Context, params *cloudformation.DescribeChangeSetInput, optFns ...func(*cloudformation.Options)) (*cloudformation.DescribeChangeSetOutput, error)
	DeleteChangeSet(ctx context.Context, params *cloudformation.DeleteChangeSetInput, optFns ...func(*cloudformation.Options)) (*cloudformation.DeleteChangeSetOutput, error)
	DescribeStacks(ctx context.Context, params *cloudformation.DescribeStacksInput, optFns ...func(*cloudformation.Options)) (*cloudformation.DescribeStacksOutput, error)
	DescribeStackResources(ctx context.Context, params *cloudformation.DescribeStackResourcesInput, optFns ...func(*cloudformation.Options)) (*cloudformation.DescribeStackResourcesOutput, error)
	ListChangeSets(ctx context.Context, params *cloudformation.ListChangeSetsInput, optFns ...func(*cloudformation.Options)) (*cloudformation.ListChangeSetsOutput, error)
	ListStacks(ctx context.Context, params *cloudformation.ListStacksInput, optFns ...func(*cloudformation.Options)) (*cloudformation.ListStacksOutput, error)
	ValidateTemplate(ctx context.Context, params *cloudformation.ValidateTemplateInput, optFns ...func(*cloudformation.Options)) (*cloudformation.ValidateTemplateOutput, error)
	ListExports(ctx context.Context, params *cloudformation.ListExportsInput, optFns ...func(*cloudformation.Options)) (*cloudformation.ListExportsOutput, error)
	DeleteStack(ctx context.Context, params *cloudformation.DeleteStackInput, optFns ...func(*cloudformation.Options)) (*cloudformation.DeleteStackOutput, error)
}

CloudformationAPI provides access to AWS CloudFormation API

type Option

type Option func(*Cfnctl)

Option is used to implement Option Pattern on the client

func WithAutoApprove

func WithAutoApprove(b bool) Option

WithAutoApprove provides access creating a new client

func WithChangesetName

func WithChangesetName(changesetName string) Option

WithChangesetName provides access creating a new client

func WithOutput

func WithOutput(out io.Writer) Option

WithOutput provides access creating a new client

func WithStackName

func WithStackName(stackName string) Option

WithStackName provides access creating a new client

func WithSvc

func WithSvc(svc CloudformationAPI) Option

WithSvc provides access creating a new client

func WithTemplateBody

func WithTemplateBody(file string) Option

WithTemplateBody provides access creating a new client

func WithTemplatePath

func WithTemplatePath(filePath string) Option

WithTemplatePath provides access creating a new client

func WithVarsFile

func WithVarsFile(varsFile string) Option

WithVarsFile provides access creating a new client

Jump to

Keyboard shortcuts

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