Documentation ¶
Index ¶
- Constants
- func SortByState(state string, images []Image)
- type Cache
- func (c *Cache) CollectLaunchPermissions() bool
- func (c *Cache) FilterImages(region string, filter *Filter) ([]Image, error)
- func (c *Cache) Images(region string) ([]Image, error)
- func (c *Cache) Regions() []string
- func (c *Cache) Run(ctx context.Context, warmed chan struct{}) error
- func (c *Cache) StateTag() string
- func (c *Cache) Stop()
- type Filter
- type FilterFunc
- type Filterer
- type Image
- type Option
- func CollectLaunchPermissions(collect bool) Option
- func HTTPClient(client *http.Client) Option
- func Logger(logger log.Logger) Option
- func MaxConcurrentRequests(max int) Option
- func MaxRequestRetries(max int) Option
- func Regions(regions ...string) Option
- func StateTag(tag string) Option
- func TTL(ttl time.Duration) Option
- func TagFilter(tag string) Option
Constants ¶
const DefaultStateTag = "state"
DefaultStateTag is the default tag-key for determining AMI state.
Variables ¶
This section is empty.
Functions ¶
func SortByState ¶
SortByState sorts by taking the CreationDate attribute, converting it to UNIX epoch, and adds it to the weighted value of the status tag. It sorts from newest to oldest AMIs.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache manages the images polled from AWS.
func (*Cache) CollectLaunchPermissions ¶
CollectLaunchPermissions returns whether the cache is storing launch permission data for each AMI.
func (*Cache) FilterImages ¶
FilterImages returns a filtered set of cached images from the provided region.
func (*Cache) Run ¶
Run starts the cache and keeps it up to date. It closes warmed after the first cache update completes.
type Filter ¶
type Filter struct {
// contains filtered or unexported fields
}
Filter is used to filter Image objects.
type FilterFunc ¶
The FilterFunc type is an adapter to allow the use of ordinary functions as filter handlers. If f is a function with the appropriate signature, FilterFunc(f) is a Filterer object that calls f.
func FilterByImageID ¶
func FilterByImageID(ids ...string) FilterFunc
FilterByImageID returns images with matching AMI ids.
func FilterByLaunchPermission ¶
func FilterByLaunchPermission(id string) FilterFunc
FilterByLaunchPermission returns images that have the account id in its launch permissions.
func FilterByOwnerID ¶
func FilterByOwnerID(id string) FilterFunc
FilterByOwnerID returns only the images owned by the provided owner ID.
func FilterByTags ¶
func FilterByTags(tags map[string][]string) FilterFunc
FilterByTags returns images with matching tags.
func (FilterFunc) Filter ¶
func (f FilterFunc) Filter(images []Image) []Image
Filter implements the Filterer interface.
type Filterer ¶
Filterer is an interface used to apply specified filters on a slice of Image objects.
type Image ¶
type Image struct { Image *ec2.Image OwnerID string Region string // contains filtered or unexported fields }
Image represents an Amazon Machine Image.
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option is the option interface. It has private methods to prevent its use from outside of this package.
func CollectLaunchPermissions ¶
CollectLaunchPermissions determines if launch permissions should be collected for each AMI.
func HTTPClient ¶
HTTPClient sets the http.Client used for communicating with the AWS APIs.
func MaxConcurrentRequests ¶
MaxConcurrentRequests sets the maximum number of concurrent DescribeImageAttributes API requests for a given Owner.
This is used to control RequestLimitExceed errors. http://docs.aws.amazon.com/AWSEC2/latest/APIReference/query-api-troubleshooting.html#api-request-rate
func MaxRequestRetries ¶
MaxRequestRetries sets the maximum number of retries for the DescribeImageAttributes API request for a given AMI.
This is used to control RequestLimitExceed errors. http://docs.aws.amazon.com/AWSEC2/latest/APIReference/query-api-troubleshooting.html#api-request-rate