private async Task <AzureRIRateCard> GetAzureRIRateCard(RIType rIType) { var ri = "three"; if (rIType == RIType.oneYear) { ri = "one"; } // Assemble the URI for the REST API Call. string uri = $"https://azure.microsoft.com/api/v2/pricing/virtual-machines-base-{ri}-year/calculator/?culture=en-us&discount=mosp"; HttpResponseMessage response; // Execute the REST API call. response = await client.GetAsync(uri); // Get the JSON response. AzureRIRateCard rateCard = JsonConvert.DeserializeObject <AzureRIRateCard>(await response.Content.ReadAsStringAsync()); return(rateCard); }
public async Task <AzureRIRateCard> DownloadRI(RIType offerType) { return(await GetAzureRIRateCard(offerType)); }