stack

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2015 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTimeout = fmt.Errorf("timeout")
View Source
var Region = "us-east-1"

Functions

func DefaultGalaxyTemplate

func DefaultGalaxyTemplate() []byte

Return a default template to create our base stack.

func Exists

func Exists(name string) (bool, error)

func GalaxyTemplate

func GalaxyTemplate(params *GalaxyTmplParams) ([]byte, error)

func GetAWSRegion

func GetAWSRegion(region string) (*aws.Region, error)

func GetStackVPC

func GetStackVPC(stackName string) (string, error)

func GetTemplate

func GetTemplate(name string) ([]byte, error)

func ListActive

func ListActive() ([]string, error)

return a list of all actives stacks

func ListFailures

func ListFailures(id string, since time.Time) ([]string, error)

List failures on a stack as "STATUS:REASON"

func SetPolicy

func SetPolicy(name string, policy []byte) error

set a stack policy TODO: add delete policy

func Wait

func Wait(name string, timeout time.Duration) error

Wait for a stack event to complete. Poll every 5s while the stack is in the CREATE_IN_PROGRESS or UPDATE_IN_PROGRESS state, and succeed when it enters a successful _COMPLETE state. Return and error of ErrTimeout if the timeout is reached.

func WaitForComplete

func WaitForComplete(id string, timeout time.Duration) error

Like the Wait function, but instead if returning as soon as there is an error, always wait for a final status. ** This assumes all _COMPLETE statuses are final, and all final statuses end

in _COMPLETE.

Types

type AvailabilityZoneInfo

type AvailabilityZoneInfo struct {
	Name   string `xml:"zoneName"`
	State  string `xml:"zoneState"`
	Region string `xml:"regionName"`
}

type CreateStackResponse

type CreateStackResponse struct {
	RequestId string `xml:"ResponseMetadata>RequestId"`
	StackId   string `xml:"CreateStackResult>StackId"`
}

func Create

func Create(name string, stackTmpl []byte, options map[string]string) (*CreateStackResponse, error)

Create a CloudFormation stack Request parameters which are taken from the options:

StackPolicyDuringUpdateBody: optional update policy
tag.KEY: tags to be applied to this stack at creation

type DeleteStackResponse

type DeleteStackResponse struct {
	RequestId string `xml:"ResponseMetadata>RequestId"`
}

func Delete

func Delete(name string) (*DeleteStackResponse, error)

Delete and entire stack by name

type DescribeAvailabilityZonesResponse

type DescribeAvailabilityZonesResponse struct {
	RequestId         string                 `xml:"requestId"`
	AvailabilityZones []AvailabilityZoneInfo `xml:"availabilityZoneInfo>item"`
}

func DescribeAvailabilityZones

func DescribeAvailabilityZones(region string) (DescribeAvailabilityZonesResponse, error)

type DescribeStackEventsResult

type DescribeStackEventsResult struct {
	Events []stackEvent `xml:"DescribeStackEventsResult>StackEvents>member"`
}

func DescribeStackEvents

func DescribeStackEvents(name string) (DescribeStackEventsResult, error)

Describe a Stack's Events

type DescribeStacksResponse

type DescribeStacksResponse struct {
	RequestId string             `xml:"ResponseMetadata>RequestId"`
	Stacks    []stackDescription `xml:"DescribeStacksResult>Stacks>member"`
}

func DescribeStacks

func DescribeStacks(name string) (DescribeStacksResponse, error)

Describe all running stacks

type DescribeSubnetsResponse

type DescribeSubnetsResponse struct {
	RequestId string   `xml:"requestId"`
	Subnets   []Subnet `xml:"subnetSet>item"`
}

func DescribeSubnets

func DescribeSubnets(vpcID, region string) (DescribeSubnetsResponse, error)

type FailuresError

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

thie error type also provides a list of failures from the stack's events

func (*FailuresError) Error

func (f *FailuresError) Error() string

The basic Error returns the oldest failure in the list

func (*FailuresError) List

func (f *FailuresError) List() []string

type GalaxyTmplParams

type GalaxyTmplParams struct {
	Name                   string
	VPCCIDR                string
	ControllerImageId      string
	ControllerInstanceType string
	PoolImageId            string
	PoolInstanceType       string
	KeyName                string
	Subnets                []*SubnetTmplParams
}

func (*GalaxyTmplParams) AZList

func (p *GalaxyTmplParams) AZList() string

func (*GalaxyTmplParams) SubnetRefList

func (p *GalaxyTmplParams) SubnetRefList() string

Format the subnet names into a list of "Ref" intrinsics

type GetTemplateResponse

type GetTemplateResponse struct {
	TemplateBody []byte `xml:"GetTemplateResult>TemplateBody"`
}

type ListServerCertsResponse

type ListServerCertsResponse struct {
	RequestId string       `xml:"ResponseMetadata>RequestId"`
	Certs     []serverCert `xml:"ListServerCertificatesResult>ServerCertificateMetadataList>member"`
}

func ListServerCertificates

func ListServerCertificates() (ListServerCertsResponse, error)

Get a list of SSL certificates from the IAM service. Cloudformation templates need to reference certs via their ARNs.

type ListStackResourcesResponse

type ListStackResourcesResponse struct {
	RequestId string          `xml:"ResponseMetadata>RequestId"`
	Resources []stackResource `xml:"ListStackResourcesResult>StackResourceSummaries>member"`
}

func ListStackResources

func ListStackResources(stackName string) (ListStackResourcesResponse, error)

List all resources associated with stackName

type ListStacksResponse

type ListStacksResponse struct {
	Stacks []stackSummary `xml:"ListStacksResult>StackSummaries>member"`
}

func List

func List() (ListStacksResponse, error)

List all stacks This lists all stacks including inactive and deleted.

type Pool

type Pool struct {
	// The *Template attributes hold the pre-initialed types from the pool
	// template.  These are not serialized to json, and should be used to
	// create the proper Resources.
	ASGTemplate *asg `json:"-"`
	ELBTemplate *elb `json:"-"`
	LCTemplate  *lc  `json:"-"`

	AWSTemplateFormatVersion string
	Description              string
	Resources                map[string]interface{}
}

A Pool can be marshaled directly into a Cloudformation template for our pools. This is Purposely constrained to our usage, with some values specifically using intrinsic functions, and other assumed prerequisites. This should only matter if the poolTmpl is modified, or we attempt to update an arbitrarily added pool template.

func GetPool

func GetPool(name string) (*Pool, error)

Lookup and unmarshal an existing stack into a Pool

func NewPool

func NewPool() *Pool

func (*Pool) ASG

func (p *Pool) ASG() *asg

func (*Pool) ELB

func (p *Pool) ELB() *elb

func (*Pool) LC

func (p *Pool) LC() *lc

func (*Pool) SetCPUAutoScaling

func (p *Pool) SetCPUAutoScaling(asgName string, adj, scaleUpCPU, scaleUpDelay, scaleDownCPU, scaleDownDelay int)

Add the appropriate Alarms and ScalingPolicies to autoscale a pool based on avg CPU usage

func (*Pool) UnmarshalJSON

func (p *Pool) UnmarshalJSON(b []byte) error

type SharedResources

type SharedResources struct {
	SecurityGroups map[string]string
	Roles          map[string]string
	Parameters     map[string]string
	ServerCerts    map[string]string
	Subnets        []Subnet
	VPCID          string
}

Resources from the base stack that may need to be referenced from other stacks

func GetSharedResources

func GetSharedResources(stackName string) (SharedResources, error)

Return the SharedResources from our base stack that are needed for pool stacks. We need the IDs for subnets and security groups, since they cannot be referenced by name in a VPC. We also lookup the IAM instance profile created by the base stack for use in pool's launch configs. This could be cached to disk so that we don't need to lookup the base stack to build a pool template.

func (SharedResources) ListSubnets

func (s SharedResources) ListSubnets() []string

Return a list of the subnet values.

type Subnet

type Subnet struct {
	ID                        string `xml:"subnetId"`
	State                     string `xml:"state"`
	VPCID                     string `xml:"vpcId"`
	CIDRBlock                 string `xml:"cidrBlock"`
	AvailableIPAddressesCount int    `xml:"availableIpAddressCount"`
	AvailabilityZone          string `xml:"availabilityZone"`
	DefaultForAZ              bool   `xml:"defaultForAz"`
	MapPublicIPOnLaunch       bool   `xml:"mapPublicIpOnLaunch"`
}

type SubnetTmplParams

type SubnetTmplParams struct {
	Name   string
	Subnet string
	AZ     string
}

type UpdateStackResponse

type UpdateStackResponse struct {
	RequestId string `xml:"ResponseMetadata>RequestId"`
	StackId   string `xml:"UpdateStackResult>StackId"`
}

func Update

func Update(name string, stackTmpl []byte, options map[string]string) (*UpdateStackResponse, error)

Update an existing CloudFormation stack. Request parameters which are taken from the options:

StackPolicyDuringUpdateBody

Jump to

Keyboard shortcuts

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