ami

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoFilter is return when didn't narrow AMI ID result
	ErrNoFilter error = errors.New("no filter specified")
	// ErrSpecNotValid is return when aws/ami spec are is not valid
	ErrSpecNotValid error = errors.New("ami spec not valid")
	// ErrWrongServiceConnection is returned when failing to connect to AWS api
	ErrWrongServiceConnection error = errors.New("can't connect to aws api")
)
View Source
var (
	ErrWrongSortByValue error = errors.New("wrong value for key 'sortBy'")
)

Functions

This section is empty.

Types

type AMI

type AMI struct {
	Spec Spec
	// contains filtered or unexported fields
}

AMI contains information to manipuliate AWS AMI information

func (*AMI) Condition

func (a *AMI) Condition(source string) (bool, error)

Condition tests if an image matching the specific filters exists.

func (*AMI) ConditionFromSCM

func (a *AMI) ConditionFromSCM(source string, scm scm.Scm) (bool, error)

ConditionFromSCM is a placeholder to validate the condition interface

func (*AMI) Init

func (a *AMI) Init() (svc *ec2.EC2, err error)

Init run basic parameter initiation

func (*AMI) Source

func (a *AMI) Source(workingDir string) (string, error)

Source returns the latest AMI matching filter(s)

type ByCreationDateAsc

type ByCreationDateAsc []*ec2.Image

Sort by CreationDate Asc ByAge implements sort.Interface based on the Age field.

func (ByCreationDateAsc) Len

func (images ByCreationDateAsc) Len() int

func (ByCreationDateAsc) Less

func (images ByCreationDateAsc) Less(i, j int) bool

func (ByCreationDateAsc) Swap

func (images ByCreationDateAsc) Swap(i, j int)

type ByCreationDateDesc

type ByCreationDateDesc []*ec2.Image

Sort by CreationDate Descendant ByAge implements sort.Interface based on the Age field.

func (ByCreationDateDesc) Len

func (images ByCreationDateDesc) Len() int

func (ByCreationDateDesc) Less

func (images ByCreationDateDesc) Less(i, j int) bool

func (ByCreationDateDesc) Swap

func (images ByCreationDateDesc) Swap(i, j int)

type Filter

type Filter struct {
	Name   string
	Values string
}

Filter represents the updatecli configuration which describes AMI filters

type Filters

type Filters []Filter

Filters represent a list of Filter

func (*Filters) String

func (f *Filters) String() string

type Spec

type Spec struct {
	AccessKey string  // AWs access key
	SecretKey string  // AWS secret key
	Filters   Filters // AMI ID filters
	Region    string  // AWS region to use when searching AMI
	Endpoint  string  // Endpoint to use when searching AMI
	DryRun    bool
	SortBy    string // Specify the order of AMI-ID that will be used to retrieve the last element
}

Spec contains updatecli configuration provided by users

func (*Spec) String

func (s *Spec) String() (output string)

String return Spec information as a string

func (*Spec) Validate

func (s *Spec) Validate() (errs []error)

Validate ensure that configuration inject are correct

Jump to

Keyboard shortcuts

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