From 02f4cb4306cf6e72ab30375776af66a222305851 Mon Sep 17 00:00:00 2001 From: Phoenix He Date: Wed, 7 Aug 2019 18:06:08 +0800 Subject: [PATCH] Generated from ad759850354ddb7b4ffea0a49b70243fd9ec5a42 fixed next link in backup (#6805) --- .../Generated/ConsumptionManagementClient.cs | 4 +- .../Generated/IConsumptionManagementClient.cs | 2 +- .../IReservationRecommendationsOperations.cs | 52 +++ .../IReservationsDetailsOperations.cs | 50 +++ .../IReservationsSummariesOperations.cs | 54 +++ .../src/Generated/IUsageDetailsOperations.cs | 97 +---- .../src/Generated/Models/Budget.cs | 6 +- .../src/Generated/Models/ReservationDetail.cs | 20 +- .../Models/ReservationRecommendation.cs | 37 +- .../src/Generated/Models/TimeGrainType.cs | 3 + .../Models/UsageDetailsDownloadHeaders.cs | 77 ---- .../Models/UsageDetailsDownloadResponse.cs | 72 ---- .../ReservationRecommendationsOperations.cs | 358 +++++++++++++++++ ...tionRecommendationsOperationsExtensions.cs | 84 ++++ .../ReservationsDetailsOperations.cs | 360 +++++++++++++++++ ...ReservationsDetailsOperationsExtensions.cs | 80 ++++ .../ReservationsSummariesOperations.cs | 369 ++++++++++++++++++ ...servationsSummariesOperationsExtensions.cs | 88 +++++ .../SdkInfo_ConsumptionManagementClient.cs | 31 +- .../src/Generated/UsageDetailsOperations.cs | 266 +------------ .../UsageDetailsOperationsExtensions.cs | 172 +------- 21 files changed, 1602 insertions(+), 680 deletions(-) delete mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/UsageDetailsDownloadHeaders.cs delete mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/UsageDetailsDownloadResponse.cs diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ConsumptionManagementClient.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ConsumptionManagementClient.cs index 5f4ccf5c72a28..b48d70b2e0aa2 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ConsumptionManagementClient.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ConsumptionManagementClient.cs @@ -49,7 +49,7 @@ public partial class ConsumptionManagementClient : ServiceClient /// Version of the API to be used with the client request. The current version - /// is 2019-04-01-preview. + /// is 2019-05-01. /// public string ApiVersion { get; private set; } @@ -396,7 +396,7 @@ private void Initialize() Operations = new Operations(this); AggregatedCost = new AggregatedCostOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2019-04-01-preview"; + ApiVersion = "2019-05-01"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IConsumptionManagementClient.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IConsumptionManagementClient.cs index e222d81ba322f..4a426ca786319 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IConsumptionManagementClient.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IConsumptionManagementClient.cs @@ -43,7 +43,7 @@ public partial interface IConsumptionManagementClient : System.IDisposable /// /// Version of the API to be used with the client request. The current - /// version is 2019-04-01-preview. + /// version is 2019-05-01. /// string ApiVersion { get; } diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IReservationRecommendationsOperations.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IReservationRecommendationsOperations.cs index 9c9af6f5a7900..e2b9c9659f57d 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IReservationRecommendationsOperations.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IReservationRecommendationsOperations.cs @@ -48,6 +48,34 @@ public partial interface IReservationRecommendationsOperations /// Task>> ListWithHttpMessagesAsync(string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// List of recommendations for purchasing reserved instances on + /// billing account scope + /// + /// + /// + /// BillingAccount ID + /// + /// + /// May be used to filter reservationRecommendations by + /// properties/scope and properties/lookBackPeriod. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingAccountIdWithHttpMessagesAsync(string billingAccountId, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// List of recommendations for purchasing reserved instances. /// /// @@ -70,5 +98,29 @@ public partial interface IReservationRecommendationsOperations /// Thrown when a required parameter is null /// Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List of recommendations for purchasing reserved instances on + /// billing account scope + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingAccountIdNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IReservationsDetailsOperations.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IReservationsDetailsOperations.cs index d3ff2f1edd4d2..a1f4a3ced7389 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IReservationsDetailsOperations.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IReservationsDetailsOperations.cs @@ -84,6 +84,33 @@ public partial interface IReservationsDetailsOperations /// Lists the reservations details for provided date range. /// /// + /// + /// BillingAccount ID + /// + /// + /// Filter reservation details by date range. The properties/UsageDate + /// for start date and end date. The filter supports 'le' and 'ge' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingAccountIdWithHttpMessagesAsync(string billingAccountId, string filter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the reservations details for provided date range. + /// + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -126,5 +153,28 @@ public partial interface IReservationsDetailsOperations /// Thrown when a required parameter is null /// Task>> ListByReservationOrderAndReservationNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the reservations details for provided date range. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingAccountIdNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IReservationsSummariesOperations.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IReservationsSummariesOperations.cs index dc422c9c9743b..87b875745488f 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IReservationsSummariesOperations.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IReservationsSummariesOperations.cs @@ -92,6 +92,37 @@ public partial interface IReservationsSummariesOperations /// Lists the reservations summaries for daily or monthly grain. /// /// + /// + /// BillingAccount ID + /// + /// + /// Can be daily or monthly. Possible values include: 'DailyGrain', + /// 'MonthlyGrain' + /// + /// + /// Required only for daily grain. The properties/UsageDate for start + /// date and end date. The filter supports 'le' and 'ge' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingAccountIdWithHttpMessagesAsync(string billingAccountId, string grain, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the reservations summaries for daily or monthly grain. + /// + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -134,5 +165,28 @@ public partial interface IReservationsSummariesOperations /// Thrown when a required parameter is null /// Task>> ListByReservationOrderAndReservationNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the reservations summaries for daily or monthly grain. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingAccountIdNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IUsageDetailsOperations.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IUsageDetailsOperations.cs index 1ad611d71276f..4156089c97344 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IUsageDetailsOperations.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IUsageDetailsOperations.cs @@ -55,10 +55,13 @@ public partial interface IUsageDetailsOperations /// /// May be used to filter usageDetails by properties/resourceGroup, /// properties/resourceName, properties/resourceId, - /// properties/chargeType, properties/reservationId or tags. The filter - /// supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not - /// currently support 'ne', 'or', or 'not'. Tag filter is a key value - /// pair string where key and value is separated by a colon (:). + /// properties/chargeType, properties/reservationId, + /// properties/publisherType or tags. The filter supports 'eq', 'lt', + /// 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', + /// 'or', or 'not'. Tag filter is a key value pair string where key and + /// value is separated by a colon (:). PublisherType Filter accepts two + /// values azure and marketplace and it is currently supported for Web + /// Direct Offer Type /// /// /// Skiptoken is only used if a previous operation returned a partial @@ -92,92 +95,6 @@ public partial interface IUsageDetailsOperations /// Task>> ListWithHttpMessagesAsync(string scope, string expand = default(string), string filter = default(string), string skiptoken = default(string), int? top = default(int?), string metric = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Download usage details data. - /// - /// - /// The scope associated with usage details operations. This includes - /// '/subscriptions/{subscriptionId}/' for subscription scope, - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' - /// for resourceGroup scope, - /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' - /// for Billing Account scope, - /// '/providers/Microsoft.Billing/departments/{departmentId}' for - /// Department scope, - /// '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' - /// for EnrollmentAccount scope and - /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' - /// for Management Group scope. For subscription, billing account, - /// department, enrollment account and management group, you can also - /// add billing period to the scope using - /// '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. - /// For e.g. to specify billing period at department scope use - /// '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' - /// - /// - /// Allows to select different type of cost/usage records. Possible - /// values include: 'ActualCostMetricType', 'AmortizedCostMetricType', - /// 'UsageMetricType' - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> DownloadWithHttpMessagesAsync(string scope, string metric = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Download usage details data. - /// - /// - /// The scope associated with usage details operations. This includes - /// '/subscriptions/{subscriptionId}/' for subscription scope, - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' - /// for resourceGroup scope, - /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' - /// for Billing Account scope, - /// '/providers/Microsoft.Billing/departments/{departmentId}' for - /// Department scope, - /// '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' - /// for EnrollmentAccount scope and - /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' - /// for Management Group scope. For subscription, billing account, - /// department, enrollment account and management group, you can also - /// add billing period to the scope using - /// '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. - /// For e.g. to specify billing period at department scope use - /// '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' - /// - /// - /// Allows to select different type of cost/usage records. Possible - /// values include: 'ActualCostMetricType', 'AmortizedCostMetricType', - /// 'UsageMetricType' - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> BeginDownloadWithHttpMessagesAsync(string scope, string metric = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// /// Lists the usage details for the defined scope. Usage details are /// available via this API only for May 1, 2014 or later. /// diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Budget.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Budget.cs index fb09003f4ac63..9f050c9928450 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Budget.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Budget.cs @@ -41,7 +41,8 @@ public Budget() /// budget /// The time covered by a budget. Tracking of /// the amount will be reset based on the time grain. Possible values - /// include: 'Monthly', 'Quarterly', 'Annually' + /// include: 'Monthly', 'Quarterly', 'Annually', 'BillingMonth', + /// 'BillingQuarter', 'BillingAnnual' /// Has start and end date of the budget. The /// start date must be first of the month and should be less than the /// end date. Budget start date must be on or after June 1, 2017. @@ -94,7 +95,8 @@ public Budget() /// /// Gets or sets the time covered by a budget. Tracking of the amount /// will be reset based on the time grain. Possible values include: - /// 'Monthly', 'Quarterly', 'Annually' + /// 'Monthly', 'Quarterly', 'Annually', 'BillingMonth', + /// 'BillingQuarter', 'BillingAnnual' /// [JsonProperty(PropertyName = "properties.timeGrain")] public string TimeGrain { get; set; } diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ReservationDetail.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ReservationDetail.cs index f3903d5f9cb8a..a28e2661d3ee7 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ReservationDetail.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ReservationDetail.cs @@ -43,6 +43,10 @@ public ReservationDetail() /// represents a single purchase transaction. A reservation order /// contains reservations. The reservation order specifies the VM size /// and region for the reservations. + /// The instance Flexibility + /// Ratio. + /// The instance Flexibility + /// Group. /// The reservation ID is the identifier of /// a reservation within a reservation order. Each reservation is the /// grouping for applying the benefit scope and also specifies the @@ -63,10 +67,12 @@ public ReservationDetail() /// resource or the fully qualified Resource ID. /// This is the total count of /// instances that are reserved for the reservationId. - public ReservationDetail(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string reservationOrderId = default(string), string reservationId = default(string), string skuName = default(string), decimal? reservedHours = default(decimal?), System.DateTime? usageDate = default(System.DateTime?), decimal? usedHours = default(decimal?), string instanceId = default(string), decimal? totalReservedQuantity = default(decimal?)) + public ReservationDetail(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string reservationOrderId = default(string), string instanceFlexibilityRatio = default(string), string instanceFlexibilityGroup = default(string), string reservationId = default(string), string skuName = default(string), decimal? reservedHours = default(decimal?), System.DateTime? usageDate = default(System.DateTime?), decimal? usedHours = default(decimal?), string instanceId = default(string), decimal? totalReservedQuantity = default(decimal?)) : base(id, name, type, tags) { ReservationOrderId = reservationOrderId; + InstanceFlexibilityRatio = instanceFlexibilityRatio; + InstanceFlexibilityGroup = instanceFlexibilityGroup; ReservationId = reservationId; SkuName = skuName; ReservedHours = reservedHours; @@ -92,6 +98,18 @@ public ReservationDetail() [JsonProperty(PropertyName = "properties.reservationOrderId")] public string ReservationOrderId { get; private set; } + /// + /// Gets the instance Flexibility Ratio. + /// + [JsonProperty(PropertyName = "properties.instanceFlexibilityRatio")] + public string InstanceFlexibilityRatio { get; private set; } + + /// + /// Gets the instance Flexibility Group. + /// + [JsonProperty(PropertyName = "properties.instanceFlexibilityGroup")] + public string InstanceFlexibilityGroup { get; private set; } + /// /// Gets the reservation ID is the identifier of a reservation within a /// reservation order. Each reservation is the grouping for applying diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ReservationRecommendation.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ReservationRecommendation.cs index 7bf72c60b372b..0e73fe0e7e154 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ReservationRecommendation.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ReservationRecommendation.cs @@ -42,6 +42,13 @@ public ReservationRecommendation() /// Resource sku /// The number of days of usage to look /// back for recommendation. + /// The instance Flexibility + /// Ratio. + /// The instance Flexibility + /// Group. + /// The normalized Size. + /// The recommended + /// Quantity Normalized. /// The meter id (GUID) /// RI recommendations in one or three year /// terms. @@ -56,7 +63,7 @@ public ReservationRecommendation() /// The usage date for looking /// back. /// Shared or single recommendation. - public ReservationRecommendation(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string location = default(string), string sku = default(string), string lookBackPeriod = default(string), System.Guid? meterId = default(System.Guid?), string term = default(string), decimal? costWithNoReservedInstances = default(decimal?), decimal? recommendedQuantity = default(decimal?), decimal? totalCostWithReservedInstances = default(decimal?), decimal? netSavings = default(decimal?), System.DateTime? firstUsageDate = default(System.DateTime?), string scope = default(string)) + public ReservationRecommendation(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string location = default(string), string sku = default(string), string lookBackPeriod = default(string), int? instanceFlexibilityRatio = default(int?), string instanceFlexibilityGroup = default(string), string normalizedSize = default(string), double? recommendedQuantityNormalized = default(double?), System.Guid? meterId = default(System.Guid?), string term = default(string), decimal? costWithNoReservedInstances = default(decimal?), decimal? recommendedQuantity = default(decimal?), decimal? totalCostWithReservedInstances = default(decimal?), decimal? netSavings = default(decimal?), System.DateTime? firstUsageDate = default(System.DateTime?), string scope = default(string)) { Id = id; Name = name; @@ -65,6 +72,10 @@ public ReservationRecommendation() Location = location; Sku = sku; LookBackPeriod = lookBackPeriod; + InstanceFlexibilityRatio = instanceFlexibilityRatio; + InstanceFlexibilityGroup = instanceFlexibilityGroup; + NormalizedSize = normalizedSize; + RecommendedQuantityNormalized = recommendedQuantityNormalized; MeterId = meterId; Term = term; CostWithNoReservedInstances = costWithNoReservedInstances; @@ -123,6 +134,30 @@ public ReservationRecommendation() [JsonProperty(PropertyName = "properties.lookBackPeriod")] public string LookBackPeriod { get; private set; } + /// + /// Gets the instance Flexibility Ratio. + /// + [JsonProperty(PropertyName = "properties.instanceFlexibilityRatio")] + public int? InstanceFlexibilityRatio { get; private set; } + + /// + /// Gets the instance Flexibility Group. + /// + [JsonProperty(PropertyName = "properties.instanceFlexibilityGroup")] + public string InstanceFlexibilityGroup { get; private set; } + + /// + /// Gets the normalized Size. + /// + [JsonProperty(PropertyName = "properties.normalizedSize")] + public string NormalizedSize { get; private set; } + + /// + /// Gets the recommended Quantity Normalized. + /// + [JsonProperty(PropertyName = "properties.recommendedQuantityNormalized")] + public double? RecommendedQuantityNormalized { get; private set; } + /// /// Gets the meter id (GUID) /// diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/TimeGrainType.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/TimeGrainType.cs index 6e0a7feed11db..2b02f5b45443b 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/TimeGrainType.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/TimeGrainType.cs @@ -19,5 +19,8 @@ public static class TimeGrainType public const string Monthly = "Monthly"; public const string Quarterly = "Quarterly"; public const string Annually = "Annually"; + public const string BillingMonth = "BillingMonth"; + public const string BillingQuarter = "BillingQuarter"; + public const string BillingAnnual = "BillingAnnual"; } } diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/UsageDetailsDownloadHeaders.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/UsageDetailsDownloadHeaders.cs deleted file mode 100644 index 26cf1f9a2de37..0000000000000 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/UsageDetailsDownloadHeaders.cs +++ /dev/null @@ -1,77 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Consumption.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Defines headers for Download operation. - /// - public partial class UsageDetailsDownloadHeaders - { - /// - /// Initializes a new instance of the UsageDetailsDownloadHeaders - /// class. - /// - public UsageDetailsDownloadHeaders() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the UsageDetailsDownloadHeaders - /// class. - /// - /// GET this URL to retrieve the status of the - /// asynchronous operation. - /// The amount of delay to use while the - /// status of the operation is checked. The value is expressed in - /// seconds. - /// To get the progress of the - /// operation, call GET operation on the URL in Azure-AsyncOperation - /// header field. - public UsageDetailsDownloadHeaders(string location = default(string), string retryAfter = default(string), string azureAsyncOperation = default(string)) - { - Location = location; - RetryAfter = retryAfter; - AzureAsyncOperation = azureAsyncOperation; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets GET this URL to retrieve the status of the - /// asynchronous operation. - /// - [JsonProperty(PropertyName = "Location")] - public string Location { get; set; } - - /// - /// Gets or sets the amount of delay to use while the status of the - /// operation is checked. The value is expressed in seconds. - /// - [JsonProperty(PropertyName = "Retry-After")] - public string RetryAfter { get; set; } - - /// - /// Gets or sets to get the progress of the operation, call GET - /// operation on the URL in Azure-AsyncOperation header field. - /// - [JsonProperty(PropertyName = "Azure-AsyncOperation")] - public string AzureAsyncOperation { get; set; } - - } -} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/UsageDetailsDownloadResponse.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/UsageDetailsDownloadResponse.cs deleted file mode 100644 index 6eda8d43d49c1..0000000000000 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/UsageDetailsDownloadResponse.cs +++ /dev/null @@ -1,72 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Consumption.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Download response of Usage Details. - /// - [Rest.Serialization.JsonTransformation] - public partial class UsageDetailsDownloadResponse : Resource - { - /// - /// Initializes a new instance of the UsageDetailsDownloadResponse - /// class. - /// - public UsageDetailsDownloadResponse() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the UsageDetailsDownloadResponse - /// class. - /// - /// Resource Id. - /// Resource name. - /// Resource type. - /// Resource tags. - /// The URL to the csv file. - /// The time in UTC at which this download URL - /// will expire. - public UsageDetailsDownloadResponse(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string downloadUrlProperty = default(string), string validTill = default(string)) - : base(id, name, type, tags) - { - DownloadUrlProperty = downloadUrlProperty; - ValidTill = validTill; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the URL to the csv file. - /// - [JsonProperty(PropertyName = "properties.downloadUrl")] - public string DownloadUrlProperty { get; private set; } - - /// - /// Gets the time in UTC at which this download URL will expire. - /// - [JsonProperty(PropertyName = "properties.validTill")] - public string ValidTill { get; private set; } - - } -} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationRecommendationsOperations.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationRecommendationsOperations.cs index b0c3ab64809a1..8d7e5a2a50902 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationRecommendationsOperations.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationRecommendationsOperations.cs @@ -233,6 +233,194 @@ internal ReservationRecommendationsOperations(ConsumptionManagementClient client return _result; } + /// + /// List of recommendations for purchasing reserved instances on billing + /// account scope + /// + /// + /// + /// BillingAccount ID + /// + /// + /// May be used to filter reservationRecommendations by properties/scope and + /// properties/lookBackPeriod. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingAccountIdWithHttpMessagesAsync(string billingAccountId, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("filter", filter); + tracingParameters.Add("billingAccountId", billingAccountId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountId", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/microsoft.consumption/ReservationRecommendations").ToString(); + _url = _url.Replace("{billingAccountId}", System.Uri.EscapeDataString(billingAccountId)); + List _queryParameters = new List(); + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// List of recommendations for purchasing reserved instances. /// @@ -306,6 +494,176 @@ internal ReservationRecommendationsOperations(ConsumptionManagementClient client } + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List of recommendations for purchasing reserved instances on billing + /// account scope + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingAccountIdNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountIdNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + if (customHeaders != null) { foreach(var _header in customHeaders) diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationRecommendationsOperationsExtensions.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationRecommendationsOperationsExtensions.cs index 5358163308b1e..64798a5338f5f 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationRecommendationsOperationsExtensions.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationRecommendationsOperationsExtensions.cs @@ -59,6 +59,52 @@ public static partial class ReservationRecommendationsOperationsExtensions } } + /// + /// List of recommendations for purchasing reserved instances on billing + /// account scope + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// BillingAccount ID + /// + /// + /// May be used to filter reservationRecommendations by properties/scope and + /// properties/lookBackPeriod. + /// + public static IPage ListByBillingAccountId(this IReservationRecommendationsOperations operations, string billingAccountId, string filter = default(string)) + { + return operations.ListByBillingAccountIdAsync(billingAccountId, filter).GetAwaiter().GetResult(); + } + + /// + /// List of recommendations for purchasing reserved instances on billing + /// account scope + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// BillingAccount ID + /// + /// + /// May be used to filter reservationRecommendations by properties/scope and + /// properties/lookBackPeriod. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingAccountIdAsync(this IReservationRecommendationsOperations operations, string billingAccountId, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountIdWithHttpMessagesAsync(billingAccountId, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// List of recommendations for purchasing reserved instances. /// @@ -95,5 +141,43 @@ public static IPage ListNext(this IReservationRecomme } } + /// + /// List of recommendations for purchasing reserved instances on billing + /// account scope + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByBillingAccountIdNext(this IReservationRecommendationsOperations operations, string nextPageLink) + { + return operations.ListByBillingAccountIdNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List of recommendations for purchasing reserved instances on billing + /// account scope + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingAccountIdNextAsync(this IReservationRecommendationsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountIdNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } } diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationsDetailsOperations.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationsDetailsOperations.cs index b94241f33af7e..35e49e4e6a414 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationsDetailsOperations.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationsDetailsOperations.cs @@ -441,6 +441,197 @@ internal ReservationsDetailsOperations(ConsumptionManagementClient client) return _result; } + /// + /// Lists the reservations details for provided date range. + /// + /// + /// + /// BillingAccount ID + /// + /// + /// Filter reservation details by date range. The properties/UsageDate for + /// start date and end date. The filter supports 'le' and 'ge' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingAccountIdWithHttpMessagesAsync(string billingAccountId, string filter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountId"); + } + if (filter == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "filter"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountId", billingAccountId); + tracingParameters.Add("filter", filter); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountId", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/reservationDetails").ToString(); + _url = _url.Replace("{billingAccountId}", System.Uri.EscapeDataString(billingAccountId)); + List _queryParameters = new List(); + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Lists the reservations details for provided date range. /// @@ -683,6 +874,175 @@ internal ReservationsDetailsOperations(ConsumptionManagementClient client) } + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the reservations details for provided date range. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingAccountIdNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountIdNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + if (customHeaders != null) { foreach(var _header in customHeaders) diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationsDetailsOperationsExtensions.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationsDetailsOperationsExtensions.cs index 0d08b82a90675..1fd19827086b9 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationsDetailsOperationsExtensions.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationsDetailsOperationsExtensions.cs @@ -115,6 +115,50 @@ public static IPage ListByReservationOrderAndReservation(this } } + /// + /// Lists the reservations details for provided date range. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// BillingAccount ID + /// + /// + /// Filter reservation details by date range. The properties/UsageDate for + /// start date and end date. The filter supports 'le' and 'ge' + /// + public static IPage ListByBillingAccountId(this IReservationsDetailsOperations operations, string billingAccountId, string filter) + { + return operations.ListByBillingAccountIdAsync(billingAccountId, filter).GetAwaiter().GetResult(); + } + + /// + /// Lists the reservations details for provided date range. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// BillingAccount ID + /// + /// + /// Filter reservation details by date range. The properties/UsageDate for + /// start date and end date. The filter supports 'le' and 'ge' + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingAccountIdAsync(this IReservationsDetailsOperations operations, string billingAccountId, string filter, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountIdWithHttpMessagesAsync(billingAccountId, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Lists the reservations details for provided date range. /// @@ -187,5 +231,41 @@ public static IPage ListByReservationOrderAndReservationNext( } } + /// + /// Lists the reservations details for provided date range. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByBillingAccountIdNext(this IReservationsDetailsOperations operations, string nextPageLink) + { + return operations.ListByBillingAccountIdNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the reservations details for provided date range. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingAccountIdNextAsync(this IReservationsDetailsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountIdNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } } diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationsSummariesOperations.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationsSummariesOperations.cs index 67051f50e7508..199ce06364617 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationsSummariesOperations.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationsSummariesOperations.cs @@ -459,6 +459,206 @@ internal ReservationsSummariesOperations(ConsumptionManagementClient client) return _result; } + /// + /// Lists the reservations summaries for daily or monthly grain. + /// + /// + /// + /// BillingAccount ID + /// + /// + /// Can be daily or monthly. Possible values include: 'DailyGrain', + /// 'MonthlyGrain' + /// + /// + /// Required only for daily grain. The properties/UsageDate for start date and + /// end date. The filter supports 'le' and 'ge' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingAccountIdWithHttpMessagesAsync(string billingAccountId, string grain, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountId"); + } + if (grain == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "grain"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountId", billingAccountId); + tracingParameters.Add("grain", grain); + tracingParameters.Add("filter", filter); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountId", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/reservationSummaries").ToString(); + _url = _url.Replace("{billingAccountId}", System.Uri.EscapeDataString(billingAccountId)); + List _queryParameters = new List(); + if (grain != null) + { + _queryParameters.Add(string.Format("grain={0}", System.Uri.EscapeDataString(grain))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Lists the reservations summaries for daily or monthly grain. /// @@ -701,6 +901,175 @@ internal ReservationsSummariesOperations(ConsumptionManagementClient client) } + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the reservations summaries for daily or monthly grain. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingAccountIdNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountIdNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + if (customHeaders != null) { foreach(var _header in customHeaders) diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationsSummariesOperationsExtensions.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationsSummariesOperationsExtensions.cs index a2c21e8d02316..850d91676a2d8 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationsSummariesOperationsExtensions.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationsSummariesOperationsExtensions.cs @@ -131,6 +131,58 @@ public static partial class ReservationsSummariesOperationsExtensions } } + /// + /// Lists the reservations summaries for daily or monthly grain. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// BillingAccount ID + /// + /// + /// Can be daily or monthly. Possible values include: 'DailyGrain', + /// 'MonthlyGrain' + /// + /// + /// Required only for daily grain. The properties/UsageDate for start date and + /// end date. The filter supports 'le' and 'ge' + /// + public static IPage ListByBillingAccountId(this IReservationsSummariesOperations operations, string billingAccountId, string grain, string filter = default(string)) + { + return operations.ListByBillingAccountIdAsync(billingAccountId, grain, filter).GetAwaiter().GetResult(); + } + + /// + /// Lists the reservations summaries for daily or monthly grain. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// BillingAccount ID + /// + /// + /// Can be daily or monthly. Possible values include: 'DailyGrain', + /// 'MonthlyGrain' + /// + /// + /// Required only for daily grain. The properties/UsageDate for start date and + /// end date. The filter supports 'le' and 'ge' + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingAccountIdAsync(this IReservationsSummariesOperations operations, string billingAccountId, string grain, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountIdWithHttpMessagesAsync(billingAccountId, grain, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Lists the reservations summaries for daily or monthly grain. /// @@ -203,5 +255,41 @@ public static IPage ListByReservationOrderAndReservationNext } } + /// + /// Lists the reservations summaries for daily or monthly grain. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByBillingAccountIdNext(this IReservationsSummariesOperations operations, string nextPageLink) + { + return operations.ListByBillingAccountIdNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the reservations summaries for daily or monthly grain. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingAccountIdNextAsync(this IReservationsSummariesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountIdNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } } diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/SdkInfo_ConsumptionManagementClient.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/SdkInfo_ConsumptionManagementClient.cs index 2329d9f3ba0ca..58434f1a97f24 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/SdkInfo_ConsumptionManagementClient.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/SdkInfo_ConsumptionManagementClient.cs @@ -19,20 +19,23 @@ public static IEnumerable> ApiInfo_ConsumptionMana { return new Tuple[] { - new Tuple("Billing", "Balances", "2019-04-01-preview"), - new Tuple("Billing", "PriceSheet", "2019-04-01-preview"), - new Tuple("Capacity", "ReservationsDetails", "2019-04-01-preview"), - new Tuple("Capacity", "ReservationsSummaries", "2019-04-01-preview"), - new Tuple("Consumption", "Budgets", "2019-04-01-preview"), - new Tuple("Consumption", "Charges", "2019-04-01-preview"), - new Tuple("Consumption", "Forecasts", "2019-04-01-preview"), - new Tuple("Consumption", "Marketplaces", "2019-04-01-preview"), - new Tuple("Consumption", "Operations", "2019-04-01-preview"), - new Tuple("Consumption", "PriceSheet", "2019-04-01-preview"), - new Tuple("Consumption", "ReservationRecommendations", "2019-04-01-preview"), - new Tuple("Consumption", "Tags", "2019-04-01-preview"), - new Tuple("Consumption", "UsageDetails", "2019-04-01-preview"), - new Tuple("Management", "AggregatedCost", "2019-04-01-preview"), + new Tuple("Billing", "Balances", "2019-05-01"), + new Tuple("Billing", "PriceSheet", "2019-05-01"), + new Tuple("Billing", "ReservationRecommendations", "2019-05-01"), + new Tuple("Billing", "ReservationsDetails", "2019-05-01"), + new Tuple("Billing", "ReservationsSummaries", "2019-05-01"), + new Tuple("Capacity", "ReservationsDetails", "2019-05-01"), + new Tuple("Capacity", "ReservationsSummaries", "2019-05-01"), + new Tuple("Consumption", "Budgets", "2019-05-01"), + new Tuple("Consumption", "Charges", "2019-05-01"), + new Tuple("Consumption", "Forecasts", "2019-05-01"), + new Tuple("Consumption", "Marketplaces", "2019-05-01"), + new Tuple("Consumption", "Operations", "2019-05-01"), + new Tuple("Consumption", "PriceSheet", "2019-05-01"), + new Tuple("Consumption", "ReservationRecommendations", "2019-05-01"), + new Tuple("Consumption", "Tags", "2019-05-01"), + new Tuple("Consumption", "UsageDetails", "2019-05-01"), + new Tuple("Management", "AggregatedCost", "2019-05-01"), }.AsEnumerable(); } } diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/UsageDetailsOperations.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/UsageDetailsOperations.cs index 7bfa4cfdf7ae3..bd283139aef69 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/UsageDetailsOperations.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/UsageDetailsOperations.cs @@ -82,10 +82,12 @@ internal UsageDetailsOperations(ConsumptionManagementClient client) /// /// May be used to filter usageDetails by properties/resourceGroup, /// properties/resourceName, properties/resourceId, properties/chargeType, - /// properties/reservationId or tags. The filter supports 'eq', 'lt', 'gt', - /// 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. - /// Tag filter is a key value pair string where key and value is separated by a - /// colon (:). + /// properties/reservationId, properties/publisherType or tags. The filter + /// supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently + /// support 'ne', 'or', or 'not'. Tag filter is a key value pair string where + /// key and value is separated by a colon (:). PublisherType Filter accepts two + /// values azure and marketplace and it is currently supported for Web Direct + /// Offer Type /// /// /// Skiptoken is only used if a previous operation returned a partial result. @@ -306,262 +308,6 @@ internal UsageDetailsOperations(ConsumptionManagementClient client) return _result; } - /// - /// Download usage details data. - /// - /// - /// The scope associated with usage details operations. This includes - /// '/subscriptions/{subscriptionId}/' for subscription scope, - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for - /// resourceGroup scope, - /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for - /// Billing Account scope, - /// '/providers/Microsoft.Billing/departments/{departmentId}' for Department - /// scope, - /// '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' for - /// EnrollmentAccount scope and - /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for - /// Management Group scope. For subscription, billing account, department, - /// enrollment account and management group, you can also add billing period to - /// the scope using - /// '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. - /// to specify billing period at department scope use - /// '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' - /// - /// - /// Allows to select different type of cost/usage records. Possible values - /// include: 'ActualCostMetricType', 'AmortizedCostMetricType', - /// 'UsageMetricType' - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> DownloadWithHttpMessagesAsync(string scope, string metric = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginDownloadWithHttpMessagesAsync(scope, metric, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Download usage details data. - /// - /// - /// The scope associated with usage details operations. This includes - /// '/subscriptions/{subscriptionId}/' for subscription scope, - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for - /// resourceGroup scope, - /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for - /// Billing Account scope, - /// '/providers/Microsoft.Billing/departments/{departmentId}' for Department - /// scope, - /// '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' for - /// EnrollmentAccount scope and - /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for - /// Management Group scope. For subscription, billing account, department, - /// enrollment account and management group, you can also add billing period to - /// the scope using - /// '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. - /// to specify billing period at department scope use - /// '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' - /// - /// - /// Allows to select different type of cost/usage records. Possible values - /// include: 'ActualCostMetricType', 'AmortizedCostMetricType', - /// 'UsageMetricType' - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> BeginDownloadWithHttpMessagesAsync(string scope, string metric = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (scope == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scope"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("scope", scope); - tracingParameters.Add("metric", metric); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDownload", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Consumption/usageDetails/download").ToString(); - _url = _url.Replace("{scope}", scope); - List _queryParameters = new List(); - if (Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); - } - if (metric != null) - { - _queryParameters.Add(string.Format("metric={0}", System.Uri.EscapeDataString(metric))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - try - { - _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - /// /// Lists the usage details for the defined scope. Usage details are available /// via this API only for May 1, 2014 or later. diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/UsageDetailsOperationsExtensions.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/UsageDetailsOperationsExtensions.cs index e40b96215e9f2..5014e3a4f0ffd 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/UsageDetailsOperationsExtensions.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/UsageDetailsOperationsExtensions.cs @@ -56,10 +56,12 @@ public static partial class UsageDetailsOperationsExtensions /// /// May be used to filter usageDetails by properties/resourceGroup, /// properties/resourceName, properties/resourceId, properties/chargeType, - /// properties/reservationId or tags. The filter supports 'eq', 'lt', 'gt', - /// 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. - /// Tag filter is a key value pair string where key and value is separated by a - /// colon (:). + /// properties/reservationId, properties/publisherType or tags. The filter + /// supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently + /// support 'ne', 'or', or 'not'. Tag filter is a key value pair string where + /// key and value is separated by a colon (:). PublisherType Filter accepts two + /// values azure and marketplace and it is currently supported for Web Direct + /// Offer Type /// /// /// Skiptoken is only used if a previous operation returned a partial result. @@ -116,10 +118,12 @@ public static partial class UsageDetailsOperationsExtensions /// /// May be used to filter usageDetails by properties/resourceGroup, /// properties/resourceName, properties/resourceId, properties/chargeType, - /// properties/reservationId or tags. The filter supports 'eq', 'lt', 'gt', - /// 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. - /// Tag filter is a key value pair string where key and value is separated by a - /// colon (:). + /// properties/reservationId, properties/publisherType or tags. The filter + /// supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently + /// support 'ne', 'or', or 'not'. Tag filter is a key value pair string where + /// key and value is separated by a colon (:). PublisherType Filter accepts two + /// values azure and marketplace and it is currently supported for Web Direct + /// Offer Type /// /// /// Skiptoken is only used if a previous operation returned a partial result. @@ -147,158 +151,6 @@ public static partial class UsageDetailsOperationsExtensions } } - /// - /// Download usage details data. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The scope associated with usage details operations. This includes - /// '/subscriptions/{subscriptionId}/' for subscription scope, - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for - /// resourceGroup scope, - /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for - /// Billing Account scope, - /// '/providers/Microsoft.Billing/departments/{departmentId}' for Department - /// scope, - /// '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' for - /// EnrollmentAccount scope and - /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for - /// Management Group scope. For subscription, billing account, department, - /// enrollment account and management group, you can also add billing period to - /// the scope using - /// '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. - /// to specify billing period at department scope use - /// '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' - /// - /// - /// Allows to select different type of cost/usage records. Possible values - /// include: 'ActualCostMetricType', 'AmortizedCostMetricType', - /// 'UsageMetricType' - /// - public static UsageDetailsDownloadResponse Download(this IUsageDetailsOperations operations, string scope, string metric = default(string)) - { - return operations.DownloadAsync(scope, metric).GetAwaiter().GetResult(); - } - - /// - /// Download usage details data. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The scope associated with usage details operations. This includes - /// '/subscriptions/{subscriptionId}/' for subscription scope, - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for - /// resourceGroup scope, - /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for - /// Billing Account scope, - /// '/providers/Microsoft.Billing/departments/{departmentId}' for Department - /// scope, - /// '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' for - /// EnrollmentAccount scope and - /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for - /// Management Group scope. For subscription, billing account, department, - /// enrollment account and management group, you can also add billing period to - /// the scope using - /// '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. - /// to specify billing period at department scope use - /// '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' - /// - /// - /// Allows to select different type of cost/usage records. Possible values - /// include: 'ActualCostMetricType', 'AmortizedCostMetricType', - /// 'UsageMetricType' - /// - /// - /// The cancellation token. - /// - public static async Task DownloadAsync(this IUsageDetailsOperations operations, string scope, string metric = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.DownloadWithHttpMessagesAsync(scope, metric, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Download usage details data. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The scope associated with usage details operations. This includes - /// '/subscriptions/{subscriptionId}/' for subscription scope, - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for - /// resourceGroup scope, - /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for - /// Billing Account scope, - /// '/providers/Microsoft.Billing/departments/{departmentId}' for Department - /// scope, - /// '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' for - /// EnrollmentAccount scope and - /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for - /// Management Group scope. For subscription, billing account, department, - /// enrollment account and management group, you can also add billing period to - /// the scope using - /// '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. - /// to specify billing period at department scope use - /// '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' - /// - /// - /// Allows to select different type of cost/usage records. Possible values - /// include: 'ActualCostMetricType', 'AmortizedCostMetricType', - /// 'UsageMetricType' - /// - public static UsageDetailsDownloadResponse BeginDownload(this IUsageDetailsOperations operations, string scope, string metric = default(string)) - { - return operations.BeginDownloadAsync(scope, metric).GetAwaiter().GetResult(); - } - - /// - /// Download usage details data. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The scope associated with usage details operations. This includes - /// '/subscriptions/{subscriptionId}/' for subscription scope, - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for - /// resourceGroup scope, - /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for - /// Billing Account scope, - /// '/providers/Microsoft.Billing/departments/{departmentId}' for Department - /// scope, - /// '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}' for - /// EnrollmentAccount scope and - /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for - /// Management Group scope. For subscription, billing account, department, - /// enrollment account and management group, you can also add billing period to - /// the scope using - /// '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g. - /// to specify billing period at department scope use - /// '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' - /// - /// - /// Allows to select different type of cost/usage records. Possible values - /// include: 'ActualCostMetricType', 'AmortizedCostMetricType', - /// 'UsageMetricType' - /// - /// - /// The cancellation token. - /// - public static async Task BeginDownloadAsync(this IUsageDetailsOperations operations, string scope, string metric = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.BeginDownloadWithHttpMessagesAsync(scope, metric, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - /// /// Lists the usage details for the defined scope. Usage details are available /// via this API only for May 1, 2014 or later.