From 0b360d91f1957ca2d03bf28dec0c3623301399c5 Mon Sep 17 00:00:00 2001 From: Cristian Magherusan-Stanciu Date: Mon, 12 Oct 2026 21:16:46 +0200 Subject: [PATCH] feat(common): add SavingsPlanDetails.Currency Refs #46 Co-Authored-By: Claude Sonnet 5.5 --- CHANGELOG.md | 4 ++++ pkg/common/types.go | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 134ff3c..652afd3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/). ### Added +- **`common.SavingsPlanDetails.Currency`:** the ISO 4217 code the hourly + commitment is denominated in. Additive and unused until the Azure Savings Plan + client starts requiring it (#46). + - **`recommendations.ApplyFamilyNUSizingRDSWithExpiry`:** family-NU sizing that deducts RDS RIs expiring inside the rebuy window from family coverage in normalized units (`max(covered - expiring, min(covered, active - expiring))`, diff --git a/pkg/common/types.go b/pkg/common/types.go index 4da79b9..8b62a9d 100644 --- a/pkg/common/types.go +++ b/pkg/common/types.go @@ -673,7 +673,11 @@ func (d NoSQLDetails) GetDetailDescription() string { type SavingsPlanDetails struct { PlanType string `json:"plan_type"` // Compute, EC2Instance, SageMaker HourlyCommitment float64 `json:"hourly_commitment"` - Coverage string `json:"coverage,omitempty"` + // Currency is the ISO 4217 code HourlyCommitment is denominated in. Azure + // requires it to match the billing account currency and fails closed when + // it is empty or malformed; empty is never treated as USD. + Currency string `json:"currency,omitempty"` + Coverage string `json:"coverage,omitempty"` // InstanceFamily is the EC2 instance family recommended by Cost Explorer // (e.g. "m5"). Only populated for EC2Instance Savings Plans; empty for // Compute, SageMaker and Database plans which are family-agnostic. Used at