Documentation
¶
Index ¶
Constants ¶
const Collection = "ec2_instance_reference_prices"
Collection is the MongoDB collection for EC2 reference median prices.
Variables ¶
var ( // BSON field names for queries (aligned with struct tags). InstanceTypeKey = bsonutil.MustHaveTag(EC2InstanceReferencePrice{}, "InstanceType") OperatingSystemKey = bsonutil.MustHaveTag(EC2InstanceReferencePrice{}, "OperatingSystem") )
Functions ¶
func ApplyReferenceCostDataOrWarn ¶
ApplyReferenceCostDataOrWarn fills CostData from the EC2 reference price row for this distro's instance type and OS, or zeros rates and logs critically if none are found.
func ByInstanceTypeAndOS ¶
ByInstanceTypeAndOS returns a query for the natural key used by reference pricing. operatingSystem is matched case-insensitively so rows stay valid whether the collection stores Linux/linux, SUSE/suse, etc.
func OperatingSystemFromImageID ¶
OperatingSystemFromImageID maps distro image_id naming to lowercase OS keys for reference pricing. Substring checks are case-insensitive.
Types ¶
type EC2InstanceReferencePrice ¶
type EC2InstanceReferencePrice struct {
InstanceType string `bson:"instance_type" json:"instance_type"`
OperatingSystem string `bson:"operating_system" json:"operating_system"`
OnDemandMedian float64 `bson:"on_demand_median" json:"on_demand_median"`
AdjustedFinanceMedian float64 `bson:"adjusted_finance_median" json:"adjusted_finance_median"`
}
EC2InstanceReferencePrice holds median on-demand and finance-adjusted hourly rates for an instance type and OS, used to validate distro cost_data.