awsami

package
v0.82.3 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: Apache-2.0 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 is returned if we use the wrong sortBy value
	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 manipulate 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, scm scm.ScmHandler) (pass bool, message string, err error)

Condition tests if an image matching the specific filters exists.

func (*AMI) Source

func (a *AMI) Source(workingDir string, resultSource *result.Source) error

Source returns the latest AMI matching filter(s)

func (*AMI) Target

func (a *AMI) Target(source string, scm scm.ScmHandler, dryRun bool, resultTarget *result.Target) 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 specifies a filter name.
	Name string `yaml:",omitempty"`
	// Values specifies a filter value for a specific filter name.
	Values string `yaml:",omitempty"`
}

Filter represents the updatecli configuration describing 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 specifies the aws access key which combined with `secretkey`, is one of the way to authenticate
	AccessKey string `yaml:",omitempty"`
	// secretkey specifies the aws secret key which combined with `accesskey`, is one of the way to authenticate
	SecretKey string `yaml:",omitempty"`
	// Filters specifies a list of AMI filters
	Filters Filters `yaml:",omitempty"`
	// Region specifies the AWS region to use when looking for AMI
	Region string `yaml:",omitempty"`
	// Endpoint specifies the AWS endpoint to use when looking for AMI
	Endpoint string `yaml:",omitempty"`
	// Dryrun allows to Check whether you have the required permissions for the action.
	DryRun bool `yaml:",omitempty"`
	// Sortby specifies the order of AMI-ID that will be used to retrieve the last element such as `creationdateasc`
	SortBy string `yaml:",omitempty"`
}

Spec contains the 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