aws

package
v0.0.0-...-a4d1c61 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// KindMachines is used to identify the kind of calculator.Resource for EC2 machines.
	KindMachines = "AmazonEC2"
	// KindStorage is used to identify the kind of calculator.Resource for S3 storage.
	KindStorage = "AmazonS3"
)

Variables

This section is empty.

Functions

func GetConfigProvider

func GetConfigProvider(config Config) (client.ConfigProvider, error)

GetConfigProvider returns a new Amazon Web Services session.

func Must

Must forces GetConfigProvider to return the ConfigProvider. If there is an error when calling GetConfigProvider, Must will panic. Example:

c := Must(GetConfigProvider(Config{}))

func NewCostCalculatorEC2

func NewCostCalculatorEC2(api pricingiface.PricingAPI) calculator.CostCalculator

NewCostCalculatorEC2 initializes a new cost calculator for AWS EC2 resources.

func ParseEC2

func ParseEC2(product map[string]interface{}) (calculator.Rate, error)

ParseEC2 is a PriceParser func used for parsing EC2 pricing. It reads the given product definition and returns a rate at which the given product should be charged in USD.

Types

type Config

type Config struct {
	// Region represents the region where the AWS client will connect to.
	// Specifying the wrong region may cause problems when launching simulations.
	Region string
}

Config is used to configure a ConfigProvider.

type PriceParser

type PriceParser func(price map[string]interface{}) (calculator.Rate, error)

PriceParser parses a given AWS price result from the Pricing API and returns a calculator.Rate value. Different implementations depending on the response of the Pricing API can be added using this function signature. EC2 example: ParseEC2

Jump to

Keyboard shortcuts

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