sfm

package module
v0.0.0-...-3f7807b Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: MIT Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	ID        string
	Resource  string
	Status    string
	Reason    string
	Timestamp time.Time
	Token     string
}

Event is a cloudformation event.

func (Event) Pretty

func (e Event) Pretty() string

Pretty returns a string of the event containing colour escape codes ready for printing in a terminal.

type Handle

type Handle struct {
	CFNcli *cfn.Client
}

Handle is a wrapper for service clients. Use it to get, list, delete stacks by name.

func NewHandle

func NewHandle(cfg aws.Config) (Handle, error)

NewHandle returns a new Handle with service clients created from the supplied AWS config struct.

func (Handle) Delete

func (h Handle) Delete(name string) (string, error)

Delete deletes a stack and returns a ClientRequestToken and an error.

func (Handle) Get

func (h Handle) Get(name string) (Stack, error)

Get returns a single Stack and an error.

func (Handle) List

func (h Handle) List(glob string) ([]Stack, error)

List returns a slice of Stack structs and an error. The supplied glob filters stacks based on the stack name.

func (Handle) Make

func (h Handle) Make(s Stack) (string, error)

Make creates or updates a stack and returns a ClientRequestToken and an error.

func (Handle) NewStack

func (h Handle) NewStack(name string) Stack

NewStack returns a Stack which may be pre-populated with values if it already exists.

type Stack

type Stack struct {
	NoRollback bool
	TermProc   bool

	Name   string
	Short  string // ok, prog, err
	Status string
	Reason string
	Desc   string

	Caps    []string
	Topics  []string
	Params  map[string]string
	Outputs map[string]string
	Tags    map[string]string

	Created time.Time
	Updated time.Time

	Handle       Handle `json:"-" yaml:"-"`
	Template     Template
	TemplateBody string `json:"-" yaml:"-"`
}

Stack is a wrapper for the cloudformation stack struct with simplified fields.

func NewFromAWS

func NewFromAWS(cs cfntyp.Stack) Stack

NewFromAWS converts a cloudformation stack into an sfm Stack.

func (Stack) Events

func (s Stack) Events(id string, token string) ([]Event, error)

Events returns stack events which were generated after the supplied EventId for the supplied request token. If no EventId is supplied (an empty string) the most recent Event is returned. If no ClientRequestToken is supplied (an empty string) events aren't filtered by request token.

func (*Stack) NewTemplate

func (s *Stack) NewTemplate(body []byte) error

func (Stack) Resources

func (s Stack) Resources() (map[string]map[string]string, error)

Resources returns up to 100 resources for the supplied Stack receiver.

func (Stack) String

func (s Stack) String() string

func (Stack) StringVerbose

func (s Stack) StringVerbose() string

StringVerbose is a stringer which returns more than just a name.

type Template

type Template struct {
	AWSTemplateFormatVersion string                 `yaml:"AWSTemplateFormatVersion,omitempty"`
	Transform                string                 `yaml:"Transform,omitempty"`
	Description              string                 `yaml:"Description,omitempty"`
	Metadata                 map[string]interface{} `yaml:"Metadata,omitempty"`
	Parameters               map[string]interface{} `yaml:"Parameters,omitempty"`
	Mappings                 map[string]interface{} `yaml:"Mappings,omitempty"`
	Conditions               map[string]interface{} `yaml:"Conditions,omitempty"`
	Resources                map[string]interface{} `yaml:"Resources,omitempty"`
	Outputs                  map[string]interface{} `yaml:"Outputs,omitempty"`
}

Template contains the content of the cloudformation template and probably some helper functions.

Directories

Path Synopsis
cli module

Jump to

Keyboard shortcuts

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