pricings

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2019 License: Apache-2.0 Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EC2ServiceCode = "AmazonEC2"
	// Pricing endpoints are only available in "us-east-1" and "ap-south-1"
	PricingApiEndpointRegion = "us-east-1"
)
View Source
var (
	// EC2RegionCodeToPricingLocationName maps EC2 region codes to pricing locations
	// There is no AWS call to retrieve this programaticaly
	// From https://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region
	EC2RegionCodeToPricingLocationName = map[string]string{
		"us-east-2":      "US East (Ohio)",
		"us-east-1":      "US East (N. Virginia)",
		"us-west-1":      "US West (N. California)",
		"us-west-2":      "US West (Oregon)",
		"ap-south-1":     "Asia Pacific (Mumbai)",
		"ap-northeast-3": "Asia Pacific (Osaka-Local)",
		"ap-northeast-2": "Asia Pacific (Seoul)",
		"ap-southeast-1": "Asia Pacific (Singapore)",
		"ap-southeast-2": "Asia Pacific (Sydney)",
		"ap-northeast-1": "Asia Pacific (Tokyo)",
		"ca-central-1":   "Canada (Central)",
		"eu-central-1":   "EU (Frankfurt)",
		"eu-west-1":      "EU (Ireland)",
		"eu-west-2":      "EU (London)",
		"eu-west-3":      "EU (Paris)",
		"eu-north-1":     "EU (Stockholm)",
		"sa-east-1":      "South America (Sao Paulo)",
		"us-gov-east-1":  "AWS GovCloud (US-East)",
		"us-gov-west-1":  "AWS GovCloud (US)",
	}
)

Functions

This section is empty.

Types

type EC2Platform

type EC2Platform struct {
	Platform map[string]EC2Type `json:"platform"`
}

EC2Platform maps a platform to a EC2Type struct

type EC2Pricing

type EC2Pricing struct {
	Region map[string]EC2Platform `json:"region"`
}

EC2Pricing maps regions to a EC2Platform struct

func FetchEc2Pricings

func FetchEc2Pricings(ctx context.Context) (EC2Pricing, error)

FetchEc2Pricings fetches the EC2 pricings for all regions The informations that are retrieved are the instance size, the platform, the hourly costs for on demand, one year no upfront and 3 years no upfront If one of the buying options is not available, its cost is set to -1.0 FetchEc2Pricings returns an EC2Pricing struct and an error

type EC2Specs

type EC2Specs struct {
	CurrentGeneration                     bool    `json:"currentGeneration"`
	OnDemandHourlyCost                    float64 `json:"onDemandHourlyCost"`
	OneYearStandardNoUpfrontHourlyCost    float64 `json:"oneYearStandardNoUpfrontHourlyCost"`
	ThreeYearsStandardNoUpfrontHourlyCost float64 `json:"threeYearsStandardNoUpfrontHourlyCost"`
}

EC2Specs stores the cost specifications for an instance type

type EC2Type

type EC2Type struct {
	Type map[string]*EC2Specs `json:"type"`
}

EC2Type maps an instance type to a EC2Specs struct

Jump to

Keyboard shortcuts

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