amazon

package
v0.0.0-...-2215086 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPricingSource

func NewPricingSource(s *session.Session, cfg ...*aws.Config) *pricingDetails

Types

type AmazonNetworkMapper

type AmazonNetworkMapper struct {
}

AmazonNetworkMapper module object for handling amazon specific VM to Networking capabilities mapping

func (*AmazonNetworkMapper) MapNetworkPerf

func (nm *AmazonNetworkMapper) MapNetworkPerf(networkPerformance string) (string, error)

MapNetworkPerf maps the network performance of the ec2 to the category supported ny telescope

type Config

type Config struct {
	Credentials `mapstructure:",squash"`

	Region string

	Pricing PricingConfig

	// Prometheus settings
	PrometheusAddress string
	PrometheusQuery   string
}

Config represents configuration for obtaining cloud information from Amazon.

func (Config) GetPricingCredentials

func (c Config) GetPricingCredentials() Credentials

type Credentials

type Credentials struct {
	// Static credentials
	AccessKey    string
	SecretKey    string
	SessionToken string

	// Shared credentials
	SharedCredentialsFile string
	Profile               string

	// IAM role ARN to assume
	AssumeRoleARN string
}

Credentials used for creating an AWS Session.

type Ec2Describer

type Ec2Describer interface {
	DescribeAvailabilityZones(input *ec2.DescribeAvailabilityZonesInput) (*ec2.DescribeAvailabilityZonesOutput, error)
	DescribeImages(*ec2.DescribeImagesInput) (*ec2.DescribeImagesOutput, error)
	DescribeSpotPriceHistoryPages(input *ec2.DescribeSpotPriceHistoryInput, fn func(*ec2.DescribeSpotPriceHistoryOutput, bool) bool) error
}

Ec2Describer interface for operations describing EC2 artifacts. (a subset of the Ec2 cli operations used by this app)

type Ec2Infoer

type Ec2Infoer struct {
	// contains filtered or unexported fields
}

Ec2Infoer encapsulates the data and operations needed to access external resources

func NewAmazonInfoer

func NewAmazonInfoer(config Config, logger cloudinfo.Logger) (*Ec2Infoer, error)

NewAmazonInfoer builds an infoer instance based on the provided configuration

func (*Ec2Infoer) GetCurrentPrices

func (e *Ec2Infoer) GetCurrentPrices(region string) (map[string]types.Price, error)

GetCurrentPrices returns the current spot prices of every instance type in every availability zone in a given region

func (*Ec2Infoer) GetProducts

func (e *Ec2Infoer) GetProducts(vms []types.VMInfo, service, regionId string) ([]types.VMInfo, error)

GetProducts retrieves the available virtual machines based on the arguments provided Delegates to the underlying PricingSource instance and performs transformations

func (*Ec2Infoer) GetRegion

func (e *Ec2Infoer) GetRegion(id string) *endpoints.Region

GetRegion gets the api specific region representation based on the provided id

func (*Ec2Infoer) GetRegions

func (e *Ec2Infoer) GetRegions(service string) (map[string]string, error)

GetRegions returns a map with available regions transforms the api representation into a "plain" map

func (*Ec2Infoer) GetServiceImages

func (e *Ec2Infoer) GetServiceImages(service, region string) ([]types.Image, error)

GetServiceImages retrieves the images supported by the given service in the given region

func (*Ec2Infoer) GetServiceProducts

func (e *Ec2Infoer) GetServiceProducts(region, service string) ([]types.ProductDetails, error)

GetServiceProducts retrieves the products supported by the given service in the given region

func (*Ec2Infoer) GetVersions

func (e *Ec2Infoer) GetVersions(service, region string) ([]types.LocationVersion, error)

GetVersions retrieves the kubernetes versions supported by the given service in the given region

func (*Ec2Infoer) GetVirtualMachines

func (e *Ec2Infoer) GetVirtualMachines(region string) ([]types.VMInfo, error)

func (*Ec2Infoer) GetZones

func (e *Ec2Infoer) GetZones(region string) ([]string, error)

GetZones returns the availability zones in a region

func (*Ec2Infoer) HasImages

func (e *Ec2Infoer) HasImages() bool

HasImages - Amazon support images

func (*Ec2Infoer) HasShortLivedPriceInfo

func (e *Ec2Infoer) HasShortLivedPriceInfo() bool

HasShortLivedPriceInfo - Spot Prices are changing continuously on EC2

func (*Ec2Infoer) Initialize

func (e *Ec2Infoer) Initialize() (map[string]map[string]types.Price, error)

Initialize is not needed on EC2 because price info is changing frequently

type PricingConfig

type PricingConfig struct {
	Region string

	Credentials `mapstructure:",squash"`
}

PricingConfig represents configuration for obtaining pricing information from Amazon.

type PricingSource

type PricingSource interface {
	GetPriceList(input *pricing.GetProductsInput) ([]aws.JSONValue, error)
}

PricingSource list of operations for retrieving pricing information Decouples the pricing logic from the amazon api

Jump to

Keyboard shortcuts

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