From d09118133439f8806e1b14335d4d7f173ca23140 Mon Sep 17 00:00:00 2001 From: Steven Stringer Date: Tue, 3 Sep 2024 09:11:07 +0100 Subject: [PATCH] Fixed incorrect API requested for pssd and pssdv2 disks --- getString_test.go | 4 ++++ pssd.go | 3 ++- pssdv2.go | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/getString_test.go b/getString_test.go index 5499de0..359e8c3 100644 --- a/getString_test.go +++ b/getString_test.go @@ -43,7 +43,11 @@ func TestPricer_GetString(t *testing.T) { {"GoodPriceType", fields{apg: apiGet, Currency: "GBP", PriceType: "Reservation"}, "https://prices.azure.com/api/retail/prices?CurrencyCode=GBP&$filter=priceType%20eq%20%27Reservation%27", false}, {"GoodArmSkuName", fields{apg: apiGet, Currency: "GBP", ArmSkuName: "Standard_E48ads_v5"}, "https://prices.azure.com/api/retail/prices?CurrencyCode=GBP&$filter=armSkuName%20eq%20%27Standard_E48ads_v5%27", false}, {"GoodCombo", fields{apg: apiGet, Currency: "GBP", ArmRegionName: "uksouth", ArmSkuName: "Standard_E48ads_v5"}, "https://prices.azure.com/api/retail/prices?CurrencyCode=GBP&$filter=armRegionName%20eq%20%27uksouth%27%20and%20armSkuName%20eq%20%27Standard_E48ads_v5%27", false}, + {"GoodPssd", fields{apg: apiGet, ApiVersion: "2023-01-01-preview", Currency: "GBP", ArmRegionName: "uksouth", ServiceFamily: "Storage", SkuName: "P10 LRS", ProductName: "Premium SSD Managed Disks", MeterName: "P10 LRS Disk", PriceType: "Consumption"}, + "https://prices.azure.com/api/retail/prices?api-version=2023-01-01-preview&CurrencyCode=GBP&$filter=armRegionName%20eq%20%27uksouth%27%20and%20meterName%20eq%20%27P10%20LRS%20Disk%27%20and%20productName%20eq%20%27Premium%20SSD%20Managed%20Disks%27%20and%20skuName%20eq%20%27P10%20LRS%27%20and%20serviceFamily%20eq%20%27Storage%27%20and%20priceType%20eq%20%27Consumption%27", false}, {"NoCurrency", fields{apg: apiGet, Currency: ""}, "", true}, + {"GoodPssdv2", fields{apg: apiGet, ApiVersion: "2023-01-01-preview", Currency: "GBP", ArmRegionName: "uksouth", ProductName: "Azure Premium SSD v2", ServiceFamily: "Storage", PriceType: "Consumption"}, + "https://prices.azure.com/api/retail/prices?api-version=2023-01-01-preview&CurrencyCode=GBP&$filter=armRegionName%20eq%20%27uksouth%27%20and%20productName%20eq%20%27Azure%20Premium%20SSD%20v2%27%20and%20serviceFamily%20eq%20%27Storage%27%20and%20priceType%20eq%20%27Consumption%27", false}, {"UnsupportedCurrency", fields{apg: apiGet, Currency: "ZOP"}, "", true}, } for _, tt := range tests { diff --git a/pssd.go b/pssd.go index 735dc05..0feae36 100644 --- a/pssd.go +++ b/pssd.go @@ -18,9 +18,10 @@ func (p Pricer) GetPssdPrice(name, region, currency string) (PssdPrice, error) { p.ApiVersion = ApiPreview p.Currency = currency p.ArmRegionName = region + p.MeterName = fmt.Sprintf("%s LRS Disk", name) + p.ProductName = "Premium SSD Managed Disks" p.ServiceFamily = "Storage" p.SkuName = fmt.Sprintf("%s LRS", name) - p.ProductName = fmt.Sprintf("%s LRS Disk", name) p.PriceType = "Consumption" s1, err := p.GetString() diff --git a/pssdv2.go b/pssdv2.go index 81adb0f..01786e7 100644 --- a/pssdv2.go +++ b/pssdv2.go @@ -18,10 +18,10 @@ func (p Pricer) GetPssdv2Price(region, currency string) (Pssdv2Price, error) { p.ApiVersion = ApiPreview p.Currency = currency - p.ArmRegionName = currency + p.ArmRegionName = region + p.ProductName = "Azure Premium SSD v2" p.ServiceFamily = "Storage" p.PriceType = "Consumption" - p.ProductName = "Azure Premium SSD v2" s1, err := p.GetString() if err != nil {