awsami

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2022 License: MIT Imports: 15 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 New

func New(spec interface{}) (*AMI, error)

New returns a reference to a newly initialized AMI object from an AMISpec or an error if the provided AMISpec triggers a validation error.

func (*AMI) Changelog

func (a *AMI) Changelog() string

Changelog returns the changelog for this resource, or an empty string if not supported

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.ScmHandler) (bool, error)

ConditionFromSCM is a placeholder to validate the condition interface

func (*AMI) Source

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

Source returns the latest AMI matching filter(s)

func (*AMI) Target

func (a *AMI) Target(source string, dryRun bool) (bool, error)

func (*AMI) TargetFromSCM

func (a *AMI) TargetFromSCM(source string, scm scm.ScmHandler, dryRun bool) (bool, []string, string, error)

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