pricing

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2025 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attributes

type Attributes struct {
	EnhancedNetworkingSupported string `json:"enhancedNetworkingSupported"`
	IntelTurboAvailable         string `json:"intelTurboAvailable"`
	Memory                      string `json:"memory"`
	DedicatedEbsThroughput      string `json:"dedicatedEbsThroughput"`
	Vcpu                        string `json:"vcpu"`
	ClassicNetworkingSupport    string `json:"classicnetworkingsupport"`
	CapacityStatus              string `json:"capacitystatus"`
	LocationType                string `json:"locationType"`
	Storage                     string `json:"storage"`
	InstanceFamily              string `json:"instanceFamily"`
	OperatingSystem             string `json:"operatingSystem"`
	IntelAvx2Available          string `json:"intelAvx2Available"`
	RegionCode                  string `json:"regionCode"`
	PhysicalProcessor           string `json:"physicalProcessor"`
	ClockSpeed                  string `json:"clockSpeed"`
	Ecu                         string `json:"ecu"`
	NetworkPerformance          string `json:"networkPerformance"`
	ServiceName                 string `json:"servicename"`
	GpuMemory                   string `json:"gpuMemory"`
	VpcNetworkingSupport        string `json:"vpcnetworkingsupport"`
	InstanceType                string `json:"instanceType"`
	Tenancy                     string `json:"tenancy"`
	UsageType                   string `json:"usagetype"`
	NormalizationSizeFactor     string `json:"normalizationSizeFactor"`
	IntelAvxAvailable           string `json:"intelAvxAvailable"`
	ServiceCode                 string `json:"servicecode"`
	LicenseModel                string `json:"licenseModel"`
	CurrentGeneration           string `json:"currentGeneration"`
	PreInstalledSw              string `json:"preInstalledSw"`
	Location                    string `json:"location"`
	ProcessorArchitecture       string `json:"processorArchitecture"`
	MarketOption                string `json:"marketoption"`
	Operation                   string `json:"operation"`
	AvailabilityZone            string `json:"availabilityzone"`
}

type AwsClient

type AwsClient interface {
	GetRegion() ptypes.AwsRegion
	GetAccountID() ptypes.AwsAccountID
	Pricing() *pricing.Client
}

type Ec2Product

type Ec2Product struct {
	Product         Product `json:"product"`
	ServiceCode     string  `json:"serviceCode"`
	Terms           Terms   `json:"terms"`
	Version         string  `json:"version"`
	PublicationDate string  `json:"publicationDate"`
}

func NewEc2Product

func NewEc2Product(priceList string) (*Ec2Product, error)

func (Ec2Product) GetConvertible1yrNoUpfrontPrice

func (e Ec2Product) GetConvertible1yrNoUpfrontPrice() string

func (Ec2Product) GetInstanceMemory

func (e Ec2Product) GetInstanceMemory() string

func (Ec2Product) GetInstanceType

func (e Ec2Product) GetInstanceType() string

func (Ec2Product) GetInstanceVcpu

func (e Ec2Product) GetInstanceVcpu() string

func (Ec2Product) GetOnDemandPrice

func (e Ec2Product) GetOnDemandPrice() string

func (Ec2Product) GetProductFamily

func (e Ec2Product) GetProductFamily() string

func (Ec2Product) GetReservedPrice

func (e Ec2Product) GetReservedPrice(
	offeringClass types.OfferingClassType,
	offeringType types.OfferingTypeValues,
	leaseContractLength string,
) string

func (Ec2Product) GetStandard1yrNoUpfrontPrice

func (e Ec2Product) GetStandard1yrNoUpfrontPrice() string

func (Ec2Product) GetTerms

func (e Ec2Product) GetTerms() Terms

type PriceDimension

type PriceDimension struct {
	Unit         string       `json:"unit"`
	EndRange     string       `json:"endRange"`
	Description  string       `json:"description"`
	AppliesTo    []string     `json:"appliesTo"`
	RateCode     string       `json:"rateCode"`
	BeginRange   string       `json:"beginRange"`
	PricePerUnit PricePerUnit `json:"pricePerUnit"`
}

type PricePerUnit

type PricePerUnit struct {
	USD string `json:"USD"`
}

type PricingRepository

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

func NewPricingRepository

func NewPricingRepository(ctx context.Context, client AwsClient) *PricingRepository

func (*PricingRepository) GetInstancePricing

func (r *PricingRepository) GetInstancePricing(region ptypes.AwsRegion, instanceType ec2types.InstanceType) (*Ec2Product, error)

GetInstancePricing fetches the pricing for a given instance type using the AWS Pricing API.

func (*PricingRepository) GetInstancePricingByInput

func (r *PricingRepository) GetInstancePricingByInput(query *pricing.GetProductsInput) ([]string, error)

GetInstancePricingByInput fetches the pricing for a given instance type using the AWS Pricing API.

func (*PricingRepository) GetRegion

func (r *PricingRepository) GetRegion() ptypes.AwsRegion

type Product

type Product struct {
	ProductFamily string     `json:"productFamily"`
	Attributes    Attributes `json:"attributes"`
	SKU           string     `json:"sku"`
}

type Term

type Term struct {
	PriceDimensions map[string]PriceDimension `json:"priceDimensions"`
	SKU             string                    `json:"sku"`
	EffectiveDate   string                    `json:"effectiveDate"`
	OfferTermCode   string                    `json:"offerTermCode"`
	TermAttributes  TermAttributes            `json:"termAttributes"`
}

type TermAttributes

type TermAttributes struct {
	LeaseContractLength string                   `json:"LeaseContractLength,omitempty"`
	OfferingClass       types.OfferingClassType  `json:"OfferingClass,omitempty"`
	PurchaseOption      types.OfferingTypeValues `json:"PurchaseOption,omitempty"`
}

type Terms

type Terms struct {
	OnDemand map[string]Term `json:"OnDemand"`
	Reserved map[string]Term `json:"Reserved"`
}

Jump to

Keyboard shortcuts

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