cfn

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ChangeSetStatusNotFound is the State of change set,
	// when change set is not found.
	ChangeSetStatusNotFound = "CHANGE_SET_NOT_FOUND"
)
View Source
const (
	// StackStatusNotFound is the State of the stack
	// when stack does not exists.
	StackStatusNotFound = "STACK_NOT_FOUND"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangeSet

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

ChangeSet represents that AWS CloudFormation change set resoruce.

func CreateChangeSet

func CreateChangeSet(conn cloudformationiface.CloudFormationAPI, csData *ChangeSetData) (*ChangeSet, error)

CreateChangeSet creates new ChangeSet described by csData argument.

func NewChangeSet

func NewChangeSet(conn cloudformationiface.CloudFormationAPI, csData *ChangeSetData) (*ChangeSet, error)

NewChangeSet creates new ChangeSet object from existing AWS CloudFormation changeset.

func (*ChangeSet) Data

func (cs *ChangeSet) Data() *ChangeSetData

Data returns the change set data.

func (*ChangeSet) Execute

func (cs *ChangeSet) Execute() error

Execute invokes AWS CloudFormation ExecuteChangeSet API.

func (*ChangeSet) Wait

func (cs *ChangeSet) Wait(config ChangeSetWaitConfig)

Wait function periodically reads change set data and invokes the config.Callback function. Waiter will stop if one of following hapenes:

  • Error occurred when reading data
  • Callback returns false
  • Closer is closed

CloseOnEnd and CloseOnError options indicate if Closer should be closed and if Closer should be closed when there is an error while reading.

type ChangeSetData

type ChangeSetData struct {
	ID              string
	Name            string
	Status          string
	StatusReason    string
	ExecutionStatus string
	StackData       *StackData

	IsNew   bool
	Changes []*cloudformation.ResourceChange
}

ChangeSetData is the data structure containing change set information.

func (ChangeSetData) Exists

func (c ChangeSetData) Exists() bool

Exists indicates if change set exists.

func (ChangeSetData) IsComplete

func (c ChangeSetData) IsComplete() bool

IsComplete indicates if change set is in completed state.

func (ChangeSetData) IsExecutable

func (c ChangeSetData) IsExecutable() bool

IsExecutable indicates if change set can be executed.

func (ChangeSetData) IsFailed

func (c ChangeSetData) IsFailed() bool

IsFailed indicates if change set is in failed state. Note, that if change set doesn't contain any changes, false is returned.

func (ChangeSetData) IsInProgress

func (c ChangeSetData) IsInProgress() bool

IsInProgress indicates if change set is currently being updated.

type ChangeSetWaitConfig

type ChangeSetWaitConfig struct {
	// Callback is the function which is called
	// each time there is an update.
	Callback ChangeSetWaitFunc

	// Closer is used to stop waiting when
	// it is closed or close it depending
	// on values of CloseOnEnd and CloseOnError
	Closer *closer.Closer

	// CloseOnEnd is an option to close the Closer
	// when waiter finishes.
	CloseOnEnd bool

	// CloseOnError is an option to close the Closer
	// in case of error.
	CloseOnError bool
}

ChangeSetWaitConfig is the waiter configuration for change set.

type ChangeSetWaitFunc

type ChangeSetWaitFunc func(*ChangeSetData) (again bool, err error)

ChangeSetWaitFunc is the callback function type which is called to verify change set updates.

type Stack

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

Stack represents AWS CloudFormation stack resource.

func NewStack

func NewStack(cfnconn cloudformationiface.CloudFormationAPI, name string) (*Stack, error)

NewStack creates new Stack.

func (*Stack) Data

func (s *Stack) Data() *StackData

Data returns the stack data.

func (*Stack) Destroy

func (s *Stack) Destroy() error

Destroy invokes AWS CloudFormation DeleteStack API.

func (*Stack) Wait

func (s *Stack) Wait(config StackWaitConfig)

Wait function periodically reads stack data and invokes the config.Callback function. Waiter will stop if one of following hapenes:

  • Error occurred when reading data
  • Callback returns false
  • Closer is closed

CloseOnEnd and CloseOnError options indicate if Closer should be closed and if Closer should be closed when there is an error while reading.

type StackData

type StackData struct {
	// ID is the resource id of the stack.
	// If stack does not exists, the value is empty string.
	ID string

	// Name of cloudformation stack. This field is always set.
	Name         string
	Description  string
	RoleARN      string
	Capabilities []string

	Parameters map[string]string
	Tags       map[string]string

	// Used for update only
	TemplateURL  string
	TemplateBody string

	// Set only after reading the stack.
	Status       string
	StatusReason string
	Outputs      map[string]string
}

StackData is a data structure containing stack information.

func (StackData) Exists

func (sd StackData) Exists() bool

Exists indicates if stack exists.

func (StackData) IsComplete

func (sd StackData) IsComplete() bool

IsComplete indicates if stack have completed last operation.

func (StackData) IsFailed

func (sd StackData) IsFailed() bool

IsFailed indicates if stack has failed last operation.

func (StackData) IsInProgress

func (sd StackData) IsInProgress() bool

IsInProgress indicates if stack is currently being updated.

func (StackData) IsReviewInProgress

func (sd StackData) IsReviewInProgress() bool

IsReviewInProgress indicates if stack is in review process, (stack is first time created by change set).

func (StackData) IsRollback

func (sd StackData) IsRollback() bool

IsRollback indicates if stack is in any rollback state.

type StackEventData

type StackEventData struct {
	EventID              string
	LogicalResourceID    string
	PhysicalResourceID   string
	ResourceProperties   string
	ResourceStatus       string
	ResourceStatusReason string
	ResourceType         string
	StackID              string
	StackName            string
}

StackEventData is the data structure containing stack event information.

func (StackEventData) IsComplete

func (c StackEventData) IsComplete() bool

IsComplete indicates if resource in event is in completed state.

type StackEvents

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

StackEvents tracks events on single stack. It keeps internal identifier on last seen event and will notify only new events.

func NewStackEvents

func NewStackEvents(cfnconn cloudformationiface.CloudFormationAPI, name string) (*StackEvents, error)

NewStackEvents creates new StackEvents and moves the last event identifier to the last event of currently available events.

func (*StackEvents) Wait

func (se *StackEvents) Wait(config StackEventsWaitConfig)

Wait function periodically reads new stack events and invokes the config.Callback function for each of them. Waiter will stop if one of following hapenes:

  • Error occurred when reading data
  • Callback returns false
  • Closer is closed

CloseOnEnd and CloseOnError options indicate if Closer should be closed and if Closer should be closed when there is an error while reading.

type StackEventsWaitConfig

type StackEventsWaitConfig struct {
	// Callback is the function which is called
	// each time there is an update.
	Callback StackEventsWaitFunc

	// Closer is used to stop waiting when
	// it is closed or close it depending
	// on values of CloseOnEnd and CloseOnError
	Closer *closer.Closer

	// CloseOnEnd is an option to close the Closer
	// when waiter finishes.
	CloseOnEnd bool

	// CloseOnError is an option to close the Closer
	// in case of error.
	CloseOnError bool
}

StackEventsWaitConfig is the waiter configuration for stack.

type StackEventsWaitFunc

type StackEventsWaitFunc func(*StackEventData) (again bool, err error)

StackEventsWaitFunc is the callback function type which is called to notify about new stack events.

type StackWaitConfig

type StackWaitConfig struct {
	// Callback is the function which is called
	// each time there is an update.
	Callback StackWaitFunc

	// Closer is used to stop waiting when
	// it is closed or close it depending
	// on values of CloseOnEnd and CloseOnError
	Closer *closer.Closer

	// CloseOnEnd is an option to close the Closer
	// when waiter finishes.
	CloseOnEnd bool

	// CloseOnError is an option to close the Closer
	// in case of error.
	CloseOnError bool
}

StackWaitConfig is the waiter configuration for stack.

type StackWaitFunc

type StackWaitFunc func(*StackData) (again bool, err error)

StackWaitFunc is the callback function type which is called to verify stack updates.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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