plugin

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StackModeCreate = "create"
	StackModeDelete = "delete"
	StackModeUpdate = "update"
)
View Source
const (
	// replace latest by the version when releasing the plugin
	DefaultTemplateURL = "https://s3.amazonaws.com/io-amp-binaries/templates/v0.18.0/aws-swarm-asg.yml"
)

Variables

This section is empty.

Functions

func PluginOutputToJSON

func PluginOutputToJSON(ev *StackEvent, so []StackOutput, e error) (string, error)

PluginOutputToJSON is a helper function that wrap an event, an error or a slice of StackOutput to a JSON string representation of PluginOutput

Types

type AWSPlugin added in v0.18.0

type AWSPlugin struct {
	Config *Configuration
	// contains filtered or unexported fields
}

AWSPlugin is the AWS plugin

var (
	Config = &Configuration{
		OnFailure:   "DO_NOTHING",
		Params:      []string{},
		TemplateURL: DefaultTemplateURL,
		Profile:     "default",
	}
	AWS *AWSPlugin
)

func New added in v0.18.0

func New(config *Configuration) *AWSPlugin

New returns a new AWS Plugin instance

func (*AWSPlugin) CreateStack added in v0.18.0

func (p *AWSPlugin) CreateStack(ctx context.Context, timeout int64) (*cloudformation.CreateStackOutput, error)

CreateStack starts the AWS stack creation operation The operation will return immediately

func (*AWSPlugin) DeleteStack added in v0.18.0

DeleteStack starts the delete operation The operation will return immediately

func (*AWSPlugin) InfoStack added in v0.18.0

func (p *AWSPlugin) InfoStack(ctx context.Context) ([]StackOutput, error)

InfoStack returns the output information that was produced when the stack was created or updated

func (*AWSPlugin) ListStack added in v0.18.0

ListStack lists the stacks based on the filter on stack status

func (*AWSPlugin) ScanEvents added in v0.18.0

func (p *AWSPlugin) ScanEvents(mode string) error

used by the create function to parse the events and send meaningful information to the CLI

func (*AWSPlugin) UpdateStack added in v0.18.0

UpdateStack starts the update operation The operation will return immediately

type Configuration added in v0.18.0

type Configuration struct {
	// OnFailure determines what happens if stack creations fails.
	// Valid values are: "DO_NOTHING", "ROLLBACK", "DELETE"
	// Default: "ROLLBACK"
	OnFailure string
	// Params are for parameters supported by the CloudFormation template that will be used
	Params []string
	// Page is for aws requests that return paged information (pages start at 1)
	Page int
	// Region is the AWS region, ex: us-west-2
	Region string
	// StackName is the user-supplied name for identifying the stack
	StackName string
	// Sync, if true, causes the create operation to block until finished
	Sync bool
	// TemplateURL is the URL for the AWS CloudFormation to use
	TemplateURL string
	// AWS Access Key ID
	AccessKeyId string
	// AWS Secret Access Key
	SecretAccessKey string
	// AWS Profile
	Profile string
}

Configuration stores raw request input options before transformation into a AWS SDK specific structs used by the cloudformation api.

type PluginOutput

type PluginOutput struct {
	Output []StackOutput `json:"Output"`
	Event  *StackEvent   `json:"Event"`
	Error  string        `json:"Error"`
}

PluginOutput contains the stack output, the stack events and the errors that the plugin will transmit to the CLI. it's not a single envelop, it can be repeated

type StackEvent

type StackEvent struct {
	ClientRequestToken   string `json:"ClientRequestToken"`
	EventId              string `json:"EventId"`
	LogicalResourceId    string `json:"LogicalResourceId"`
	PhysicalResourceId   string `json:"PhysicalResourceId"`
	ResourceProperties   string `json:"ResourceProperties"`
	ResourceStatus       string `json:"ResourceStatus"`
	ResourceStatusReason string `json:"ResourceStatusReason"`
	ResourceType         string `json:"ResourceType"`
	StackId              string `json:"StackId"`
	StackName            string `json:"StackName"`
	Timestamp            string `json:"Timestamp"`
}

StackEvent contains the converted event from the create stack operation Similar to the structure from the aws SDK Meant to be included in PluginOutput

type StackOutput

type StackOutput struct {
	// Description is the user defined description associated with the output
	Description string `json:"description"`
	// OutputKey is the key associated with the output
	OutputKey string `json:"key"`
	// OutputValue is the value associated with the output
	OutputValue string `json:"value"`
}

StackOutput contains the converted output from the create stack operation Meant to be included in PluginOutput

Jump to

Keyboard shortcuts

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