stacks

package
v0.82.1 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2021 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// OutputRegex for printing yaml/json output
	OutputRegex = `(?m)^[ -]*([^\r\n:]+?)\s*:[ \n\r\s]`
)

Functions

func DeployHandler

func DeployHandler(m *Map)

DeployHandler - Handles deploying stacks in the corrcet order TODO - this is still a fairly convoluted function... need to splify

func Exports

func Exports(session *session.Session) error

Exports - prints all cloudformation exports

func FetchSource

func FetchSource(src string, rcv SourceReceiver) error

FetchSource - uses interfaces to initiate source retreival

func Git

func Git(r *repo.Repo)

Git - set git repo for stack deployments

func TailService

func TailService(tail <-chan *TailServiceInput)

TailService - handles all tailing events

func TerminateHandler

func TerminateHandler(m *Map)

TerminateHandler - Handles terminating stacks in the correct order

func Wait

func Wait(getStatus func(s ...string) (string, error), args ...string) error

Wait - wait Until status is complete

Types

type Config

type Config struct {
	Session           *session.Session `yaml:"-" json:"" hcl:""`
	String            string           `yaml:"-" json:"-" hcl:"-"`
	Region            string           `yaml:"region,omitempty" json:"region,omitempty" hcl:"region,omitempty"`
	Project           string           `yaml:"project" json:"project" hcl:"project"`
	GenerateDelimiter string           `yaml:"gen_time,omitempty" json:"gen_time,omitempty" hcl:"gen_time,omitempty"`
	DeployDelimiter   string           `yaml:"deploy_time,omitempty" json:"deploy_time,omitempty" hcl:"deploy_time,omitempty"`
	S3Package         map[string]struct {
		Source      string `yaml:"source,omitempty" json:"source,omitempty" hcl:"source,omitempty"`
		Destination string `yaml:"destination,omitempty" json:"destination,omitempty" hcl:"destination,omitempty"`
	} `yaml:"s3_package,omitempty" json:"s3_package,omitempty" hcl:"s3_package,omitempty"`
	Global map[string]interface{} `yaml:"global,omitempty" json:"global,omitempty" hcl:"global,omitempty"`
	Stacks map[string]struct {
		DependsOn        []string               `yaml:"depends_on,omitempty" json:"depends_on,omitempty" hcl:"depends_on,omitempty"`
		Parameters       []map[string]string    `yaml:"parameters,omitempty" json:"parameters,omitempty" hcl:"parameters,omitempty"`
		Policy           string                 `yaml:"policy,omitempty" json:"policy,omitempty" hcl:"policy,omitempty"`
		Profile          string                 `yaml:"profile,omitempty" json:"profile,omitempty" hcl:"profile,omitempty"`
		Region           string                 `yaml:"region,omitempty" json:"region,omitempty" hcl:"region,omitempty"`
		Source           string                 `yaml:"source,omitempty" json:"source,omitempty" hcl:"source,omitempty"`
		Name             string                 `yaml:"name,omitempty" json:"name,omitempty" hcl:"name,omitempty"`
		Bucket           string                 `yaml:"bucket,omitempty" json:"bucket,omitempty" hcl:"bucket,omitempty"`
		Role             string                 `yaml:"role,omitempty" json:"role,omitempty" hcl:"role,omitempty"`
		Tags             []map[string]string    `yaml:"tags,omitempty" json:"tags,omitempty" hcl:"tags,omitempty"`
		Timeout          int64                  `yaml:"timeout,omitempty" json:"timeout,omitempty" hcl:"timeout,omitempty"`
		NotificationARNs []string               `yaml:"notification-arns" json:"notification-arns" hcl:"notification-arns"`
		CFRoleArn        string                 `yaml:"cf-role-arn" json:"cf-role-arn" hcl:"cf-role-arn"`
		CF               map[string]interface{} `yaml:"cf,omitempty" json:"cf,omitempty" hcl:"cf,omitempty"`
	} `yaml:"stacks" json:"stacks" hcl:"stacks"`
}

Config type for handling yaml config files

func (*Config) CallFunctions

func (c *Config) CallFunctions(fmap template.FuncMap) error

CallFunctions - execute gentime/deploytime functions in config

func (*Config) GetSession

func (c *Config) GetSession() *session.Session

GetSession - Returns session to use in all source operations

func (*Config) GetSource

func (c *Config) GetSource(src Source) (err error)

GetSource - takes a Source interface and retrieves source data

func (*Config) PackageToS3 added in v0.82.1

func (c *Config) PackageToS3(packageFlag bool) (err error)

PackageToS3 - executes package to s3 if --package/-p flag is given and packages are defined.

func (*Config) Parameters

func (c *Config) Parameters(s *Stack) *Config

Parameters - Adds parameters to given stack based on config

func (*Config) Tags

func (c *Config) Tags(s *Stack) *Config

Tags Adds stack tags to given stack based on config

func (*Config) Vars

func (c *Config) Vars() map[string]interface{}

Vars Returns map string of config values

type FileSource

type FileSource struct {
	Src string
}

FileSource - interface type NOTE: file is assumed if no other type if matched

func (FileSource) Handle

func (f FileSource) Handle() (resp string, err error)

Handle - Source Handle

type HTTPSource

type HTTPSource struct {
	Src string
}

HTTPSource - Http source type

func (HTTPSource) Handle

func (h HTTPSource) Handle() (string, error)

Handle - Source Handle

type LambdaSource

type LambdaSource struct {
	Src     string
	Session *session.Session
}

LambdaSource - lambda source handle

func (LambdaSource) Handle

func (l LambdaSource) Handle() (string, error)

Handle - Source Handle

type Map

type Map struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Map type

func (*Map) Add

func (m *Map) Add(k string, stk *Stack)

Add - add stack

func (*Map) AddFuncs added in v0.82.1

func (m *Map) AddFuncs(t template.FuncMap)

AddFuncs - add stack map functions to function map Note: this only exists for deploytime/gentime functions that require access to stack data at runtime.

func (*Map) Count

func (m *Map) Count() int

Count - returns number of stacks

func (*Map) Get

func (m *Map) Get(k string) (s *Stack, ok bool)

Get = retuern stack

func (*Map) MustGet

func (m *Map) MustGet(k string) (s *Stack)

MustGet - assumes stack exists at the given Key returns value without validation

func (*Map) Range

func (m *Map) Range(f func(string, *Stack) bool)

Range - iterate over map and execute function against each k, v pair. iteration ends if function returns false

func (*Map) StackOutput

func (m *Map) StackOutput(target string) string

StackOutput - stack output reader for template function

type S3Source

type S3Source struct {
	Src     string
	Session *session.Session
}

S3Source - S3 source type

func (S3Source) Handle

func (s3 S3Source) Handle() (string, error)

Handle - Source Handle

type Source

type Source interface {
	// Handle - handle source
	Handle() (string, error)
}

Source - interface for template/config sources

type SourceReceiver

type SourceReceiver interface {
	// SourceReceiver uses GetSource to call source and
	// apply results
	GetSource(Source) error

	// SourceReceivers may require sessions if calling aws resources
	// like Lambda & S3
	GetSession() *session.Session
}

SourceReceiver - interface for all items that require multisource functionality

type Stack

type Stack struct {
	// Project name for stack
	Project *string

	// local logical stack name
	Name string

	// AWS stack name on build
	Stackname string

	// Stack template for generating CF
	Template string

	// list of Dependencies
	DependsOn      []string
	Dependents     []interface{}
	Stackoutputs   *cloudformation.DescribeStacksOutput
	Parameters     []*cloudformation.Parameter
	Output         *cloudformation.DescribeStacksOutput
	Policy         string
	Tags           []*cloudformation.Tag
	Session        *session.Session
	Profile        string
	Region         string
	Source         string
	Bucket         string
	Role           string
	Rollback       bool
	GenTimeFunc    *template.FuncMap
	DeployTimeFunc *template.FuncMap
	DeployDelims   *string
	GenDelims      *string
	TemplateValues map[string]interface{}

	// Cloudformation Role
	CFRoleARN string

	// Debug value
	// Debug   bool
	Timeout int64

	// Actioned in this context means the stack name
	// has been passed explicitly as an arguement and
	// should be processed
	Actioned bool

	// list of SNS notification ARNs
	NotificationARNs []string
}

Stack - holds all meaningful information about a particular stack.

func (*Stack) Change

func (s *Stack) Change(req, changename string) error

Change - Manage Cloudformation Change-Sets

func (*Stack) ChangeSetStatus

func (s *Stack) ChangeSetStatus(args ...string) (string, error)

ChangeSetStatus - returns the literal change-set status

func (*Stack) Check

func (s *Stack) Check() error

Check - Validate Cloudformation templates

func (*Stack) Deploy

func (s *Stack) Deploy() error

Deploy - Launch Cloudformation Stack based on config values

func (*Stack) DeploySAM

func (s *Stack) DeploySAM() error

DeploySAM deploys SAMs Cloudformation templates

func (*Stack) DeployTimeParser

func (s *Stack) DeployTimeParser() error

DeployTimeParser - Parses templates during deployment to resolve specfic Dependency functions like stackout...

func (*Stack) GenTimeParser

func (s *Stack) GenTimeParser() error

GenTimeParser - Parses templates before deploying them...

func (*Stack) GetSession

func (s *Stack) GetSession() *session.Session

GetSession - Returns session to use in all source operations

func (*Stack) GetSource

func (s *Stack) GetSource(src Source) (err error)

GetSource - takes a Source interface and retrieves source data

func (*Stack) Outputs

func (s *Stack) Outputs() error

Outputs - Get Stack outputs

func (*Stack) Protect

func (s *Stack) Protect(enable *bool) error

Protect - enables stack termination-protection

func (*Stack) SetStackName

func (s *Stack) SetStackName()

SetStackName - sets the.Stackname with struct

func (*Stack) StackExists

func (s *Stack) StackExists() bool

StackExists - Returns true if stack exists in AWS Account, returns false if err when checking

func (*Stack) StackPolicy

func (s *Stack) StackPolicy() error

StackPolicy - Stack Cloudformation Stack policy

func (*Stack) StackStatus

func (s *Stack) StackStatus(args ...string) (string, error)

StackStatus - return the literal stack status

func (*Stack) State

func (s *Stack) State() (string, error)

State - returns complete/failed/pending state of stack

func (*Stack) Status

func (s *Stack) Status() error

Status - Checks stack status, pending, failed, complete

func (*Stack) Update

func (s *Stack) Update() error

Update - Update Cloudformation Stack

type TailServiceInput

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

TailServiceInput used for tailing cloudfomation outputs

Jump to

Keyboard shortcuts

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