From c58fee01647e3258ded685eca6d5af40475530b4 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 7 Jun 2021 17:27:33 +0000 Subject: [PATCH] CodeGen from PR 14453 in Azure/azure-rest-api-specs Merge 2caa8f85942d71cde1aec87ffa731f45b5ce988d into 10c93ad91d3f44f62f2568a5b480c538a7c15daf --- .../src/Generated/AggregatedCostOperations.cs | 2 +- .../src/Generated/BudgetsOperations.cs | 6 +- .../Generated/BudgetsOperationsExtensions.cs | 12 +- .../src/Generated/ChargesOperations.cs | 50 +- .../Generated/ChargesOperationsExtensions.cs | 62 +- .../Generated/ConsumptionManagementClient.cs | 40 +- .../src/Generated/CreditsOperations.cs | 241 ++++++ .../Generated/CreditsOperationsExtensions.cs | 67 ++ .../src/Generated/EventsOperations.cs | 800 ++++++++++++++++++ .../Generated/EventsOperationsExtensions.cs | 215 +++++ .../src/Generated/ForecastsOperations.cs | 5 +- .../ForecastsOperationsExtensions.cs | 10 +- .../src/Generated/IBudgetsOperations.cs | 8 +- .../src/Generated/IChargesOperations.cs | 29 +- .../Generated/IConsumptionManagementClient.cs | 27 +- .../src/Generated/ICreditsOperations.cs | 53 ++ .../src/Generated/IEventsOperations.cs | 142 ++++ .../src/Generated/IForecastsOperations.cs | 5 +- .../src/Generated/ILotsOperations.cs | 140 +++ .../src/Generated/IMarketplacesOperations.cs | 2 - .../src/Generated/IPriceSheetOperations.cs | 4 +- ...ervationRecommendationDetailsOperations.cs | 81 ++ .../IReservationRecommendationsOperations.cs | 25 +- .../IReservationTransactionsOperations.cs | 136 +++ .../IReservationsDetailsOperations.cs | 72 ++ .../IReservationsSummariesOperations.cs | 76 ++ .../src/Generated/IUsageDetailsOperations.cs | 110 +-- .../src/Generated/LotsOperations.cs | 776 +++++++++++++++++ .../src/Generated/LotsOperationsExtensions.cs | 203 +++++ .../src/Generated/MarketplacesOperations.cs | 2 - .../MarketplacesOperationsExtensions.cs | 4 - .../src/Generated/Models/Amount.cs | 59 ++ .../Models/AmountWithExchangeRate.cs | 59 ++ .../src/Generated/Models/Balance.cs | 10 +- .../src/Generated/Models/Budget.cs | 75 +- .../Models/BudgetComparisonExpression.cs | 100 +++ .../src/Generated/Models/BudgetFilter.cs | 116 +++ .../Models/BudgetFilterProperties.cs | 77 ++ .../src/Generated/Models/ChargeSummary.cs | 73 +- .../Generated/Models/CreditBalanceSummary.cs | 68 ++ .../src/Generated/Models/CreditSummary.cs | 114 +++ .../Generated/Models/DownloadProperties.cs | 60 ++ .../src/Generated/Models/ErrorResponse.cs | 9 + .../src/Generated/Models/EventSummary.cs | 273 ++++++ .../src/Generated/Models/EventType.cs | 27 + .../src/Generated/Models/Filters.cs | 124 --- .../src/Generated/Models/Forecast.cs | 22 +- .../src/Generated/Models/ForecastSpend.cs | 64 ++ .../Generated/Models/HighCasedErrorDetails.cs | 60 ++ .../Models/HighCasedErrorResponse.cs | 61 ++ .../Models/HighCasedErrorResponseException.cs | 62 ++ .../Generated/Models/LegacyChargeSummary.cs | 115 +++ .../Models/LegacyReservationRecommendation.cs | 190 +++++ .../Models/LegacyReservationTransaction.cs | 88 ++ .../src/Generated/Models/LegacyUsageDetail.cs | 454 ++++++++++ .../src/Generated/Models/LookBackPeriod.cs | 32 + .../src/Generated/Models/LotSource.cs | 23 + .../src/Generated/Models/LotSummary.cs | 173 ++++ .../ManagementGroupAggregatedCostResult.cs | 10 +- .../src/Generated/Models/Marketplace.cs | 20 +- .../Generated/Models/ModernChargeSummary.cs | 147 ++++ .../Models/ModernReservationRecommendation.cs | 199 +++++ .../Models/ModernReservationTransaction.cs | 237 ++++++ .../src/Generated/Models/ModernUsageDetail.cs | 733 ++++++++++++++++ .../src/Generated/Models/Notification.cs | 34 +- .../src/Generated/Models/Operation.cs | 10 +- .../src/Generated/Models/OperationDisplay.cs | 10 +- .../src/Generated/Models/PriceSheetResult.cs | 18 +- .../src/Generated/Models/Reseller.cs | 60 ++ .../src/Generated/Models/ReservationDetail.cs | 36 +- .../Models/ReservationRecommendation.cs | 103 +-- ...ationDetailsCalculatedSavingsProperties.cs | 109 +++ .../ReservationRecommendationDetailsModel.cs | 126 +++ ...RecommendationDetailsResourceProperties.cs | 99 +++ ...nRecommendationDetailsSavingsProperties.cs | 99 +++ ...ionRecommendationDetailsUsageProperties.cs | 100 +++ .../Generated/Models/ReservationSummary.cs | 64 +- .../Models/ReservationTransaction.cs | 238 ++++++ ...e.cs => ReservationTransactionResource.cs} | 49 +- .../src/Generated/Models/Resource.cs | 19 +- .../Models/{CategoryType.cs => Scope10.cs} | 8 +- .../src/Generated/Models/Scope12.cs | 22 + .../src/Generated/Models/SkuProperty.cs | 59 ++ .../src/Generated/Models/Status.cs | 26 + .../src/Generated/Models/Tag.cs | 12 +- .../src/Generated/Models/TagsResult.cs | 20 +- .../src/Generated/Models/Term.cs | 28 + .../src/Generated/Models/ThresholdType.cs | 21 + .../src/Generated/Models/TimeGrainType.cs | 3 + .../src/Generated/Models/UsageDetail.cs | 410 +-------- .../Models/UsageDetailsDownloadHeaders.cs | 77 -- .../src/Generated/PriceSheetOperations.cs | 4 +- .../PriceSheetOperationsExtensions.cs | 8 +- ...ervationRecommendationDetailsOperations.cs | 304 +++++++ ...commendationDetailsOperationsExtensions.cs | 115 +++ .../ReservationRecommendationsOperations.cs | 35 +- ...tionRecommendationsOperationsExtensions.cs | 48 +- .../ReservationTransactionsOperations.cs | 775 +++++++++++++++++ ...rvationTransactionsOperationsExtensions.cs | 191 +++++ .../ReservationsDetailsOperations.cs | 397 +++++++++ ...ReservationsDetailsOperationsExtensions.cs | 122 +++ .../ReservationsSummariesOperations.cs | 410 +++++++++ ...servationsSummariesOperationsExtensions.cs | 130 +++ .../SdkInfo_ConsumptionManagementClient.cs | 35 +- .../src/Generated/TagsOperations.cs | 2 +- .../src/Generated/UsageDetailsOperations.cs | 279 +----- .../UsageDetailsOperationsExtensions.cs | 198 +---- 107 files changed, 10774 insertions(+), 1478 deletions(-) create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/CreditsOperations.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/CreditsOperationsExtensions.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/EventsOperations.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/EventsOperationsExtensions.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ICreditsOperations.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IEventsOperations.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ILotsOperations.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IReservationRecommendationDetailsOperations.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IReservationTransactionsOperations.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/LotsOperations.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/LotsOperationsExtensions.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Amount.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/AmountWithExchangeRate.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/BudgetComparisonExpression.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/BudgetFilter.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/BudgetFilterProperties.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/CreditBalanceSummary.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/CreditSummary.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/DownloadProperties.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/EventSummary.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/EventType.cs delete mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Filters.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ForecastSpend.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/HighCasedErrorDetails.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/HighCasedErrorResponse.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/HighCasedErrorResponseException.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/LegacyChargeSummary.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/LegacyReservationRecommendation.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/LegacyReservationTransaction.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/LegacyUsageDetail.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/LookBackPeriod.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/LotSource.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/LotSummary.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ModernChargeSummary.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ModernReservationRecommendation.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ModernReservationTransaction.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ModernUsageDetail.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Reseller.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ReservationRecommendationDetailsCalculatedSavingsProperties.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ReservationRecommendationDetailsModel.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ReservationRecommendationDetailsResourceProperties.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ReservationRecommendationDetailsSavingsProperties.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ReservationRecommendationDetailsUsageProperties.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ReservationTransaction.cs rename sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/{UsageDetailsDownloadResponse.cs => ReservationTransactionResource.cs} (53%) rename sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/{CategoryType.cs => Scope10.cs} (73%) create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Scope12.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/SkuProperty.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Status.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Term.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ThresholdType.cs delete mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/UsageDetailsDownloadHeaders.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationRecommendationDetailsOperations.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationRecommendationDetailsOperationsExtensions.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationTransactionsOperations.cs create mode 100644 sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationTransactionsOperationsExtensions.cs diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/AggregatedCostOperations.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/AggregatedCostOperations.cs index 06f46593332ac..dcd1dc76d7e89 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/AggregatedCostOperations.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/AggregatedCostOperations.cs @@ -301,7 +301,7 @@ internal AggregatedCostOperations(ConsumptionManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/Microsoft.Consumption/aggregatedcost").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/Microsoft.Consumption/aggregatedCost").ToString(); _url = _url.Replace("{managementGroupId}", System.Uri.EscapeDataString(managementGroupId)); _url = _url.Replace("{billingPeriodName}", System.Uri.EscapeDataString(billingPeriodName)); List _queryParameters = new List(); diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/BudgetsOperations.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/BudgetsOperations.cs index 24145668de181..98db9a4cea2dc 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/BudgetsOperations.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/BudgetsOperations.cs @@ -446,9 +446,9 @@ internal BudgetsOperations(ConsumptionManagementClient client) } /// - /// The operation to create or update a budget. Update operation requires - /// latest eTag to be set in the request mandatorily. You may obtain the latest - /// eTag by performing a get operation. Create operation does not require eTag. + /// The operation to create or update a budget. You can optionally provide an + /// eTag if desired as a form of concurrency control. To obtain the latest eTag + /// for a given budget, perform a get operation prior to your put operation. /// /// /// diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/BudgetsOperationsExtensions.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/BudgetsOperationsExtensions.cs index af57b5143cf40..4ad41cc5ac2c1 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/BudgetsOperationsExtensions.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/BudgetsOperationsExtensions.cs @@ -160,9 +160,9 @@ public static Budget Get(this IBudgetsOperations operations, string scope, strin } /// - /// The operation to create or update a budget. Update operation requires - /// latest eTag to be set in the request mandatorily. You may obtain the latest - /// eTag by performing a get operation. Create operation does not require eTag. + /// The operation to create or update a budget. You can optionally provide an + /// eTag if desired as a form of concurrency control. To obtain the latest eTag + /// for a given budget, perform a get operation prior to your put operation. /// /// /// @@ -198,9 +198,9 @@ public static Budget CreateOrUpdate(this IBudgetsOperations operations, string s } /// - /// The operation to create or update a budget. Update operation requires - /// latest eTag to be set in the request mandatorily. You may obtain the latest - /// eTag by performing a get operation. Create operation does not require eTag. + /// The operation to create or update a budget. You can optionally provide an + /// eTag if desired as a form of concurrency control. To obtain the latest eTag + /// for a given budget, perform a get operation prior to your put operation. /// /// /// diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ChargesOperations.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ChargesOperations.cs index 6f1cd72d03021..f2b25316c7fbf 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ChargesOperations.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ChargesOperations.cs @@ -55,15 +55,30 @@ internal ChargesOperations(ConsumptionManagementClient client) /// /// /// - /// The scope associated with usage details operations. This includes + /// The scope associated with charges operations. This includes /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' - /// for Department scope and + /// for Department scope, and /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' /// for EnrollmentAccount scope. For department and enrollment accounts, 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/billingAccounts/{billingAccountId}/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. + /// Also, Modern Commerce Account scopes are + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// billingAccount scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + /// for invoiceSection scope, and + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' + /// specific for partners. + /// + /// + /// Start date + /// + /// + /// End date /// /// /// May be used to filter charges by properties/usageEnd (Utc time), @@ -72,6 +87,12 @@ internal ChargesOperations(ConsumptionManagementClient client) /// Tag filter is a key value pair string where key and value is separated by a /// colon (:). /// + /// + /// May be used to group charges for billingAccount scope by + /// properties/billingProfileId, properties/invoiceSectionId, + /// properties/customerId (specific for Partner Led), or for billingProfile + /// scope by properties/invoiceSectionId. + /// /// /// Headers that will be added to request. /// @@ -93,7 +114,7 @@ internal ChargesOperations(ConsumptionManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListByScopeWithHttpMessagesAsync(string scope, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListWithHttpMessagesAsync(string scope, string startDate = default(string), string endDate = default(string), string filter = default(string), string apply = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (scope == null) { @@ -111,9 +132,12 @@ internal ChargesOperations(ConsumptionManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("scope", scope); + tracingParameters.Add("startDate", startDate); + tracingParameters.Add("endDate", endDate); tracingParameters.Add("filter", filter); + tracingParameters.Add("apply", apply); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByScope", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -124,10 +148,22 @@ internal ChargesOperations(ConsumptionManagementClient client) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } + if (startDate != null) + { + _queryParameters.Add(string.Format("startDate={0}", System.Uri.EscapeDataString(startDate))); + } + if (endDate != null) + { + _queryParameters.Add(string.Format("endDate={0}", System.Uri.EscapeDataString(endDate))); + } if (filter != null) { _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); } + if (apply != null) + { + _queryParameters.Add(string.Format("$apply={0}", System.Uri.EscapeDataString(apply))); + } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -216,7 +252,7 @@ internal ChargesOperations(ConsumptionManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -229,7 +265,7 @@ internal ChargesOperations(ConsumptionManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ChargesOperationsExtensions.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ChargesOperationsExtensions.cs index 9183e30378add..3dd59936c7591 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ChargesOperationsExtensions.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ChargesOperationsExtensions.cs @@ -29,15 +29,30 @@ public static partial class ChargesOperationsExtensions /// The operations group for this extension method. /// /// - /// The scope associated with usage details operations. This includes + /// The scope associated with charges operations. This includes /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' - /// for Department scope and + /// for Department scope, and /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' /// for EnrollmentAccount scope. For department and enrollment accounts, 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/billingAccounts/{billingAccountId}/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. + /// Also, Modern Commerce Account scopes are + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// billingAccount scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + /// for invoiceSection scope, and + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' + /// specific for partners. + /// + /// + /// Start date + /// + /// + /// End date /// /// /// May be used to filter charges by properties/usageEnd (Utc time), @@ -46,9 +61,15 @@ public static partial class ChargesOperationsExtensions /// Tag filter is a key value pair string where key and value is separated by a /// colon (:). /// - public static ChargeSummary ListByScope(this IChargesOperations operations, string scope, string filter = default(string)) + /// + /// May be used to group charges for billingAccount scope by + /// properties/billingProfileId, properties/invoiceSectionId, + /// properties/customerId (specific for Partner Led), or for billingProfile + /// scope by properties/invoiceSectionId. + /// + public static ChargesListResult List(this IChargesOperations operations, string scope, string startDate = default(string), string endDate = default(string), string filter = default(string), string apply = default(string)) { - return operations.ListByScopeAsync(scope, filter).GetAwaiter().GetResult(); + return operations.ListAsync(scope, startDate, endDate, filter, apply).GetAwaiter().GetResult(); } /// @@ -59,15 +80,30 @@ public static partial class ChargesOperationsExtensions /// The operations group for this extension method. /// /// - /// The scope associated with usage details operations. This includes + /// The scope associated with charges operations. This includes /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' - /// for Department scope and + /// for Department scope, and /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' /// for EnrollmentAccount scope. For department and enrollment accounts, 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/billingAccounts/{billingAccountId}/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. + /// Also, Modern Commerce Account scopes are + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// billingAccount scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + /// for invoiceSection scope, and + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' + /// specific for partners. + /// + /// + /// Start date + /// + /// + /// End date /// /// /// May be used to filter charges by properties/usageEnd (Utc time), @@ -76,12 +112,18 @@ public static partial class ChargesOperationsExtensions /// Tag filter is a key value pair string where key and value is separated by a /// colon (:). /// + /// + /// May be used to group charges for billingAccount scope by + /// properties/billingProfileId, properties/invoiceSectionId, + /// properties/customerId (specific for Partner Led), or for billingProfile + /// scope by properties/invoiceSectionId. + /// /// /// The cancellation token. /// - public static async Task ListByScopeAsync(this IChargesOperations operations, string scope, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListAsync(this IChargesOperations operations, string scope, string startDate = default(string), string endDate = default(string), string filter = default(string), string apply = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByScopeWithHttpMessagesAsync(scope, filter, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListWithHttpMessagesAsync(scope, startDate, endDate, filter, apply, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } 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..e02e8646e45a9 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 2021-05-01. /// public string ApiVersion { get; private set; } @@ -121,6 +121,16 @@ public partial class ConsumptionManagementClient : ServiceClient public virtual IReservationRecommendationsOperations ReservationRecommendations { get; private set; } + /// + /// Gets the IReservationRecommendationDetailsOperations. + /// + public virtual IReservationRecommendationDetailsOperations ReservationRecommendationDetails { get; private set; } + + /// + /// Gets the IReservationTransactionsOperations. + /// + public virtual IReservationTransactionsOperations ReservationTransactions { get; private set; } + /// /// Gets the IPriceSheetOperations. /// @@ -141,6 +151,21 @@ public partial class ConsumptionManagementClient : ServiceClient public virtual IAggregatedCostOperations AggregatedCost { get; private set; } + /// + /// Gets the IEventsOperations. + /// + public virtual IEventsOperations Events { get; private set; } + + /// + /// Gets the ILotsOperations. + /// + public virtual ILotsOperations Lots { get; private set; } + + /// + /// Gets the ICreditsOperations. + /// + public virtual ICreditsOperations Credits { get; private set; } + /// /// Initializes a new instance of the ConsumptionManagementClient class. /// @@ -391,12 +416,17 @@ private void Initialize() ReservationsSummaries = new ReservationsSummariesOperations(this); ReservationsDetails = new ReservationsDetailsOperations(this); ReservationRecommendations = new ReservationRecommendationsOperations(this); + ReservationRecommendationDetails = new ReservationRecommendationDetailsOperations(this); + ReservationTransactions = new ReservationTransactionsOperations(this); PriceSheet = new PriceSheetOperations(this); Forecasts = new ForecastsOperations(this); Operations = new Operations(this); AggregatedCost = new AggregatedCostOperations(this); + Events = new EventsOperations(this); + Lots = new LotsOperations(this); + Credits = new CreditsOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2019-04-01-preview"; + ApiVersion = "2021-05-01"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; @@ -426,6 +456,12 @@ private void Initialize() new Iso8601TimeSpanConverter() } }; + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("kind")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("kind")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("kind")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("kind")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("kind")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("kind")); CustomInitialize(); DeserializationSettings.Converters.Add(new TransformationJsonConverter()); DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/CreditsOperations.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/CreditsOperations.cs new file mode 100644 index 0000000000000..86dd6b7d31bf7 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/CreditsOperations.cs @@ -0,0 +1,241 @@ +// +// 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 +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CreditsOperations operations. + /// + internal partial class CreditsOperations : IServiceOperations, ICreditsOperations + { + /// + /// Initializes a new instance of the CreditsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CreditsOperations(ConsumptionManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ConsumptionManagementClient + /// + public ConsumptionManagementClient Client { get; private set; } + + /// + /// The credit summary by billingAccountId and billingProfileId. + /// + /// + /// + /// BillingAccount ID + /// + /// + /// Azure Billing Profile ID. + /// + /// + /// 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> GetWithHttpMessagesAsync(string billingAccountId, string billingProfileId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountId"); + } + if (billingProfileId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileId"); + } + 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("billingProfileId", billingProfileId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.Consumption/credits/balanceSummary").ToString(); + _url = _url.Replace("{billingAccountId}", System.Uri.EscapeDataString(billingAccountId)); + _url = _url.Replace("{billingProfileId}", System.Uri.EscapeDataString(billingProfileId)); + List _queryParameters = new List(); + 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; + } + + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/CreditsOperationsExtensions.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/CreditsOperationsExtensions.cs new file mode 100644 index 0000000000000..f0347064ba4d6 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/CreditsOperationsExtensions.cs @@ -0,0 +1,67 @@ +// +// 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 +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for CreditsOperations. + /// + public static partial class CreditsOperationsExtensions + { + /// + /// The credit summary by billingAccountId and billingProfileId. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// BillingAccount ID + /// + /// + /// Azure Billing Profile ID. + /// + public static CreditSummary Get(this ICreditsOperations operations, string billingAccountId, string billingProfileId) + { + return operations.GetAsync(billingAccountId, billingProfileId).GetAwaiter().GetResult(); + } + + /// + /// The credit summary by billingAccountId and billingProfileId. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// BillingAccount ID + /// + /// + /// Azure Billing Profile ID. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ICreditsOperations operations, string billingAccountId, string billingProfileId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountId, billingProfileId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/EventsOperations.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/EventsOperations.cs new file mode 100644 index 0000000000000..8d464ad851c90 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/EventsOperations.cs @@ -0,0 +1,800 @@ +// +// 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 +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// EventsOperations operations. + /// + internal partial class EventsOperations : IServiceOperations, IEventsOperations + { + /// + /// Initializes a new instance of the EventsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal EventsOperations(ConsumptionManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ConsumptionManagementClient + /// + public ConsumptionManagementClient Client { get; private set; } + + /// + /// Lists the events that decrements Azure credits or Microsoft Azure + /// consumption commitment for a billing account or a billing profile for a + /// given start and end date. + /// + /// + /// + /// BillingAccount ID + /// + /// + /// Azure Billing Profile ID. + /// + /// + /// Start date + /// + /// + /// End date + /// + /// + /// 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>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountId, string billingProfileId, string startDate, string endDate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountId"); + } + if (billingProfileId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (startDate == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "startDate"); + } + if (endDate == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "endDate"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountId", billingAccountId); + tracingParameters.Add("billingProfileId", billingProfileId); + tracingParameters.Add("startDate", startDate); + tracingParameters.Add("endDate", endDate); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.Consumption/events").ToString(); + _url = _url.Replace("{billingAccountId}", System.Uri.EscapeDataString(billingAccountId)); + _url = _url.Replace("{billingProfileId}", System.Uri.EscapeDataString(billingProfileId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (startDate != null) + { + _queryParameters.Add(string.Format("startDate={0}", System.Uri.EscapeDataString(startDate))); + } + if (endDate != null) + { + _queryParameters.Add(string.Format("endDate={0}", System.Uri.EscapeDataString(endDate))); + } + 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 events that decrements Azure credits or Microsoft Azure + /// consumption commitment for a billing account or a billing profile for a + /// given start and end date. + /// + /// + /// + /// BillingAccount ID + /// + /// + /// May be used to filter the events by lotId, lotSource etc. 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 (:). + /// + /// + /// 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>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountId, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountId"); + } + 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, "ListByBillingAccount", 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/events").ToString(); + _url = _url.Replace("{billingAccountId}", System.Uri.EscapeDataString(billingAccountId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + 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 events that decrements Azure credits or Microsoft Azure + /// consumption commitment for a billing account or a billing profile for a + /// given start and end date. + /// + /// + /// + /// 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>> ListByBillingProfileNextWithHttpMessagesAsync(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, "ListByBillingProfileNext", 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) + { + 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 events that decrements Azure credits or Microsoft Azure + /// consumption commitment for a billing account or a billing profile for a + /// given start and end date. + /// + /// + /// + /// 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>> ListByBillingAccountNextWithHttpMessagesAsync(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, "ListByBillingAccountNext", 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) + { + 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; + } + + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/EventsOperationsExtensions.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/EventsOperationsExtensions.cs new file mode 100644 index 0000000000000..36be952ce3320 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/EventsOperationsExtensions.cs @@ -0,0 +1,215 @@ +// +// 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 +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for EventsOperations. + /// + public static partial class EventsOperationsExtensions + { + /// + /// Lists the events that decrements Azure credits or Microsoft Azure + /// consumption commitment for a billing account or a billing profile for a + /// given start and end date. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// BillingAccount ID + /// + /// + /// Azure Billing Profile ID. + /// + /// + /// Start date + /// + /// + /// End date + /// + public static IPage ListByBillingProfile(this IEventsOperations operations, string billingAccountId, string billingProfileId, string startDate, string endDate) + { + return operations.ListByBillingProfileAsync(billingAccountId, billingProfileId, startDate, endDate).GetAwaiter().GetResult(); + } + + /// + /// Lists the events that decrements Azure credits or Microsoft Azure + /// consumption commitment for a billing account or a billing profile for a + /// given start and end date. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// BillingAccount ID + /// + /// + /// Azure Billing Profile ID. + /// + /// + /// Start date + /// + /// + /// End date + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingProfileAsync(this IEventsOperations operations, string billingAccountId, string billingProfileId, string startDate, string endDate, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountId, billingProfileId, startDate, endDate, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the events that decrements Azure credits or Microsoft Azure + /// consumption commitment for a billing account or a billing profile for a + /// given start and end date. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// BillingAccount ID + /// + /// + /// May be used to filter the events by lotId, lotSource etc. 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 (:). + /// + public static IPage ListByBillingAccount(this IEventsOperations operations, string billingAccountId, string filter = default(string)) + { + return operations.ListByBillingAccountAsync(billingAccountId, filter).GetAwaiter().GetResult(); + } + + /// + /// Lists the events that decrements Azure credits or Microsoft Azure + /// consumption commitment for a billing account or a billing profile for a + /// given start and end date. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// BillingAccount ID + /// + /// + /// May be used to filter the events by lotId, lotSource etc. 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 (:). + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingAccountAsync(this IEventsOperations operations, string billingAccountId, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountId, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the events that decrements Azure credits or Microsoft Azure + /// consumption commitment for a billing account or a billing profile for a + /// given start and end date. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByBillingProfileNext(this IEventsOperations operations, string nextPageLink) + { + return operations.ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the events that decrements Azure credits or Microsoft Azure + /// consumption commitment for a billing account or a billing profile for a + /// given start and end date. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingProfileNextAsync(this IEventsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the events that decrements Azure credits or Microsoft Azure + /// consumption commitment for a billing account or a billing profile for a + /// given start and end date. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByBillingAccountNext(this IEventsOperations operations, string nextPageLink) + { + return operations.ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the events that decrements Azure credits or Microsoft Azure + /// consumption commitment for a billing account or a billing profile for a + /// given start and end date. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingAccountNextAsync(this IEventsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ForecastsOperations.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ForecastsOperations.cs index e6b0aa3b31a4c..b86edd9ac9c75 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ForecastsOperations.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ForecastsOperations.cs @@ -52,7 +52,10 @@ internal ForecastsOperations(ConsumptionManagementClient client) public ConsumptionManagementClient Client { get; private set; } /// - /// Lists the forecast charges by subscriptionId. + /// Lists the forecast charges for scope defined. Please note that this API is + /// no longer actively under development. We recommend using our new Forecast + /// API moving forward: + /// https://docs.microsoft.com/en-us/rest/api/cost-management/forecast/usage. /// /// /// diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ForecastsOperationsExtensions.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ForecastsOperationsExtensions.cs index a131026558b67..47b7d8570b265 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ForecastsOperationsExtensions.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ForecastsOperationsExtensions.cs @@ -25,7 +25,10 @@ namespace Microsoft.Azure.Management.Consumption public static partial class ForecastsOperationsExtensions { /// - /// Lists the forecast charges by subscriptionId. + /// Lists the forecast charges for scope defined. Please note that this API is + /// no longer actively under development. We recommend using our new Forecast + /// API moving forward: + /// https://docs.microsoft.com/en-us/rest/api/cost-management/forecast/usage. /// /// /// @@ -40,7 +43,10 @@ public static partial class ForecastsOperationsExtensions } /// - /// Lists the forecast charges by subscriptionId. + /// Lists the forecast charges for scope defined. Please note that this API is + /// no longer actively under development. We recommend using our new Forecast + /// API moving forward: + /// https://docs.microsoft.com/en-us/rest/api/cost-management/forecast/usage. /// /// /// diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IBudgetsOperations.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IBudgetsOperations.cs index 6e5fcfd6f474a..b825c464a8c80 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IBudgetsOperations.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IBudgetsOperations.cs @@ -103,10 +103,10 @@ public partial interface IBudgetsOperations /// Task> GetWithHttpMessagesAsync(string scope, string budgetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// The operation to create or update a budget. Update operation - /// requires latest eTag to be set in the request mandatorily. You may - /// obtain the latest eTag by performing a get operation. Create - /// operation does not require eTag. + /// The operation to create or update a budget. You can optionally + /// provide an eTag if desired as a form of concurrency control. To + /// obtain the latest eTag for a given budget, perform a get operation + /// prior to your put operation. /// /// /// diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IChargesOperations.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IChargesOperations.cs index 2504a13be9359..3b00e95b567a1 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IChargesOperations.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IChargesOperations.cs @@ -28,15 +28,30 @@ public partial interface IChargesOperations /// /// /// - /// The scope associated with usage details operations. This includes + /// The scope associated with charges operations. This includes /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' - /// for Department scope and + /// for Department scope, and /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' /// for EnrollmentAccount scope. For department and enrollment /// accounts, 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/billingAccounts/{billingAccountId}/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. + /// Also, Modern Commerce Account scopes are + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + /// for billingAccount scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + /// for invoiceSection scope, and + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' + /// specific for partners. + /// + /// + /// Start date + /// + /// + /// End date /// /// /// May be used to filter charges by properties/usageEnd (Utc time), @@ -45,6 +60,12 @@ public partial interface IChargesOperations /// 'or', or 'not'. Tag filter is a key value pair string where key and /// value is separated by a colon (:). /// + /// + /// May be used to group charges for billingAccount scope by + /// properties/billingProfileId, properties/invoiceSectionId, + /// properties/customerId (specific for Partner Led), or for + /// billingProfile scope by properties/invoiceSectionId. + /// /// /// The headers that will be added to request. /// @@ -60,6 +81,6 @@ public partial interface IChargesOperations /// /// Thrown when a required parameter is null /// - Task> ListByScopeWithHttpMessagesAsync(string scope, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListWithHttpMessagesAsync(string scope, string startDate = default(string), string endDate = default(string), string filter = default(string), string apply = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } 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..c1505d7d110d5 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 2021-05-01. /// string ApiVersion { get; } @@ -116,6 +116,16 @@ public partial interface IConsumptionManagementClient : System.IDisposable /// IReservationRecommendationsOperations ReservationRecommendations { get; } + /// + /// Gets the IReservationRecommendationDetailsOperations. + /// + IReservationRecommendationDetailsOperations ReservationRecommendationDetails { get; } + + /// + /// Gets the IReservationTransactionsOperations. + /// + IReservationTransactionsOperations ReservationTransactions { get; } + /// /// Gets the IPriceSheetOperations. /// @@ -136,5 +146,20 @@ public partial interface IConsumptionManagementClient : System.IDisposable /// IAggregatedCostOperations AggregatedCost { get; } + /// + /// Gets the IEventsOperations. + /// + IEventsOperations Events { get; } + + /// + /// Gets the ILotsOperations. + /// + ILotsOperations Lots { get; } + + /// + /// Gets the ICreditsOperations. + /// + ICreditsOperations Credits { get; } + } } diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ICreditsOperations.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ICreditsOperations.cs new file mode 100644 index 0000000000000..1e8cd2998e8d5 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ICreditsOperations.cs @@ -0,0 +1,53 @@ +// +// 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 +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CreditsOperations operations. + /// + public partial interface ICreditsOperations + { + /// + /// The credit summary by billingAccountId and billingProfileId. + /// + /// + /// + /// BillingAccount ID + /// + /// + /// Azure Billing Profile ID. + /// + /// + /// 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> GetWithHttpMessagesAsync(string billingAccountId, string billingProfileId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IEventsOperations.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IEventsOperations.cs new file mode 100644 index 0000000000000..0b70ab7b11eeb --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IEventsOperations.cs @@ -0,0 +1,142 @@ +// +// 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 +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// EventsOperations operations. + /// + public partial interface IEventsOperations + { + /// + /// Lists the events that decrements Azure credits or Microsoft Azure + /// consumption commitment for a billing account or a billing profile + /// for a given start and end date. + /// + /// + /// + /// BillingAccount ID + /// + /// + /// Azure Billing Profile ID. + /// + /// + /// Start date + /// + /// + /// End date + /// + /// + /// 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>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountId, string billingProfileId, string startDate, string endDate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the events that decrements Azure credits or Microsoft Azure + /// consumption commitment for a billing account or a billing profile + /// for a given start and end date. + /// + /// + /// + /// BillingAccount ID + /// + /// + /// May be used to filter the events by lotId, lotSource etc. 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 (:). + /// + /// + /// 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>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountId, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the events that decrements Azure credits or Microsoft Azure + /// consumption commitment for a billing account or a billing profile + /// for a given start and end date. + /// + /// + /// + /// 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>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the events that decrements Azure credits or Microsoft Azure + /// consumption commitment for a billing account or a billing profile + /// for a given start and end date. + /// + /// + /// + /// 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>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IForecastsOperations.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IForecastsOperations.cs index 348fe562c4126..370bb08e45eb5 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IForecastsOperations.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IForecastsOperations.cs @@ -25,7 +25,10 @@ namespace Microsoft.Azure.Management.Consumption public partial interface IForecastsOperations { /// - /// Lists the forecast charges by subscriptionId. + /// Lists the forecast charges for scope defined. Please note that this + /// API is no longer actively under development. We recommend using our + /// new Forecast API moving forward: + /// https://docs.microsoft.com/en-us/rest/api/cost-management/forecast/usage. /// /// /// diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ILotsOperations.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ILotsOperations.cs new file mode 100644 index 0000000000000..a2d1233ced8de --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ILotsOperations.cs @@ -0,0 +1,140 @@ +// +// 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 +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// LotsOperations operations. + /// + public partial interface ILotsOperations + { + /// + /// Lists all Azure credits and Microsoft Azure consumption commitments + /// for a billing account or a billing profile. Microsoft Azure + /// consumption commitments are only supported for the billing account + /// scope. + /// + /// + /// + /// BillingAccount ID + /// + /// + /// Azure Billing Profile ID. + /// + /// + /// 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>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountId, string billingProfileId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all Azure credits and Microsoft Azure consumption commitments + /// for a billing account or a billing profile. Microsoft Azure + /// consumption commitments are only supported for the billing account + /// scope. + /// + /// + /// + /// BillingAccount ID + /// + /// + /// May be used to filter the lots by Status, Source etc. 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 (:). + /// + /// + /// 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>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountId, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all Azure credits and Microsoft Azure consumption commitments + /// for a billing account or a billing profile. Microsoft Azure + /// consumption commitments are only supported for the 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>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all Azure credits and Microsoft Azure consumption commitments + /// for a billing account or a billing profile. Microsoft Azure + /// consumption commitments are only supported for the 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>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IMarketplacesOperations.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IMarketplacesOperations.cs index 78a4d29037a96..7f843e2880478 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IMarketplacesOperations.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IMarketplacesOperations.cs @@ -33,8 +33,6 @@ public partial interface IMarketplacesOperations /// /// The scope associated with marketplace 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 diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IPriceSheetOperations.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IPriceSheetOperations.cs index 06289b05f713b..75b68d19677ba 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IPriceSheetOperations.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IPriceSheetOperations.cs @@ -24,8 +24,8 @@ namespace Microsoft.Azure.Management.Consumption public partial interface IPriceSheetOperations { /// - /// Gets the price sheet for a scope by subscriptionId. Price sheet is - /// available via this API only for May 1, 2014 or later. + /// Gets the price sheet for a subscription. Price sheet is available + /// via this API only for May 1, 2014 or later. /// /// /// diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IReservationRecommendationDetailsOperations.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IReservationRecommendationDetailsOperations.cs new file mode 100644 index 0000000000000..8eeb125b8ef54 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IReservationRecommendationDetailsOperations.cs @@ -0,0 +1,81 @@ +// +// 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 +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ReservationRecommendationDetailsOperations operations. + /// + public partial interface IReservationRecommendationDetailsOperations + { + /// + /// Details of a reservation recommendation for what-if analysis of + /// reserved instances. + /// + /// + /// + /// The scope associated with reservation recommendation details + /// operations. This includes '/subscriptions/{subscriptionId}/' for + /// subscription scope, + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + /// for resource group scope, + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + /// for BillingAccount scope, and + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope + /// + /// + /// Scope of the reservation. Possible values include: 'Single', + /// 'Shared' + /// + /// + /// Used to select the region the recommendation should be generated + /// for. + /// + /// + /// Specify length of reservation recommendation term. Possible values + /// include: 'P1Y', 'P3Y' + /// + /// + /// Filter the time period on which reservation recommendation results + /// are based. Possible values include: 'Last07Days', 'Last30Days', + /// 'Last60Days' + /// + /// + /// Filter the products for which reservation recommendation results + /// are generated. Examples: Standard_DS1_v2 (for VM), + /// Premium_SSD_Managed_Disks_P30 (for Managed Disks) + /// + /// + /// 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> GetWithHttpMessagesAsync(string scope, string scope1, string region, string term, string lookBackPeriod, string product, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} 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..90b8afebdfc90 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IReservationRecommendationsOperations.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IReservationRecommendationsOperations.cs @@ -27,9 +27,28 @@ public partial interface IReservationRecommendationsOperations /// List of recommendations for purchasing reserved instances. /// /// + /// + /// The scope associated with reservation recommendations operations. + /// This includes '/subscriptions/{subscriptionId}/' for subscription + /// scope, + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' + /// for resource group scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + /// for BillingAccount scope, and + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope + /// /// - /// May be used to filter reservationRecommendations by - /// properties/scope and properties/lookBackPeriod. + /// May be used to filter reservationRecommendations by: + /// properties/scope with allowed values ['Single', 'Shared'] and + /// default value 'Single'; properties/resourceType with allowed values + /// ['VirtualMachines', 'SQLDatabases', 'PostgreSQL', 'ManagedDisk', + /// 'MySQL', 'RedHat', 'MariaDB', 'RedisCache', 'CosmosDB', + /// 'SqlDataWarehouse', 'SUSELinux', 'AppService', 'BlockBlob', + /// 'AzureDataExplorer', 'VMwareCloudSimple'] and default value + /// 'VirtualMachines'; and properties/lookBackPeriod with allowed + /// values ['Last7Days', 'Last30Days', 'Last60Days'] and default value + /// 'Last7Days'. /// /// /// The headers that will be added to request. @@ -46,7 +65,7 @@ public partial interface IReservationRecommendationsOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string scope, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// List of recommendations for purchasing reserved instances. /// diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IReservationTransactionsOperations.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IReservationTransactionsOperations.cs new file mode 100644 index 0000000000000..34209e130e3be --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IReservationTransactionsOperations.cs @@ -0,0 +1,136 @@ +// +// 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 +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ReservationTransactionsOperations operations. + /// + public partial interface IReservationTransactionsOperations + { + /// + /// List of transactions for reserved instances on billing account + /// scope + /// + /// + /// + /// BillingAccount ID + /// + /// + /// Filter reservation transactions by date range. The + /// properties/EventDate 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>> ListWithHttpMessagesAsync(string billingAccountId, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List of transactions for reserved instances on billing account + /// scope + /// + /// + /// + /// BillingAccount ID + /// + /// + /// Azure Billing Profile ID. + /// + /// + /// Filter reservation transactions by date range. The + /// properties/EventDate 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>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountId, string billingProfileId, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List of transactions for 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>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List of transactions for 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>> ListByBillingProfileNextWithHttpMessagesAsync(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..911b2ed37fc0c 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IReservationsDetailsOperations.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IReservationsDetailsOperations.cs @@ -81,6 +81,54 @@ public partial interface IReservationsDetailsOperations /// Task>> ListByReservationOrderAndReservationWithHttpMessagesAsync(string reservationOrderId, string reservationId, string filter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Lists the reservations details for the defined scope and provided + /// date range. + /// + /// + /// + /// The scope associated with reservations details operations. This + /// includes + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + /// for BillingAccount scope (legacy), and + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope (modern). + /// + /// + /// Start date. Only applicable when querying with billing profile + /// + /// + /// End date. Only applicable when querying with billing profile + /// + /// + /// Filter reservation details by date range. The properties/UsageDate + /// for start date and end date. The filter supports 'le' and 'ge'. + /// Not applicable when querying with billing profile + /// + /// + /// Reservation Id GUID. Only valid if reservationOrderId is also + /// provided. Filter to a specific reservation + /// + /// + /// Reservation Order Id GUID. Required if reservationId is provided. + /// Filter to a specific reservation order + /// + /// + /// 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>> ListWithHttpMessagesAsync(string scope, string startDate = default(string), string endDate = default(string), string filter = default(string), string reservationId = default(string), string reservationOrderId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Lists the reservations details for provided date range. /// /// @@ -126,5 +174,29 @@ 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 the defined scope and 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>> ListNextWithHttpMessagesAsync(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..6ce8a51e023b4 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IReservationsSummariesOperations.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IReservationsSummariesOperations.cs @@ -89,6 +89,58 @@ public partial interface IReservationsSummariesOperations /// Task>> ListByReservationOrderAndReservationWithHttpMessagesAsync(string reservationOrderId, string reservationId, string grain, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Lists the reservations summaries for the defined scope daily or + /// monthly grain. + /// + /// + /// + /// The scope associated with reservations summaries operations. This + /// includes + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + /// for BillingAccount scope (legacy), and + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope (modern). + /// + /// + /// Can be daily or monthly. Possible values include: 'DailyGrain', + /// 'MonthlyGrain' + /// + /// + /// Start date. Only applicable when querying with billing profile + /// + /// + /// End date. Only applicable when querying with billing profile + /// + /// + /// Required only for daily grain. The properties/UsageDate for start + /// date and end date. The filter supports 'le' and 'ge'. Not + /// applicable when querying with billing profile + /// + /// + /// Reservation Id GUID. Only valid if reservationOrderId is also + /// provided. Filter to a specific reservation + /// + /// + /// Reservation Order Id GUID. Required if reservationId is provided. + /// Filter to a specific reservation order + /// + /// + /// 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>> ListWithHttpMessagesAsync(string scope, string grain, string startDate = default(string), string endDate = default(string), string filter = default(string), string reservationId = default(string), string reservationOrderId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Lists the reservations summaries for daily or monthly grain. /// /// @@ -134,5 +186,29 @@ 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 the defined scope 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>> ListNextWithHttpMessagesAsync(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..bd9b345404834 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IUsageDetailsOperations.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IUsageDetailsOperations.cs @@ -31,8 +31,6 @@ public partial interface IUsageDetailsOperations /// /// 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 @@ -45,7 +43,16 @@ public partial interface IUsageDetailsOperations /// 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}' + /// '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. + /// Also, Modern Commerce Account scopes are + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' + /// for billingAccount scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + /// for invoiceSection scope, and + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' + /// specific for partners. /// /// /// May be used to expand the properties/additionalInfo or @@ -55,10 +62,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 +102,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/LotsOperations.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/LotsOperations.cs new file mode 100644 index 0000000000000..831c07ea1f355 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/LotsOperations.cs @@ -0,0 +1,776 @@ +// +// 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 +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// LotsOperations operations. + /// + internal partial class LotsOperations : IServiceOperations, ILotsOperations + { + /// + /// Initializes a new instance of the LotsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal LotsOperations(ConsumptionManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ConsumptionManagementClient + /// + public ConsumptionManagementClient Client { get; private set; } + + /// + /// Lists all Azure credits and Microsoft Azure consumption commitments for a + /// billing account or a billing profile. Microsoft Azure consumption + /// commitments are only supported for the billing account scope. + /// + /// + /// + /// BillingAccount ID + /// + /// + /// Azure Billing Profile ID. + /// + /// + /// 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>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountId, string billingProfileId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountId"); + } + if (billingProfileId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileId"); + } + 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("billingProfileId", billingProfileId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.Consumption/lots").ToString(); + _url = _url.Replace("{billingAccountId}", System.Uri.EscapeDataString(billingAccountId)); + _url = _url.Replace("{billingProfileId}", System.Uri.EscapeDataString(billingProfileId)); + List _queryParameters = new List(); + 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 all Azure credits and Microsoft Azure consumption commitments for a + /// billing account or a billing profile. Microsoft Azure consumption + /// commitments are only supported for the billing account scope. + /// + /// + /// + /// BillingAccount ID + /// + /// + /// May be used to filter the lots by Status, Source etc. 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 (:). + /// + /// + /// 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>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountId, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountId"); + } + 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, "ListByBillingAccount", 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/lots").ToString(); + _url = _url.Replace("{billingAccountId}", System.Uri.EscapeDataString(billingAccountId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + 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 all Azure credits and Microsoft Azure consumption commitments for a + /// billing account or a billing profile. Microsoft Azure consumption + /// commitments are only supported for the 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>> ListByBillingProfileNextWithHttpMessagesAsync(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, "ListByBillingProfileNext", 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) + { + 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 all Azure credits and Microsoft Azure consumption commitments for a + /// billing account or a billing profile. Microsoft Azure consumption + /// commitments are only supported for the 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>> ListByBillingAccountNextWithHttpMessagesAsync(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, "ListByBillingAccountNext", 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) + { + 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; + } + + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/LotsOperationsExtensions.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/LotsOperationsExtensions.cs new file mode 100644 index 0000000000000..1b64b5abd11f9 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/LotsOperationsExtensions.cs @@ -0,0 +1,203 @@ +// +// 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 +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for LotsOperations. + /// + public static partial class LotsOperationsExtensions + { + /// + /// Lists all Azure credits and Microsoft Azure consumption commitments for a + /// billing account or a billing profile. Microsoft Azure consumption + /// commitments are only supported for the billing account scope. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// BillingAccount ID + /// + /// + /// Azure Billing Profile ID. + /// + public static IPage ListByBillingProfile(this ILotsOperations operations, string billingAccountId, string billingProfileId) + { + return operations.ListByBillingProfileAsync(billingAccountId, billingProfileId).GetAwaiter().GetResult(); + } + + /// + /// Lists all Azure credits and Microsoft Azure consumption commitments for a + /// billing account or a billing profile. Microsoft Azure consumption + /// commitments are only supported for the billing account scope. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// BillingAccount ID + /// + /// + /// Azure Billing Profile ID. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingProfileAsync(this ILotsOperations operations, string billingAccountId, string billingProfileId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountId, billingProfileId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all Azure credits and Microsoft Azure consumption commitments for a + /// billing account or a billing profile. Microsoft Azure consumption + /// commitments are only supported for the billing account scope. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// BillingAccount ID + /// + /// + /// May be used to filter the lots by Status, Source etc. 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 (:). + /// + public static IPage ListByBillingAccount(this ILotsOperations operations, string billingAccountId, string filter = default(string)) + { + return operations.ListByBillingAccountAsync(billingAccountId, filter).GetAwaiter().GetResult(); + } + + /// + /// Lists all Azure credits and Microsoft Azure consumption commitments for a + /// billing account or a billing profile. Microsoft Azure consumption + /// commitments are only supported for the billing account scope. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// BillingAccount ID + /// + /// + /// May be used to filter the lots by Status, Source etc. 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 (:). + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingAccountAsync(this ILotsOperations operations, string billingAccountId, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountId, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all Azure credits and Microsoft Azure consumption commitments for a + /// billing account or a billing profile. Microsoft Azure consumption + /// commitments are only supported for the billing account scope. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByBillingProfileNext(this ILotsOperations operations, string nextPageLink) + { + return operations.ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all Azure credits and Microsoft Azure consumption commitments for a + /// billing account or a billing profile. Microsoft Azure consumption + /// commitments are only supported for the 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> ListByBillingProfileNextAsync(this ILotsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all Azure credits and Microsoft Azure consumption commitments for a + /// billing account or a billing profile. Microsoft Azure consumption + /// commitments are only supported for the billing account scope. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByBillingAccountNext(this ILotsOperations operations, string nextPageLink) + { + return operations.ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all Azure credits and Microsoft Azure consumption commitments for a + /// billing account or a billing profile. Microsoft Azure consumption + /// commitments are only supported for the 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> ListByBillingAccountNextAsync(this ILotsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/MarketplacesOperations.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/MarketplacesOperations.cs index d858ca0213eb0..3b0ec7259b61a 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/MarketplacesOperations.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/MarketplacesOperations.cs @@ -59,8 +59,6 @@ internal MarketplacesOperations(ConsumptionManagementClient client) /// /// The scope associated with marketplace 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 diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/MarketplacesOperationsExtensions.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/MarketplacesOperationsExtensions.cs index 0d7f5e6759670..d262afccf0d52 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/MarketplacesOperationsExtensions.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/MarketplacesOperationsExtensions.cs @@ -33,8 +33,6 @@ public static partial class MarketplacesOperationsExtensions /// /// The scope associated with marketplace 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 @@ -74,8 +72,6 @@ public static partial class MarketplacesOperationsExtensions /// /// The scope associated with marketplace 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 diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Amount.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Amount.cs new file mode 100644 index 0000000000000..9e6654b8f6556 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Amount.cs @@ -0,0 +1,59 @@ +// +// 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; + + /// + /// The amount plus currency . + /// + public partial class Amount + { + /// + /// Initializes a new instance of the Amount class. + /// + public Amount() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Amount class. + /// + /// Amount currency. + /// Amount. + public Amount(string currency = default(string), decimal? value = default(decimal?)) + { + Currency = currency; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets amount currency. + /// + [JsonProperty(PropertyName = "currency")] + public string Currency { get; private set; } + + /// + /// Gets amount. + /// + [JsonProperty(PropertyName = "value")] + public decimal? Value { get; private set; } + + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/AmountWithExchangeRate.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/AmountWithExchangeRate.cs new file mode 100644 index 0000000000000..809b5b91a3c2c --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/AmountWithExchangeRate.cs @@ -0,0 +1,59 @@ +// +// 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; + + /// + /// The amount with exchange rate. + /// + public partial class AmountWithExchangeRate + { + /// + /// Initializes a new instance of the AmountWithExchangeRate class. + /// + public AmountWithExchangeRate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AmountWithExchangeRate class. + /// + /// The exchange rate. + /// The exchange rate month. + public AmountWithExchangeRate(decimal? exchangeRate = default(decimal?), int? exchangeRateMonth = default(int?)) + { + ExchangeRate = exchangeRate; + ExchangeRateMonth = exchangeRateMonth; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the exchange rate. + /// + [JsonProperty(PropertyName = "exchangeRate")] + public decimal? ExchangeRate { get; private set; } + + /// + /// Gets the exchange rate month. + /// + [JsonProperty(PropertyName = "exchangeRateMonth")] + public int? ExchangeRateMonth { get; private set; } + + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Balance.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Balance.cs index 72871f81e602c..e3194e7ab528c 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Balance.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Balance.cs @@ -34,9 +34,11 @@ public Balance() /// /// Initializes a new instance of the Balance class. /// - /// Resource Id. - /// Resource name. + /// The full qualified ARM ID of an event. + /// The ID that uniquely identifies an event. + /// /// Resource type. + /// The etag for the resource. /// Resource tags. /// The ISO currency in which the meter is /// charged, for example, USD. @@ -62,8 +64,8 @@ public Balance() /// List of new purchases. /// List of Adjustments (Promo credit, /// SIE credit etc.). - public Balance(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string currency = default(string), decimal? beginningBalance = default(decimal?), decimal? endingBalance = default(decimal?), decimal? newPurchases = default(decimal?), decimal? adjustments = default(decimal?), decimal? utilized = default(decimal?), decimal? serviceOverage = default(decimal?), decimal? chargesBilledSeparately = default(decimal?), decimal? totalOverage = default(decimal?), decimal? totalUsage = default(decimal?), decimal? azureMarketplaceServiceCharges = default(decimal?), string billingFrequency = default(string), bool? priceHidden = default(bool?), IList newPurchasesDetails = default(IList), IList adjustmentDetails = default(IList)) - : base(id, name, type, tags) + public Balance(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), IDictionary tags = default(IDictionary), string currency = default(string), decimal? beginningBalance = default(decimal?), decimal? endingBalance = default(decimal?), decimal? newPurchases = default(decimal?), decimal? adjustments = default(decimal?), decimal? utilized = default(decimal?), decimal? serviceOverage = default(decimal?), decimal? chargesBilledSeparately = default(decimal?), decimal? totalOverage = default(decimal?), decimal? totalUsage = default(decimal?), decimal? azureMarketplaceServiceCharges = default(decimal?), string billingFrequency = default(string), bool? priceHidden = default(bool?), IList newPurchasesDetails = default(IList), IList adjustmentDetails = default(IList)) + : base(id, name, type, etag, tags) { Currency = currency; BeginningBalance = beginningBalance; 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..b7e35018ae4a7 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 @@ -34,18 +34,18 @@ public Budget() /// /// Initializes a new instance of the Budget class. /// - /// The category of the budget, whether the - /// budget tracks cost or usage. Possible values include: 'Cost', - /// 'Usage' /// The total amount of cost to track with the /// 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' + /// the amount will be reset based on the time grain. BillingMonth, + /// BillingQuarter, and BillingAnnual are only supported by WD + /// customers. Possible values 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. - /// Future start date should not be more than three months. Past start + /// Future start date should not be more than twelve months. Past start /// date should be selected within the timegrain period. There are no /// restrictions on the end date. /// Resource Id. @@ -54,36 +54,38 @@ public Budget() /// eTag of the resource. To handle concurrent /// update scenario, this field will be used to determine whether the /// user is updating the latest version or not. - /// May be used to filter budgets by resource - /// group, resource, or meter. + /// May be used to filter budgets by + /// user-specified dimensions and/or tags. /// The current amount of cost which is /// being tracked for a budget. /// Dictionary of notifications associated /// with the budget. Budget can have up to five notifications. - public Budget(string category, decimal amount, string timeGrain, BudgetTimePeriod timePeriod, string id = default(string), string name = default(string), string type = default(string), string eTag = default(string), Filters filters = default(Filters), CurrentSpend currentSpend = default(CurrentSpend), IDictionary notifications = default(IDictionary)) + /// The forecasted cost which is being + /// tracked for a budget. + public Budget(decimal amount, string timeGrain, BudgetTimePeriod timePeriod, string id = default(string), string name = default(string), string type = default(string), string eTag = default(string), BudgetFilter filter = default(BudgetFilter), CurrentSpend currentSpend = default(CurrentSpend), IDictionary notifications = default(IDictionary), ForecastSpend forecastSpend = default(ForecastSpend)) : base(id, name, type, eTag) { - Category = category; Amount = amount; TimeGrain = timeGrain; TimePeriod = timePeriod; - Filters = filters; + Filter = filter; CurrentSpend = currentSpend; Notifications = notifications; + ForecastSpend = forecastSpend; CustomInit(); } - /// - /// An initialization method that performs custom operations like setting defaults + /// Static constructor for Budget class. /// - partial void CustomInit(); + static Budget() + { + Category = "Cost"; + } /// - /// Gets or sets the category of the budget, whether the budget tracks - /// cost or usage. Possible values include: 'Cost', 'Usage' + /// An initialization method that performs custom operations like setting defaults /// - [JsonProperty(PropertyName = "properties.category")] - public string Category { get; set; } + partial void CustomInit(); /// /// Gets or sets the total amount of cost to track with the budget @@ -93,8 +95,10 @@ 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' + /// will be reset based on the time grain. BillingMonth, + /// BillingQuarter, and BillingAnnual are only supported by WD + /// customers. Possible values include: 'Monthly', 'Quarterly', + /// 'Annually', 'BillingMonth', 'BillingQuarter', 'BillingAnnual' /// [JsonProperty(PropertyName = "properties.timeGrain")] public string TimeGrain { get; set; } @@ -103,7 +107,7 @@ public Budget() /// Gets or sets 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. Future start - /// date should not be more than three months. Past start date should + /// date should not be more than twelve months. Past start date should /// be selected within the timegrain period. There are no restrictions /// on the end date. /// @@ -111,11 +115,11 @@ public Budget() public BudgetTimePeriod TimePeriod { get; set; } /// - /// Gets or sets may be used to filter budgets by resource group, - /// resource, or meter. + /// Gets or sets may be used to filter budgets by user-specified + /// dimensions and/or tags. /// - [JsonProperty(PropertyName = "properties.filters")] - public Filters Filters { get; set; } + [JsonProperty(PropertyName = "properties.filter")] + public BudgetFilter Filter { get; set; } /// /// Gets the current amount of cost which is being tracked for a @@ -131,6 +135,19 @@ public Budget() [JsonProperty(PropertyName = "properties.notifications")] public IDictionary Notifications { get; set; } + /// + /// Gets the forecasted cost which is being tracked for a budget. + /// + [JsonProperty(PropertyName = "properties.forecastSpend")] + public ForecastSpend ForecastSpend { get; private set; } + + /// + /// The category of the budget, whether the budget tracks cost or + /// usage. + /// + [JsonProperty(PropertyName = "properties.category")] + public static string Category { get; private set; } + /// /// Validate the object. /// @@ -139,10 +156,6 @@ public Budget() /// public virtual void Validate() { - if (Category == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Category"); - } if (TimeGrain == null) { throw new ValidationException(ValidationRules.CannotBeNull, "TimeGrain"); @@ -155,9 +168,9 @@ public virtual void Validate() { TimePeriod.Validate(); } - if (Filters != null) + if (Filter != null) { - Filters.Validate(); + Filter.Validate(); } if (Notifications != null) { diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/BudgetComparisonExpression.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/BudgetComparisonExpression.cs new file mode 100644 index 0000000000000..2e5af10ac2fcf --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/BudgetComparisonExpression.cs @@ -0,0 +1,100 @@ +// +// 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 Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The comparison expression to be used in the budgets. + /// + public partial class BudgetComparisonExpression + { + /// + /// Initializes a new instance of the BudgetComparisonExpression class. + /// + public BudgetComparisonExpression() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BudgetComparisonExpression class. + /// + /// The name of the column to use in + /// comparison. + /// Array of values to use for comparison + public BudgetComparisonExpression(string name, IList values) + { + Name = name; + Values = values; + CustomInit(); + } + /// + /// Static constructor for BudgetComparisonExpression class. + /// + static BudgetComparisonExpression() + { + OperatorProperty = "In"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the column to use in comparison. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets array of values to use for comparison + /// + [JsonProperty(PropertyName = "values")] + public IList Values { get; set; } + + /// + /// The operator to use for comparison. + /// + [JsonProperty(PropertyName = "operator")] + public static string OperatorProperty { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Values == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Values"); + } + if (Values != null) + { + if (Values.Count < 0) + { + throw new ValidationException(ValidationRules.MinItems, "Values", 0); + } + } + } + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/BudgetFilter.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/BudgetFilter.cs new file mode 100644 index 0000000000000..16fed5ee7edac --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/BudgetFilter.cs @@ -0,0 +1,116 @@ +// +// 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 Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// May be used to filter budgets by resource group, resource, or meter. + /// + public partial class BudgetFilter + { + /// + /// Initializes a new instance of the BudgetFilter class. + /// + public BudgetFilter() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BudgetFilter class. + /// + /// The logical "AND" expression. Must have at least + /// 2 items. + /// The logical "NOT" expression. + /// Has comparison expression for a + /// dimension + /// Has comparison expression for a tag + public BudgetFilter(IList and = default(IList), BudgetFilterProperties not = default(BudgetFilterProperties), BudgetComparisonExpression dimensions = default(BudgetComparisonExpression), BudgetComparisonExpression tags = default(BudgetComparisonExpression)) + { + And = and; + Not = not; + Dimensions = dimensions; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the logical "AND" expression. Must have at least 2 + /// items. + /// + [JsonProperty(PropertyName = "and")] + public IList And { get; set; } + + /// + /// Gets or sets the logical "NOT" expression. + /// + [JsonProperty(PropertyName = "not")] + public BudgetFilterProperties Not { get; set; } + + /// + /// Gets or sets has comparison expression for a dimension + /// + [JsonProperty(PropertyName = "dimensions")] + public BudgetComparisonExpression Dimensions { get; set; } + + /// + /// Gets or sets has comparison expression for a tag + /// + [JsonProperty(PropertyName = "tags")] + public BudgetComparisonExpression Tags { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (And != null) + { + if (And.Count < 0) + { + throw new ValidationException(ValidationRules.MinItems, "And", 0); + } + foreach (var element in And) + { + if (element != null) + { + element.Validate(); + } + } + } + if (Not != null) + { + Not.Validate(); + } + if (Dimensions != null) + { + Dimensions.Validate(); + } + if (Tags != null) + { + Tags.Validate(); + } + } + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/BudgetFilterProperties.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/BudgetFilterProperties.cs new file mode 100644 index 0000000000000..4b7687ec4b3d9 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/BudgetFilterProperties.cs @@ -0,0 +1,77 @@ +// +// 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; + + /// + /// The Dimensions or Tags to filter a budget by. + /// + public partial class BudgetFilterProperties + { + /// + /// Initializes a new instance of the BudgetFilterProperties class. + /// + public BudgetFilterProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BudgetFilterProperties class. + /// + /// Has comparison expression for a + /// dimension + /// Has comparison expression for a tag + public BudgetFilterProperties(BudgetComparisonExpression dimensions = default(BudgetComparisonExpression), BudgetComparisonExpression tags = default(BudgetComparisonExpression)) + { + Dimensions = dimensions; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets has comparison expression for a dimension + /// + [JsonProperty(PropertyName = "dimensions")] + public BudgetComparisonExpression Dimensions { get; set; } + + /// + /// Gets or sets has comparison expression for a tag + /// + [JsonProperty(PropertyName = "tags")] + public BudgetComparisonExpression Tags { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Dimensions != null) + { + Dimensions.Validate(); + } + if (Tags != null) + { + Tags.Validate(); + } + } + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ChargeSummary.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ChargeSummary.cs index 6c1b990582cb5..8ef267983f007 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ChargeSummary.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ChargeSummary.cs @@ -10,9 +10,6 @@ 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; @@ -20,7 +17,6 @@ namespace Microsoft.Azure.Management.Consumption.Models /// /// A charge summary resource. /// - [Rest.Serialization.JsonTransformation] public partial class ChargeSummary : Resource { /// @@ -34,29 +30,15 @@ public ChargeSummary() /// /// Initializes a new instance of the ChargeSummary class. /// - /// Resource Id. - /// Resource name. + /// The full qualified ARM ID of an event. + /// The ID that uniquely identifies an event. + /// /// Resource type. + /// The etag for the resource. /// Resource tags. - /// The id of the billing period resource - /// that the charge belongs to. - /// Usage start date. - /// Usage end date. - /// Azure Charges. - /// Charges Billed - /// separately. - /// Marketplace Charges. - /// Currency Code - public ChargeSummary(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string billingPeriodId = default(string), string usageStart = default(string), string usageEnd = default(string), decimal? azureCharges = default(decimal?), decimal? chargesBilledSeparately = default(decimal?), decimal? marketplaceCharges = default(decimal?), string currency = default(string)) - : base(id, name, type, tags) + public ChargeSummary(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), IDictionary tags = default(IDictionary)) + : base(id, name, type, etag, tags) { - BillingPeriodId = billingPeriodId; - UsageStart = usageStart; - UsageEnd = usageEnd; - AzureCharges = azureCharges; - ChargesBilledSeparately = chargesBilledSeparately; - MarketplaceCharges = marketplaceCharges; - Currency = currency; CustomInit(); } @@ -65,48 +47,5 @@ public ChargeSummary() /// partial void CustomInit(); - /// - /// Gets the id of the billing period resource that the charge belongs - /// to. - /// - [JsonProperty(PropertyName = "properties.billingPeriodId")] - public string BillingPeriodId { get; private set; } - - /// - /// Gets usage start date. - /// - [JsonProperty(PropertyName = "properties.usageStart")] - public string UsageStart { get; private set; } - - /// - /// Gets Usage end date. - /// - [JsonProperty(PropertyName = "properties.usageEnd")] - public string UsageEnd { get; private set; } - - /// - /// Gets azure Charges. - /// - [JsonProperty(PropertyName = "properties.azureCharges")] - public decimal? AzureCharges { get; private set; } - - /// - /// Gets charges Billed separately. - /// - [JsonProperty(PropertyName = "properties.chargesBilledSeparately")] - public decimal? ChargesBilledSeparately { get; private set; } - - /// - /// Gets marketplace Charges. - /// - [JsonProperty(PropertyName = "properties.marketplaceCharges")] - public decimal? MarketplaceCharges { get; private set; } - - /// - /// Gets currency Code - /// - [JsonProperty(PropertyName = "properties.currency")] - public string Currency { get; private set; } - } } diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/CreditBalanceSummary.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/CreditBalanceSummary.cs new file mode 100644 index 0000000000000..dd3fbdda7c8e4 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/CreditBalanceSummary.cs @@ -0,0 +1,68 @@ +// +// 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; + + /// + /// Summary of credit balances. + /// + public partial class CreditBalanceSummary + { + /// + /// Initializes a new instance of the CreditBalanceSummary class. + /// + public CreditBalanceSummary() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CreditBalanceSummary class. + /// + /// Estimated balance. + /// Current balance. + /// Estimated balance + /// in billing currency. + public CreditBalanceSummary(Amount estimatedBalance = default(Amount), Amount currentBalance = default(Amount), AmountWithExchangeRate estimatedBalanceInBillingCurrency = default(AmountWithExchangeRate)) + { + EstimatedBalance = estimatedBalance; + CurrentBalance = currentBalance; + EstimatedBalanceInBillingCurrency = estimatedBalanceInBillingCurrency; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets estimated balance. + /// + [JsonProperty(PropertyName = "estimatedBalance")] + public Amount EstimatedBalance { get; private set; } + + /// + /// Gets current balance. + /// + [JsonProperty(PropertyName = "currentBalance")] + public Amount CurrentBalance { get; private set; } + + /// + /// Gets estimated balance in billing currency. + /// + [JsonProperty(PropertyName = "estimatedBalanceInBillingCurrency")] + public AmountWithExchangeRate EstimatedBalanceInBillingCurrency { get; private set; } + + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/CreditSummary.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/CreditSummary.cs new file mode 100644 index 0000000000000..673471a21e2fe --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/CreditSummary.cs @@ -0,0 +1,114 @@ +// +// 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; + + /// + /// A credit summary resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class CreditSummary : Resource + { + /// + /// Initializes a new instance of the CreditSummary class. + /// + public CreditSummary() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CreditSummary class. + /// + /// The full qualified ARM ID of an event. + /// The ID that uniquely identifies an event. + /// + /// Resource type. + /// The etag for the resource. + /// Resource tags. + /// Summary of balances associated with + /// this credit summary. + /// Pending credit + /// adjustments. + /// Expired credit. + /// Pending eligible + /// charges. + /// The credit currency. + /// The billing currency. + /// Credit's reseller. + public CreditSummary(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), IDictionary tags = default(IDictionary), CreditBalanceSummary balanceSummary = default(CreditBalanceSummary), Amount pendingCreditAdjustments = default(Amount), Amount expiredCredit = default(Amount), Amount pendingEligibleCharges = default(Amount), string creditCurrency = default(string), string billingCurrency = default(string), Reseller reseller = default(Reseller)) + : base(id, name, type, etag, tags) + { + BalanceSummary = balanceSummary; + PendingCreditAdjustments = pendingCreditAdjustments; + ExpiredCredit = expiredCredit; + PendingEligibleCharges = pendingEligibleCharges; + CreditCurrency = creditCurrency; + BillingCurrency = billingCurrency; + Reseller = reseller; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets summary of balances associated with this credit summary. + /// + [JsonProperty(PropertyName = "properties.balanceSummary")] + public CreditBalanceSummary BalanceSummary { get; private set; } + + /// + /// Gets pending credit adjustments. + /// + [JsonProperty(PropertyName = "properties.pendingCreditAdjustments")] + public Amount PendingCreditAdjustments { get; private set; } + + /// + /// Gets expired credit. + /// + [JsonProperty(PropertyName = "properties.expiredCredit")] + public Amount ExpiredCredit { get; private set; } + + /// + /// Gets pending eligible charges. + /// + [JsonProperty(PropertyName = "properties.pendingEligibleCharges")] + public Amount PendingEligibleCharges { get; private set; } + + /// + /// Gets the credit currency. + /// + [JsonProperty(PropertyName = "properties.creditCurrency")] + public string CreditCurrency { get; private set; } + + /// + /// Gets the billing currency. + /// + [JsonProperty(PropertyName = "properties.billingCurrency")] + public string BillingCurrency { get; private set; } + + /// + /// Gets credit's reseller. + /// + [JsonProperty(PropertyName = "properties.reseller")] + public Reseller Reseller { get; private set; } + + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/DownloadProperties.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/DownloadProperties.cs new file mode 100644 index 0000000000000..febcd42cc6524 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/DownloadProperties.cs @@ -0,0 +1,60 @@ +// +// 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; + + /// + /// The properties of the price sheet download. + /// + public partial class DownloadProperties + { + /// + /// Initializes a new instance of the DownloadProperties class. + /// + public DownloadProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DownloadProperties class. + /// + /// The link (url) to download the + /// pricesheet. + /// Download link validity. + public DownloadProperties(string downloadUrl = default(string), string validTill = default(string)) + { + DownloadUrl = downloadUrl; + ValidTill = validTill; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the link (url) to download the pricesheet. + /// + [JsonProperty(PropertyName = "downloadUrl")] + public string DownloadUrl { get; private set; } + + /// + /// Gets download link validity. + /// + [JsonProperty(PropertyName = "validTill")] + public string ValidTill { get; private set; } + + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ErrorResponse.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ErrorResponse.cs index 215b4e93db5fb..a6e25e5e3b263 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ErrorResponse.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ErrorResponse.cs @@ -16,6 +16,15 @@ namespace Microsoft.Azure.Management.Consumption.Models /// /// Error response indicates that the service is not able to process the /// incoming request. The reason is provided in the error message. + /// + /// Some Error responses: + /// + /// * 429 TooManyRequests - Request is throttled. Retry after waiting for + /// the time specified in the + /// "x-ms-ratelimit-microsoft.consumption-retry-after" header. + /// + /// * 503 ServiceUnavailable - Service is temporarily unavailable. Retry + /// after waiting for the time specified in the "Retry-After" header. /// public partial class ErrorResponse { diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/EventSummary.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/EventSummary.cs new file mode 100644 index 0000000000000..8b2c0faafda46 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/EventSummary.cs @@ -0,0 +1,273 @@ +// +// 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; + + /// + /// An event summary resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class EventSummary : Resource + { + /// + /// Initializes a new instance of the EventSummary class. + /// + public EventSummary() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EventSummary class. + /// + /// The full qualified ARM ID of an event. + /// The ID that uniquely identifies an event. + /// + /// Resource type. + /// The etag for the resource. + /// Resource tags. + /// The date of the event. + /// The description of the event. + /// The amount of new credit or commitment for + /// NewCredit or SettleCharges event. + /// The amount of balance adjustment. The + /// property is not available for ConsumptionCommitment lots. + /// The amount of expired credit or + /// commitment for NewCredit or SettleCharges event. + /// The amount of charges for events of type + /// SettleCharges and PendingEligibleCharges. + /// The balance after the event. + /// Identifies the type of the event. Possible + /// values include: 'SettledCharges', 'PendingCharges', + /// 'PendingAdjustments', 'PendingNewCredit', 'PendingExpiredCredit', + /// 'UnKnown', 'NewCredit' + /// The number which uniquely identifies + /// the invoice on which the event was billed. This will be empty for + /// unbilled events. + /// The ID that uniquely identifies the + /// billing profile for which the event happened. The property is only + /// available for billing account of type MicrosoftCustomerAgreement. + /// + /// The display name of the + /// billing profile for which the event happened. The property is only + /// available for billing account of type + /// MicrosoftCustomerAgreement. + /// The ID that uniquely identifies the lot for + /// which the event happened. + /// Identifies the source of the lot for which + /// the event happened. + /// Amount of canceled credit. + /// The credit currency of the + /// event. + /// The billing currency of the + /// event. + /// The reseller of the event. + /// The amount of expired + /// credit or commitment for NewCredit or SettleCharges event in + /// billing currency. + /// The amount of new credit + /// or commitment for NewCredit or SettleCharges event in billing + /// currency. + /// The amount of balance + /// adjustment in billing currency. + /// The amount of charges for + /// events of type SettleCharges and PendingEligibleCharges in billing + /// currency. + /// The balance in billing + /// currency after the event. + public EventSummary(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), IDictionary tags = default(IDictionary), System.DateTime? transactionDate = default(System.DateTime?), string description = default(string), Amount newCredit = default(Amount), Amount adjustments = default(Amount), Amount creditExpired = default(Amount), Amount charges = default(Amount), Amount closedBalance = default(Amount), string eventType = default(string), string invoiceNumber = default(string), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string lotId = default(string), string lotSource = default(string), Amount canceledCredit = default(Amount), string creditCurrency = default(string), string billingCurrency = default(string), Reseller reseller = default(Reseller), AmountWithExchangeRate creditExpiredInBillingCurrency = default(AmountWithExchangeRate), AmountWithExchangeRate newCreditInBillingCurrency = default(AmountWithExchangeRate), AmountWithExchangeRate adjustmentsInBillingCurrency = default(AmountWithExchangeRate), AmountWithExchangeRate chargesInBillingCurrency = default(AmountWithExchangeRate), AmountWithExchangeRate closedBalanceInBillingCurrency = default(AmountWithExchangeRate)) + : base(id, name, type, etag, tags) + { + TransactionDate = transactionDate; + Description = description; + NewCredit = newCredit; + Adjustments = adjustments; + CreditExpired = creditExpired; + Charges = charges; + ClosedBalance = closedBalance; + EventType = eventType; + InvoiceNumber = invoiceNumber; + BillingProfileId = billingProfileId; + BillingProfileDisplayName = billingProfileDisplayName; + LotId = lotId; + LotSource = lotSource; + CanceledCredit = canceledCredit; + CreditCurrency = creditCurrency; + BillingCurrency = billingCurrency; + Reseller = reseller; + CreditExpiredInBillingCurrency = creditExpiredInBillingCurrency; + NewCreditInBillingCurrency = newCreditInBillingCurrency; + AdjustmentsInBillingCurrency = adjustmentsInBillingCurrency; + ChargesInBillingCurrency = chargesInBillingCurrency; + ClosedBalanceInBillingCurrency = closedBalanceInBillingCurrency; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the date of the event. + /// + [JsonProperty(PropertyName = "properties.transactionDate")] + public System.DateTime? TransactionDate { get; private set; } + + /// + /// Gets the description of the event. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; private set; } + + /// + /// Gets the amount of new credit or commitment for NewCredit or + /// SettleCharges event. + /// + [JsonProperty(PropertyName = "properties.newCredit")] + public Amount NewCredit { get; private set; } + + /// + /// Gets the amount of balance adjustment. The property is not + /// available for ConsumptionCommitment lots. + /// + [JsonProperty(PropertyName = "properties.adjustments")] + public Amount Adjustments { get; private set; } + + /// + /// Gets the amount of expired credit or commitment for NewCredit or + /// SettleCharges event. + /// + [JsonProperty(PropertyName = "properties.creditExpired")] + public Amount CreditExpired { get; private set; } + + /// + /// Gets the amount of charges for events of type SettleCharges and + /// PendingEligibleCharges. + /// + [JsonProperty(PropertyName = "properties.charges")] + public Amount Charges { get; private set; } + + /// + /// Gets the balance after the event. + /// + [JsonProperty(PropertyName = "properties.closedBalance")] + public Amount ClosedBalance { get; private set; } + + /// + /// Gets or sets identifies the type of the event. Possible values + /// include: 'SettledCharges', 'PendingCharges', 'PendingAdjustments', + /// 'PendingNewCredit', 'PendingExpiredCredit', 'UnKnown', 'NewCredit' + /// + [JsonProperty(PropertyName = "properties.eventType")] + public string EventType { get; set; } + + /// + /// Gets the number which uniquely identifies the invoice on which the + /// event was billed. This will be empty for unbilled events. + /// + [JsonProperty(PropertyName = "properties.invoiceNumber")] + public string InvoiceNumber { get; private set; } + + /// + /// Gets the ID that uniquely identifies the billing profile for which + /// the event happened. The property is only available for billing + /// account of type MicrosoftCustomerAgreement. + /// + [JsonProperty(PropertyName = "properties.billingProfileId")] + public string BillingProfileId { get; private set; } + + /// + /// Gets the display name of the billing profile for which the event + /// happened. The property is only available for billing account of + /// type MicrosoftCustomerAgreement. + /// + [JsonProperty(PropertyName = "properties.billingProfileDisplayName")] + public string BillingProfileDisplayName { get; private set; } + + /// + /// Gets the ID that uniquely identifies the lot for which the event + /// happened. + /// + [JsonProperty(PropertyName = "properties.lotId")] + public string LotId { get; private set; } + + /// + /// Gets identifies the source of the lot for which the event happened. + /// + [JsonProperty(PropertyName = "properties.lotSource")] + public string LotSource { get; private set; } + + /// + /// Gets amount of canceled credit. + /// + [JsonProperty(PropertyName = "properties.canceledCredit")] + public Amount CanceledCredit { get; private set; } + + /// + /// Gets the credit currency of the event. + /// + [JsonProperty(PropertyName = "properties.creditCurrency")] + public string CreditCurrency { get; private set; } + + /// + /// Gets the billing currency of the event. + /// + [JsonProperty(PropertyName = "properties.billingCurrency")] + public string BillingCurrency { get; private set; } + + /// + /// Gets the reseller of the event. + /// + [JsonProperty(PropertyName = "properties.reseller")] + public Reseller Reseller { get; private set; } + + /// + /// Gets the amount of expired credit or commitment for NewCredit or + /// SettleCharges event in billing currency. + /// + [JsonProperty(PropertyName = "properties.creditExpiredInBillingCurrency")] + public AmountWithExchangeRate CreditExpiredInBillingCurrency { get; private set; } + + /// + /// Gets the amount of new credit or commitment for NewCredit or + /// SettleCharges event in billing currency. + /// + [JsonProperty(PropertyName = "properties.newCreditInBillingCurrency")] + public AmountWithExchangeRate NewCreditInBillingCurrency { get; private set; } + + /// + /// Gets the amount of balance adjustment in billing currency. + /// + [JsonProperty(PropertyName = "properties.adjustmentsInBillingCurrency")] + public AmountWithExchangeRate AdjustmentsInBillingCurrency { get; private set; } + + /// + /// Gets the amount of charges for events of type SettleCharges and + /// PendingEligibleCharges in billing currency. + /// + [JsonProperty(PropertyName = "properties.chargesInBillingCurrency")] + public AmountWithExchangeRate ChargesInBillingCurrency { get; private set; } + + /// + /// Gets the balance in billing currency after the event. + /// + [JsonProperty(PropertyName = "properties.closedBalanceInBillingCurrency")] + public AmountWithExchangeRate ClosedBalanceInBillingCurrency { get; private set; } + + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/EventType.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/EventType.cs new file mode 100644 index 0000000000000..7126b76162f6e --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/EventType.cs @@ -0,0 +1,27 @@ +// +// 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 +{ + + /// + /// Defines values for EventType. + /// + public static class EventType + { + public const string SettledCharges = "SettledCharges"; + public const string PendingCharges = "PendingCharges"; + public const string PendingAdjustments = "PendingAdjustments"; + public const string PendingNewCredit = "PendingNewCredit"; + public const string PendingExpiredCredit = "PendingExpiredCredit"; + public const string UnKnown = "UnKnown"; + public const string NewCredit = "NewCredit"; + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Filters.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Filters.cs deleted file mode 100644 index aac9c62be1ec4..0000000000000 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Filters.cs +++ /dev/null @@ -1,124 +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 Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// May be used to filter budgets by resource group, resource, or meter. - /// - public partial class Filters - { - /// - /// Initializes a new instance of the Filters class. - /// - public Filters() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the Filters class. - /// - /// The list of filters on resource - /// groups, allowed at subscription level only. - /// The list of filters on resources. - /// The list of filters on meters (GUID), - /// mandatory for budgets of usage category. - /// The dictionary of filters on tags. - public Filters(IList resourceGroups = default(IList), IList resources = default(IList), IList meters = default(IList), IDictionary> tags = default(IDictionary>)) - { - ResourceGroups = resourceGroups; - Resources = resources; - Meters = meters; - Tags = tags; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the list of filters on resource groups, allowed at - /// subscription level only. - /// - [JsonProperty(PropertyName = "resourceGroups")] - public IList ResourceGroups { get; set; } - - /// - /// Gets or sets the list of filters on resources. - /// - [JsonProperty(PropertyName = "resources")] - public IList Resources { get; set; } - - /// - /// Gets or sets the list of filters on meters (GUID), mandatory for - /// budgets of usage category. - /// - [JsonProperty(PropertyName = "meters")] - public IList Meters { get; set; } - - /// - /// Gets or sets the dictionary of filters on tags. - /// - [JsonProperty(PropertyName = "tags")] - public IDictionary> Tags { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (ResourceGroups != null) - { - if (ResourceGroups.Count > 10) - { - throw new ValidationException(ValidationRules.MaxItems, "ResourceGroups", 10); - } - if (ResourceGroups.Count < 0) - { - throw new ValidationException(ValidationRules.MinItems, "ResourceGroups", 0); - } - } - if (Resources != null) - { - if (Resources.Count > 10) - { - throw new ValidationException(ValidationRules.MaxItems, "Resources", 10); - } - if (Resources.Count < 0) - { - throw new ValidationException(ValidationRules.MinItems, "Resources", 0); - } - } - if (Meters != null) - { - if (Meters.Count > 10) - { - throw new ValidationException(ValidationRules.MaxItems, "Meters", 10); - } - if (Meters.Count < 0) - { - throw new ValidationException(ValidationRules.MinItems, "Meters", 0); - } - } - } - } -} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Forecast.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Forecast.cs index d6b13b42b0dcf..7bc01ffd33c5a 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Forecast.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Forecast.cs @@ -34,12 +34,17 @@ public Forecast() /// /// Initializes a new instance of the Forecast class. /// - /// Resource Id. - /// Resource name. + /// The full qualified ARM ID of an event. + /// The ID that uniquely identifies an event. + /// /// Resource type. + /// The etag for the resource. /// Resource tags. /// The usage date of the forecast. - /// The granularity of forecast. Possible values + /// The granularity of forecast. Please note that + /// Yearly is not currently supported in this API. The API will provide + /// responses in the Monthly grain if Yearly is selected. To get yearly + /// grain data, please use our newer Forecast API. Possible values /// include: 'Daily', 'Monthly', 'Yearly' /// The amount of charge /// The ISO currency in which the meter is @@ -49,8 +54,8 @@ public Forecast() /// The details about the forecast /// confidence levels. This is populated only when chargeType is /// Forecast. - public Forecast(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string usageDate = default(string), string grain = default(string), decimal? charge = default(decimal?), string currency = default(string), string chargeType = default(string), IList confidenceLevels = default(IList)) - : base(id, name, type, tags) + public Forecast(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), IDictionary tags = default(IDictionary), string usageDate = default(string), string grain = default(string), decimal? charge = default(decimal?), string currency = default(string), string chargeType = default(string), IList confidenceLevels = default(IList)) + : base(id, name, type, etag, tags) { UsageDate = usageDate; Grain = grain; @@ -73,8 +78,11 @@ public Forecast() public string UsageDate { get; private set; } /// - /// Gets or sets the granularity of forecast. Possible values include: - /// 'Daily', 'Monthly', 'Yearly' + /// Gets or sets the granularity of forecast. Please note that Yearly + /// is not currently supported in this API. The API will provide + /// responses in the Monthly grain if Yearly is selected. To get yearly + /// grain data, please use our newer Forecast API. Possible values + /// include: 'Daily', 'Monthly', 'Yearly' /// [JsonProperty(PropertyName = "properties.grain")] public string Grain { get; set; } diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ForecastSpend.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ForecastSpend.cs new file mode 100644 index 0000000000000..8d769da78ae0e --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ForecastSpend.cs @@ -0,0 +1,64 @@ +// +// 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; + + /// + /// The forecasted cost which is being tracked for a budget. + /// + public partial class ForecastSpend + { + /// + /// Initializes a new instance of the ForecastSpend class. + /// + public ForecastSpend() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ForecastSpend class. + /// + /// The forecasted cost for the total time period + /// which is being tracked by the budget. This value is only provided + /// if the budget contains a forecast alert type. + /// The unit of measure for the budget + /// amount. + public ForecastSpend(decimal? amount = default(decimal?), string unit = default(string)) + { + Amount = amount; + Unit = unit; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the forecasted cost for the total time period which is being + /// tracked by the budget. This value is only provided if the budget + /// contains a forecast alert type. + /// + [JsonProperty(PropertyName = "amount")] + public decimal? Amount { get; private set; } + + /// + /// Gets the unit of measure for the budget amount. + /// + [JsonProperty(PropertyName = "unit")] + public string Unit { get; private set; } + + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/HighCasedErrorDetails.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/HighCasedErrorDetails.cs new file mode 100644 index 0000000000000..40b7d16e80ce0 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/HighCasedErrorDetails.cs @@ -0,0 +1,60 @@ +// +// 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; + + /// + /// The details of the error. + /// + public partial class HighCasedErrorDetails + { + /// + /// Initializes a new instance of the HighCasedErrorDetails class. + /// + public HighCasedErrorDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HighCasedErrorDetails class. + /// + /// Error code. + /// Error message indicating why the operation + /// failed. + public HighCasedErrorDetails(string code = default(string), string message = default(string)) + { + Code = code; + Message = message; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets error message indicating why the operation failed. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/HighCasedErrorResponse.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/HighCasedErrorResponse.cs new file mode 100644 index 0000000000000..0943979ed732b --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/HighCasedErrorResponse.cs @@ -0,0 +1,61 @@ +// +// 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; + + /// + /// Error response indicates that the service is not able to process the + /// incoming request. The reason is provided in the error message. + /// + /// Some Error responses: + /// + /// * 429 TooManyRequests - Request is throttled. Retry after waiting for + /// the time specified in the + /// "x-ms-ratelimit-microsoft.consumption-retry-after" header. + /// + /// * 503 ServiceUnavailable - Service is temporarily unavailable. Retry + /// after waiting for the time specified in the "Retry-After" header. + /// + public partial class HighCasedErrorResponse + { + /// + /// Initializes a new instance of the HighCasedErrorResponse class. + /// + public HighCasedErrorResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HighCasedErrorResponse class. + /// + /// The details of the error. + public HighCasedErrorResponse(HighCasedErrorDetails error = default(HighCasedErrorDetails)) + { + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the details of the error. + /// + [JsonProperty(PropertyName = "error")] + public HighCasedErrorDetails Error { get; set; } + + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/HighCasedErrorResponseException.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/HighCasedErrorResponseException.cs new file mode 100644 index 0000000000000..a92a1588459d5 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/HighCasedErrorResponseException.cs @@ -0,0 +1,62 @@ +// +// 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; + + /// + /// Exception thrown for an invalid response with HighCasedErrorResponse + /// information. + /// + public partial class HighCasedErrorResponseException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public HighCasedErrorResponse Body { get; set; } + + /// + /// Initializes a new instance of the HighCasedErrorResponseException class. + /// + public HighCasedErrorResponseException() + { + } + + /// + /// Initializes a new instance of the HighCasedErrorResponseException class. + /// + /// The exception message. + public HighCasedErrorResponseException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the HighCasedErrorResponseException class. + /// + /// The exception message. + /// Inner exception. + public HighCasedErrorResponseException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/LegacyChargeSummary.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/LegacyChargeSummary.cs new file mode 100644 index 0000000000000..af08f5fee679a --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/LegacyChargeSummary.cs @@ -0,0 +1,115 @@ +// +// 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; + + /// + /// Legacy charge summary. + /// + [Newtonsoft.Json.JsonObject("legacy")] + [Rest.Serialization.JsonTransformation] + public partial class LegacyChargeSummary : ChargeSummary + { + /// + /// Initializes a new instance of the LegacyChargeSummary class. + /// + public LegacyChargeSummary() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LegacyChargeSummary class. + /// + /// The full qualified ARM ID of an event. + /// The ID that uniquely identifies an event. + /// + /// Resource type. + /// The etag for the resource. + /// Resource tags. + /// The id of the billing period resource + /// that the charge belongs to. + /// Usage start date. + /// Usage end date. + /// Azure Charges. + /// Charges Billed + /// separately. + /// Marketplace Charges. + /// Currency Code + public LegacyChargeSummary(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), IDictionary tags = default(IDictionary), string billingPeriodId = default(string), string usageStart = default(string), string usageEnd = default(string), decimal? azureCharges = default(decimal?), decimal? chargesBilledSeparately = default(decimal?), decimal? marketplaceCharges = default(decimal?), string currency = default(string)) + : base(id, name, type, etag, tags) + { + BillingPeriodId = billingPeriodId; + UsageStart = usageStart; + UsageEnd = usageEnd; + AzureCharges = azureCharges; + ChargesBilledSeparately = chargesBilledSeparately; + MarketplaceCharges = marketplaceCharges; + Currency = currency; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the id of the billing period resource that the charge belongs + /// to. + /// + [JsonProperty(PropertyName = "properties.billingPeriodId")] + public string BillingPeriodId { get; private set; } + + /// + /// Gets usage start date. + /// + [JsonProperty(PropertyName = "properties.usageStart")] + public string UsageStart { get; private set; } + + /// + /// Gets usage end date. + /// + [JsonProperty(PropertyName = "properties.usageEnd")] + public string UsageEnd { get; private set; } + + /// + /// Gets azure Charges. + /// + [JsonProperty(PropertyName = "properties.azureCharges")] + public decimal? AzureCharges { get; private set; } + + /// + /// Gets charges Billed separately. + /// + [JsonProperty(PropertyName = "properties.chargesBilledSeparately")] + public decimal? ChargesBilledSeparately { get; private set; } + + /// + /// Gets marketplace Charges. + /// + [JsonProperty(PropertyName = "properties.marketplaceCharges")] + public decimal? MarketplaceCharges { get; private set; } + + /// + /// Gets currency Code + /// + [JsonProperty(PropertyName = "properties.currency")] + public string Currency { get; private set; } + + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/LegacyReservationRecommendation.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/LegacyReservationRecommendation.cs new file mode 100644 index 0000000000000..637b680c002a2 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/LegacyReservationRecommendation.cs @@ -0,0 +1,190 @@ +// +// 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; + + /// + /// Legacy reservation recommendation. + /// + [Newtonsoft.Json.JsonObject("legacy")] + [Rest.Serialization.JsonTransformation] + public partial class LegacyReservationRecommendation : ReservationRecommendation + { + /// + /// Initializes a new instance of the LegacyReservationRecommendation + /// class. + /// + public LegacyReservationRecommendation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LegacyReservationRecommendation + /// class. + /// + /// The full qualified ARM ID of an event. + /// The ID that uniquely identifies an event. + /// + /// Resource type. + /// The etag for the resource. + /// Resource tags. + /// Resource location + /// 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) + /// The azure resource type. + /// RI recommendations in one or three year + /// terms. + /// The total amount of cost + /// without reserved instances. + /// Recommended quality for reserved + /// instances. + /// The total amount of + /// cost with reserved instances. + /// Total estimated savings with reserved + /// instances. + /// The usage date for looking + /// back. + /// Shared or single recommendation. + /// List of sku properties + public LegacyReservationRecommendation(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), IDictionary tags = default(IDictionary), string location = default(string), string sku = default(string), string lookBackPeriod = default(string), double? instanceFlexibilityRatio = default(double?), string instanceFlexibilityGroup = default(string), string normalizedSize = default(string), double? recommendedQuantityNormalized = default(double?), System.Guid? meterId = default(System.Guid?), string resourceType = default(string), 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), IList skuProperties = default(IList)) + : base(id, name, type, etag, tags, location, sku) + { + LookBackPeriod = lookBackPeriod; + InstanceFlexibilityRatio = instanceFlexibilityRatio; + InstanceFlexibilityGroup = instanceFlexibilityGroup; + NormalizedSize = normalizedSize; + RecommendedQuantityNormalized = recommendedQuantityNormalized; + MeterId = meterId; + ResourceType = resourceType; + Term = term; + CostWithNoReservedInstances = costWithNoReservedInstances; + RecommendedQuantity = recommendedQuantity; + TotalCostWithReservedInstances = totalCostWithReservedInstances; + NetSavings = netSavings; + FirstUsageDate = firstUsageDate; + Scope = scope; + SkuProperties = skuProperties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the number of days of usage to look back for recommendation. + /// + [JsonProperty(PropertyName = "properties.lookBackPeriod")] + public string LookBackPeriod { get; private set; } + + /// + /// Gets the instance Flexibility Ratio. + /// + [JsonProperty(PropertyName = "properties.instanceFlexibilityRatio")] + public double? 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) + /// + [JsonProperty(PropertyName = "properties.meterId")] + public System.Guid? MeterId { get; private set; } + + /// + /// Gets the azure resource type. + /// + [JsonProperty(PropertyName = "properties.resourceType")] + public string ResourceType { get; private set; } + + /// + /// Gets RI recommendations in one or three year terms. + /// + [JsonProperty(PropertyName = "properties.term")] + public string Term { get; private set; } + + /// + /// Gets the total amount of cost without reserved instances. + /// + [JsonProperty(PropertyName = "properties.costWithNoReservedInstances")] + public decimal? CostWithNoReservedInstances { get; private set; } + + /// + /// Gets recommended quality for reserved instances. + /// + [JsonProperty(PropertyName = "properties.recommendedQuantity")] + public decimal? RecommendedQuantity { get; private set; } + + /// + /// Gets the total amount of cost with reserved instances. + /// + [JsonProperty(PropertyName = "properties.totalCostWithReservedInstances")] + public decimal? TotalCostWithReservedInstances { get; private set; } + + /// + /// Gets total estimated savings with reserved instances. + /// + [JsonProperty(PropertyName = "properties.netSavings")] + public decimal? NetSavings { get; private set; } + + /// + /// Gets the usage date for looking back. + /// + [JsonProperty(PropertyName = "properties.firstUsageDate")] + public System.DateTime? FirstUsageDate { get; private set; } + + /// + /// Gets shared or single recommendation. + /// + [JsonProperty(PropertyName = "properties.scope")] + public string Scope { get; private set; } + + /// + /// Gets list of sku properties + /// + [JsonProperty(PropertyName = "properties.skuProperties")] + public IList SkuProperties { get; private set; } + + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/LegacyReservationTransaction.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/LegacyReservationTransaction.cs new file mode 100644 index 0000000000000..8478f7d69f9d1 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/LegacyReservationTransaction.cs @@ -0,0 +1,88 @@ +// +// 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 System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Legacy Reservation transaction resource. + /// + public partial class LegacyReservationTransaction : ReservationTransaction + { + /// + /// Initializes a new instance of the LegacyReservationTransaction + /// class. + /// + public LegacyReservationTransaction() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LegacyReservationTransaction + /// class. + /// + /// Resource Id. + /// Resource name. + /// Resource type. + /// Resource tags. + /// The date of the transaction + /// The reservation order ID is the + /// identifier for a reservation purchase. Each reservation order ID + /// represents a single purchase transaction. A reservation order + /// contains reservations. The reservation order specifies the VM size + /// and region for the reservations. + /// The description of the + /// transaction. + /// The type of the transaction (Purchase, + /// Cancel, etc.) + /// The quantity of the transaction. + /// The charge of the transaction. + /// The ISO currency in which the transaction is + /// charged, for example, USD. + /// The name of the reservation + /// order. + /// The purchasing + /// enrollment. + /// The subscription guid that + /// makes the transaction. + /// The subscription name that + /// makes the transaction. + /// This is the ARM Sku name. It can be used + /// to join with the serviceType field in additional info in usage + /// records. + /// This is the term of the transaction. + /// The region of the transaction. + /// The name of the account that makes the + /// transaction. + /// The email of the account owner that + /// makes the transaction. + /// The department name. + /// The cost center of this department if it + /// is a department and a cost center is provided. + /// The current enrollment. + /// The billing frequency, which can be + /// either one-time or recurring. + public LegacyReservationTransaction(string id = default(string), string name = default(string), string type = default(string), IList tags = default(IList), System.DateTime? eventDate = default(System.DateTime?), string reservationOrderId = default(string), string description = default(string), string eventType = default(string), decimal? quantity = default(decimal?), decimal? amount = default(decimal?), string currency = default(string), string reservationOrderName = default(string), string purchasingEnrollment = default(string), System.Guid? purchasingSubscriptionGuid = default(System.Guid?), string purchasingSubscriptionName = default(string), string armSkuName = default(string), string term = default(string), string region = default(string), string accountName = default(string), string accountOwnerEmail = default(string), string departmentName = default(string), string costCenter = default(string), string currentEnrollment = default(string), string billingFrequency = default(string)) + : base(id, name, type, tags, eventDate, reservationOrderId, description, eventType, quantity, amount, currency, reservationOrderName, purchasingEnrollment, purchasingSubscriptionGuid, purchasingSubscriptionName, armSkuName, term, region, accountName, accountOwnerEmail, departmentName, costCenter, currentEnrollment, billingFrequency) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/LegacyUsageDetail.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/LegacyUsageDetail.cs new file mode 100644 index 0000000000000..06497b435a069 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/LegacyUsageDetail.cs @@ -0,0 +1,454 @@ +// +// 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; + + /// + /// Legacy usage detail. + /// + [Newtonsoft.Json.JsonObject("legacy")] + [Rest.Serialization.JsonTransformation] + public partial class LegacyUsageDetail : UsageDetail + { + /// + /// Initializes a new instance of the LegacyUsageDetail class. + /// + public LegacyUsageDetail() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LegacyUsageDetail class. + /// + /// The full qualified ARM ID of an event. + /// The ID that uniquely identifies an event. + /// + /// Resource type. + /// The etag for the resource. + /// Resource tags. + /// Billing Account identifier. + /// Billing Account Name. + /// The billing period start + /// date. + /// The billing period end + /// date. + /// Billing Profile identifier. + /// Billing Profile Name. + /// Account Owner Id. + /// Account Name. + /// Subscription guid. + /// Subscription name. + /// Date for the usage record. + /// Product name for the consumed service or + /// purchase. Not available for Marketplace. + /// Part Number of the service used. Can be + /// used to join with the price sheet. Not available for + /// marketplace. + /// The meter id (GUID). Not available for + /// marketplace. For reserved instance this represents the primary + /// meter for which the reservation was purchased. For the actual VM + /// Size for which the reservation is purchased see + /// productOrderName. + /// The details about the meter. By default + /// this is not populated, unless it's specified in $expand. + /// The usage quantity. + /// Effective Price that's charged for the + /// usage. + /// The amount of cost before tax. + /// Unit Price is the price applicable to you. + /// (your EA or other contract price). + /// Billing Currency. + /// Resource Location. + /// Consumed service name. Name of the + /// azure resource provider that emits the usage or was purchased. This + /// value is not provided for marketplace usage. + /// Unique identifier of the Azure Resource + /// Manager usage detail resource. + /// Resource Name. + /// Service-specific metadata. + /// Legacy field with optional + /// service-specific metadata. + /// Additional details of this usage item. + /// By default this is not populated, unless it's specified in $expand. + /// Use this field to get usage line item specific details such as the + /// actual VM Size (ServiceType) or the ratio in which the reservation + /// discount is applied. + /// Invoice Section Name. + /// The cost center of this department if it + /// is a department and a cost center is provided. + /// Resource Group Name. + /// ARM resource id of the reservation. + /// Only applies to records relevant to reservations. + /// User provided display name of the + /// reservation. Last known name for a particular day is populated in + /// the daily data. Only applies to records relevant to + /// reservations. + /// Product Order Id. For reservations + /// this is the Reservation Order ID. + /// Product Order Name. For reservations + /// this is the SKU that was purchased. + /// Offer Id. Ex: MS-AZR-0017P, + /// MS-AZR-0148P. + /// Is Azure Credit + /// Eligible. + /// Term (in months). 1 month for monthly recurring + /// purchase. 12 months for a 1 year reservation. 36 months for a 3 + /// year reservation. + /// Publisher Name. + /// Publisher Type. + /// Plan Name. + /// Indicates a charge represents credits, + /// usage, a Marketplace purchase, a reservation fee, or a + /// refund. + /// Indicates how frequently this charge will + /// occur. OneTime for purchases which only happen once, Monthly for + /// fees which recur every month, and UsageBased for charges based on + /// how much a service is used. + public LegacyUsageDetail(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), IDictionary tags = default(IDictionary), string billingAccountId = default(string), string billingAccountName = default(string), System.DateTime? billingPeriodStartDate = default(System.DateTime?), System.DateTime? billingPeriodEndDate = default(System.DateTime?), string billingProfileId = default(string), string billingProfileName = default(string), string accountOwnerId = default(string), string accountName = default(string), string subscriptionId = default(string), string subscriptionName = default(string), System.DateTime? date = default(System.DateTime?), string product = default(string), string partNumber = default(string), System.Guid? meterId = default(System.Guid?), MeterDetailsResponse meterDetails = default(MeterDetailsResponse), decimal? quantity = default(decimal?), decimal? effectivePrice = default(decimal?), decimal? cost = default(decimal?), decimal? unitPrice = default(decimal?), string billingCurrency = default(string), string resourceLocation = default(string), string consumedService = default(string), string resourceId = default(string), string resourceName = default(string), string serviceInfo1 = default(string), string serviceInfo2 = default(string), string additionalInfo = default(string), string invoiceSection = default(string), string costCenter = default(string), string resourceGroup = default(string), string reservationId = default(string), string reservationName = default(string), string productOrderId = default(string), string productOrderName = default(string), string offerId = default(string), bool? isAzureCreditEligible = default(bool?), string term = default(string), string publisherName = default(string), string publisherType = default(string), string planName = default(string), string chargeType = default(string), string frequency = default(string)) + : base(id, name, type, etag, tags) + { + BillingAccountId = billingAccountId; + BillingAccountName = billingAccountName; + BillingPeriodStartDate = billingPeriodStartDate; + BillingPeriodEndDate = billingPeriodEndDate; + BillingProfileId = billingProfileId; + BillingProfileName = billingProfileName; + AccountOwnerId = accountOwnerId; + AccountName = accountName; + SubscriptionId = subscriptionId; + SubscriptionName = subscriptionName; + Date = date; + Product = product; + PartNumber = partNumber; + MeterId = meterId; + MeterDetails = meterDetails; + Quantity = quantity; + EffectivePrice = effectivePrice; + Cost = cost; + UnitPrice = unitPrice; + BillingCurrency = billingCurrency; + ResourceLocation = resourceLocation; + ConsumedService = consumedService; + ResourceId = resourceId; + ResourceName = resourceName; + ServiceInfo1 = serviceInfo1; + ServiceInfo2 = serviceInfo2; + AdditionalInfo = additionalInfo; + InvoiceSection = invoiceSection; + CostCenter = costCenter; + ResourceGroup = resourceGroup; + ReservationId = reservationId; + ReservationName = reservationName; + ProductOrderId = productOrderId; + ProductOrderName = productOrderName; + OfferId = offerId; + IsAzureCreditEligible = isAzureCreditEligible; + Term = term; + PublisherName = publisherName; + PublisherType = publisherType; + PlanName = planName; + ChargeType = chargeType; + Frequency = frequency; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets billing Account identifier. + /// + [JsonProperty(PropertyName = "properties.billingAccountId")] + public string BillingAccountId { get; private set; } + + /// + /// Gets billing Account Name. + /// + [JsonProperty(PropertyName = "properties.billingAccountName")] + public string BillingAccountName { get; private set; } + + /// + /// Gets the billing period start date. + /// + [JsonProperty(PropertyName = "properties.billingPeriodStartDate")] + public System.DateTime? BillingPeriodStartDate { get; private set; } + + /// + /// Gets the billing period end date. + /// + [JsonProperty(PropertyName = "properties.billingPeriodEndDate")] + public System.DateTime? BillingPeriodEndDate { get; private set; } + + /// + /// Gets billing Profile identifier. + /// + [JsonProperty(PropertyName = "properties.billingProfileId")] + public string BillingProfileId { get; private set; } + + /// + /// Gets billing Profile Name. + /// + [JsonProperty(PropertyName = "properties.billingProfileName")] + public string BillingProfileName { get; private set; } + + /// + /// Gets account Owner Id. + /// + [JsonProperty(PropertyName = "properties.accountOwnerId")] + public string AccountOwnerId { get; private set; } + + /// + /// Gets account Name. + /// + [JsonProperty(PropertyName = "properties.accountName")] + public string AccountName { get; private set; } + + /// + /// Gets subscription guid. + /// + [JsonProperty(PropertyName = "properties.subscriptionId")] + public string SubscriptionId { get; private set; } + + /// + /// Gets subscription name. + /// + [JsonProperty(PropertyName = "properties.subscriptionName")] + public string SubscriptionName { get; private set; } + + /// + /// Gets date for the usage record. + /// + [JsonProperty(PropertyName = "properties.date")] + public System.DateTime? Date { get; private set; } + + /// + /// Gets product name for the consumed service or purchase. Not + /// available for Marketplace. + /// + [JsonProperty(PropertyName = "properties.product")] + public string Product { get; private set; } + + /// + /// Gets part Number of the service used. Can be used to join with the + /// price sheet. Not available for marketplace. + /// + [JsonProperty(PropertyName = "properties.partNumber")] + public string PartNumber { get; private set; } + + /// + /// Gets the meter id (GUID). Not available for marketplace. For + /// reserved instance this represents the primary meter for which the + /// reservation was purchased. For the actual VM Size for which the + /// reservation is purchased see productOrderName. + /// + [JsonProperty(PropertyName = "properties.meterId")] + public System.Guid? MeterId { get; private set; } + + /// + /// Gets the details about the meter. By default this is not populated, + /// unless it's specified in $expand. + /// + [JsonProperty(PropertyName = "properties.meterDetails")] + public MeterDetailsResponse MeterDetails { get; private set; } + + /// + /// Gets the usage quantity. + /// + [JsonProperty(PropertyName = "properties.quantity")] + public decimal? Quantity { get; private set; } + + /// + /// Gets effective Price that's charged for the usage. + /// + [JsonProperty(PropertyName = "properties.effectivePrice")] + public decimal? EffectivePrice { get; private set; } + + /// + /// Gets the amount of cost before tax. + /// + [JsonProperty(PropertyName = "properties.cost")] + public decimal? Cost { get; private set; } + + /// + /// Gets unit Price is the price applicable to you. (your EA or other + /// contract price). + /// + [JsonProperty(PropertyName = "properties.unitPrice")] + public decimal? UnitPrice { get; private set; } + + /// + /// Gets billing Currency. + /// + [JsonProperty(PropertyName = "properties.billingCurrency")] + public string BillingCurrency { get; private set; } + + /// + /// Gets resource Location. + /// + [JsonProperty(PropertyName = "properties.resourceLocation")] + public string ResourceLocation { get; private set; } + + /// + /// Gets consumed service name. Name of the azure resource provider + /// that emits the usage or was purchased. This value is not provided + /// for marketplace usage. + /// + [JsonProperty(PropertyName = "properties.consumedService")] + public string ConsumedService { get; private set; } + + /// + /// Gets unique identifier of the Azure Resource Manager usage detail + /// resource. + /// + [JsonProperty(PropertyName = "properties.resourceId")] + public string ResourceId { get; private set; } + + /// + /// Gets resource Name. + /// + [JsonProperty(PropertyName = "properties.resourceName")] + public string ResourceName { get; private set; } + + /// + /// Gets service-specific metadata. + /// + [JsonProperty(PropertyName = "properties.serviceInfo1")] + public string ServiceInfo1 { get; private set; } + + /// + /// Gets legacy field with optional service-specific metadata. + /// + [JsonProperty(PropertyName = "properties.serviceInfo2")] + public string ServiceInfo2 { get; private set; } + + /// + /// Gets additional details of this usage item. By default this is not + /// populated, unless it's specified in $expand. Use this field to get + /// usage line item specific details such as the actual VM Size + /// (ServiceType) or the ratio in which the reservation discount is + /// applied. + /// + [JsonProperty(PropertyName = "properties.additionalInfo")] + public string AdditionalInfo { get; private set; } + + /// + /// Gets invoice Section Name. + /// + [JsonProperty(PropertyName = "properties.invoiceSection")] + public string InvoiceSection { get; private set; } + + /// + /// Gets the cost center of this department if it is a department and a + /// cost center is provided. + /// + [JsonProperty(PropertyName = "properties.costCenter")] + public string CostCenter { get; private set; } + + /// + /// Gets resource Group Name. + /// + [JsonProperty(PropertyName = "properties.resourceGroup")] + public string ResourceGroup { get; private set; } + + /// + /// Gets ARM resource id of the reservation. Only applies to records + /// relevant to reservations. + /// + [JsonProperty(PropertyName = "properties.reservationId")] + public string ReservationId { get; private set; } + + /// + /// Gets user provided display name of the reservation. Last known name + /// for a particular day is populated in the daily data. Only applies + /// to records relevant to reservations. + /// + [JsonProperty(PropertyName = "properties.reservationName")] + public string ReservationName { get; private set; } + + /// + /// Gets product Order Id. For reservations this is the Reservation + /// Order ID. + /// + [JsonProperty(PropertyName = "properties.productOrderId")] + public string ProductOrderId { get; private set; } + + /// + /// Gets product Order Name. For reservations this is the SKU that was + /// purchased. + /// + [JsonProperty(PropertyName = "properties.productOrderName")] + public string ProductOrderName { get; private set; } + + /// + /// Gets offer Id. Ex: MS-AZR-0017P, MS-AZR-0148P. + /// + [JsonProperty(PropertyName = "properties.offerId")] + public string OfferId { get; private set; } + + /// + /// Gets is Azure Credit Eligible. + /// + [JsonProperty(PropertyName = "properties.isAzureCreditEligible")] + public bool? IsAzureCreditEligible { get; private set; } + + /// + /// Gets term (in months). 1 month for monthly recurring purchase. 12 + /// months for a 1 year reservation. 36 months for a 3 year + /// reservation. + /// + [JsonProperty(PropertyName = "properties.term")] + public string Term { get; private set; } + + /// + /// Gets publisher Name. + /// + [JsonProperty(PropertyName = "properties.publisherName")] + public string PublisherName { get; private set; } + + /// + /// Gets publisher Type. + /// + [JsonProperty(PropertyName = "properties.publisherType")] + public string PublisherType { get; private set; } + + /// + /// Gets plan Name. + /// + [JsonProperty(PropertyName = "properties.planName")] + public string PlanName { get; private set; } + + /// + /// Gets indicates a charge represents credits, usage, a Marketplace + /// purchase, a reservation fee, or a refund. + /// + [JsonProperty(PropertyName = "properties.chargeType")] + public string ChargeType { get; private set; } + + /// + /// Gets indicates how frequently this charge will occur. OneTime for + /// purchases which only happen once, Monthly for fees which recur + /// every month, and UsageBased for charges based on how much a service + /// is used. + /// + [JsonProperty(PropertyName = "properties.frequency")] + public string Frequency { get; private set; } + + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/LookBackPeriod.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/LookBackPeriod.cs new file mode 100644 index 0000000000000..eec61ed14541a --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/LookBackPeriod.cs @@ -0,0 +1,32 @@ +// +// 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 +{ + + /// + /// Defines values for LookBackPeriod. + /// + public static class LookBackPeriod + { + /// + /// Use 7 days of data for recommendations + /// + public const string Last07Days = "Last7Days"; + /// + /// Use 30 days of data for recommendations + /// + public const string Last30Days = "Last30Days"; + /// + /// Use 60 days of data for recommendations + /// + public const string Last60Days = "Last60Days"; + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/LotSource.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/LotSource.cs new file mode 100644 index 0000000000000..edb52ecfd086e --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/LotSource.cs @@ -0,0 +1,23 @@ +// +// 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 +{ + + /// + /// Defines values for LotSource. + /// + public static class LotSource + { + public const string PurchasedCredit = "PurchasedCredit"; + public const string PromotionalCredit = "PromotionalCredit"; + public const string ConsumptionCommitment = "ConsumptionCommitment"; + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/LotSummary.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/LotSummary.cs new file mode 100644 index 0000000000000..1dd0ff907ca82 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/LotSummary.cs @@ -0,0 +1,173 @@ +// +// 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; + + /// + /// A lot summary resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class LotSummary : Resource + { + /// + /// Initializes a new instance of the LotSummary class. + /// + public LotSummary() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LotSummary class. + /// + /// The full qualified ARM ID of an event. + /// The ID that uniquely identifies an event. + /// + /// Resource type. + /// The etag for the resource. + /// Resource tags. + /// The original amount of a lot. + /// The balance as of the last + /// invoice. + /// The source of the lot. Possible values + /// include: 'PurchasedCredit', 'PromotionalCredit', + /// 'ConsumptionCommitment' + /// The date when the lot became + /// effective. + /// The expiration date of a lot. + /// The po number of the invoice on which the + /// lot was added. This property is not available for + /// ConsumptionCommitment lots. + /// The date when the lot was added. + /// The status of the lot. Possible values + /// include: 'None', 'Active', 'Inactive', 'Expired', 'Complete', + /// 'Canceled' + /// The currency of the lot. + /// The billing currency of the + /// lot. + /// The original amount + /// of a lot in billing currency. + /// The balance as of the + /// last invoice in billing currency. + /// The reseller of the lot. + public LotSummary(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), IDictionary tags = default(IDictionary), Amount originalAmount = default(Amount), Amount closedBalance = default(Amount), string source = default(string), System.DateTime? startDate = default(System.DateTime?), System.DateTime? expirationDate = default(System.DateTime?), string poNumber = default(string), System.DateTime? purchaseDate = default(System.DateTime?), string status = default(string), string creditCurrency = default(string), string billingCurrency = default(string), AmountWithExchangeRate originalAmountInBillingCurrency = default(AmountWithExchangeRate), AmountWithExchangeRate closedBalanceInBillingCurrency = default(AmountWithExchangeRate), Reseller reseller = default(Reseller)) + : base(id, name, type, etag, tags) + { + OriginalAmount = originalAmount; + ClosedBalance = closedBalance; + Source = source; + StartDate = startDate; + ExpirationDate = expirationDate; + PoNumber = poNumber; + PurchaseDate = purchaseDate; + Status = status; + CreditCurrency = creditCurrency; + BillingCurrency = billingCurrency; + OriginalAmountInBillingCurrency = originalAmountInBillingCurrency; + ClosedBalanceInBillingCurrency = closedBalanceInBillingCurrency; + Reseller = reseller; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the original amount of a lot. + /// + [JsonProperty(PropertyName = "properties.originalAmount")] + public Amount OriginalAmount { get; private set; } + + /// + /// Gets the balance as of the last invoice. + /// + [JsonProperty(PropertyName = "properties.closedBalance")] + public Amount ClosedBalance { get; private set; } + + /// + /// Gets the source of the lot. Possible values include: + /// 'PurchasedCredit', 'PromotionalCredit', 'ConsumptionCommitment' + /// + [JsonProperty(PropertyName = "properties.source")] + public string Source { get; private set; } + + /// + /// Gets the date when the lot became effective. + /// + [JsonProperty(PropertyName = "properties.startDate")] + public System.DateTime? StartDate { get; private set; } + + /// + /// Gets the expiration date of a lot. + /// + [JsonProperty(PropertyName = "properties.expirationDate")] + public System.DateTime? ExpirationDate { get; private set; } + + /// + /// Gets the po number of the invoice on which the lot was added. This + /// property is not available for ConsumptionCommitment lots. + /// + [JsonProperty(PropertyName = "properties.poNumber")] + public string PoNumber { get; private set; } + + /// + /// Gets the date when the lot was added. + /// + [JsonProperty(PropertyName = "properties.purchaseDate")] + public System.DateTime? PurchaseDate { get; private set; } + + /// + /// Gets the status of the lot. Possible values include: 'None', + /// 'Active', 'Inactive', 'Expired', 'Complete', 'Canceled' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; private set; } + + /// + /// Gets the currency of the lot. + /// + [JsonProperty(PropertyName = "properties.creditCurrency")] + public string CreditCurrency { get; private set; } + + /// + /// Gets the billing currency of the lot. + /// + [JsonProperty(PropertyName = "properties.billingCurrency")] + public string BillingCurrency { get; private set; } + + /// + /// Gets the original amount of a lot in billing currency. + /// + [JsonProperty(PropertyName = "properties.originalAmountInBillingCurrency")] + public AmountWithExchangeRate OriginalAmountInBillingCurrency { get; private set; } + + /// + /// Gets the balance as of the last invoice in billing currency. + /// + [JsonProperty(PropertyName = "properties.closedBalanceInBillingCurrency")] + public AmountWithExchangeRate ClosedBalanceInBillingCurrency { get; private set; } + + /// + /// Gets the reseller of the lot. + /// + [JsonProperty(PropertyName = "properties.reseller")] + public Reseller Reseller { get; private set; } + + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ManagementGroupAggregatedCostResult.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ManagementGroupAggregatedCostResult.cs index 2608ac234d8b4..ecd02a96bc812 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ManagementGroupAggregatedCostResult.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ManagementGroupAggregatedCostResult.cs @@ -36,9 +36,11 @@ public ManagementGroupAggregatedCostResult() /// Initializes a new instance of the /// ManagementGroupAggregatedCostResult class. /// - /// Resource Id. - /// Resource name. + /// The full qualified ARM ID of an event. + /// The ID that uniquely identifies an event. + /// /// Resource type. + /// The etag for the resource. /// Resource tags. /// The id of the billing period resource /// that the aggregated cost belongs to. @@ -57,8 +59,8 @@ public ManagementGroupAggregatedCostResult() /// included in the calculation of aggregated cost /// List of subscription Guids /// excluded from the calculation of aggregated cost - public ManagementGroupAggregatedCostResult(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string billingPeriodId = default(string), System.DateTime? usageStart = default(System.DateTime?), System.DateTime? usageEnd = default(System.DateTime?), decimal? azureCharges = default(decimal?), decimal? marketplaceCharges = default(decimal?), decimal? chargesBilledSeparately = default(decimal?), string currency = default(string), IList children = default(IList), IList includedSubscriptions = default(IList), IList excludedSubscriptions = default(IList)) - : base(id, name, type, tags) + public ManagementGroupAggregatedCostResult(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), IDictionary tags = default(IDictionary), string billingPeriodId = default(string), System.DateTime? usageStart = default(System.DateTime?), System.DateTime? usageEnd = default(System.DateTime?), decimal? azureCharges = default(decimal?), decimal? marketplaceCharges = default(decimal?), decimal? chargesBilledSeparately = default(decimal?), string currency = default(string), IList children = default(IList), IList includedSubscriptions = default(IList), IList excludedSubscriptions = default(IList)) + : base(id, name, type, etag, tags) { BillingPeriodId = billingPeriodId; UsageStart = usageStart; diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Marketplace.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Marketplace.cs index 3ad1b5295df0d..60c9a4cb48b2b 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Marketplace.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Marketplace.cs @@ -18,7 +18,7 @@ namespace Microsoft.Azure.Management.Consumption.Models using System.Linq; /// - /// An marketplace resource. + /// A marketplace resource. /// [Rest.Serialization.JsonTransformation] public partial class Marketplace : Resource @@ -34,9 +34,11 @@ public Marketplace() /// /// Initializes a new instance of the Marketplace class. /// - /// Resource Id. - /// Resource name. + /// The full qualified ARM ID of an event. + /// The ID that uniquely identifies an event. + /// /// Resource type. + /// The etag for the resource. /// Resource tags. /// The id of the billing period resource /// that the usage belongs to. @@ -47,6 +49,7 @@ public Marketplace() /// The marketplace resource rate. /// The type of offer. /// The name of resource group. + /// Additional information. /// The order number. /// The name of the resource instance that /// the usage is about. @@ -74,8 +77,8 @@ public Marketplace() /// The name of plan. /// Flag indicating whether this is a /// recurring charge or not. - public Marketplace(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string billingPeriodId = default(string), System.DateTime? usageStart = default(System.DateTime?), System.DateTime? usageEnd = default(System.DateTime?), decimal? resourceRate = default(decimal?), string offerName = default(string), string resourceGroup = default(string), string orderNumber = default(string), string instanceName = default(string), string instanceId = default(string), string currency = default(string), decimal? consumedQuantity = default(decimal?), string unitOfMeasure = default(string), decimal? pretaxCost = default(decimal?), bool? isEstimated = default(bool?), System.Guid? meterId = default(System.Guid?), System.Guid? subscriptionGuid = default(System.Guid?), string subscriptionName = default(string), string accountName = default(string), string departmentName = default(string), string consumedService = default(string), string costCenter = default(string), string additionalProperties = default(string), string publisherName = default(string), string planName = default(string), bool? isRecurringCharge = default(bool?)) - : base(id, name, type, tags) + public Marketplace(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), IDictionary tags = default(IDictionary), string billingPeriodId = default(string), System.DateTime? usageStart = default(System.DateTime?), System.DateTime? usageEnd = default(System.DateTime?), decimal? resourceRate = default(decimal?), string offerName = default(string), string resourceGroup = default(string), string additionalInfo = default(string), string orderNumber = default(string), string instanceName = default(string), string instanceId = default(string), string currency = default(string), decimal? consumedQuantity = default(decimal?), string unitOfMeasure = default(string), decimal? pretaxCost = default(decimal?), bool? isEstimated = default(bool?), System.Guid? meterId = default(System.Guid?), System.Guid? subscriptionGuid = default(System.Guid?), string subscriptionName = default(string), string accountName = default(string), string departmentName = default(string), string consumedService = default(string), string costCenter = default(string), string additionalProperties = default(string), string publisherName = default(string), string planName = default(string), bool? isRecurringCharge = default(bool?)) + : base(id, name, type, etag, tags) { BillingPeriodId = billingPeriodId; UsageStart = usageStart; @@ -83,6 +86,7 @@ public Marketplace() ResourceRate = resourceRate; OfferName = offerName; ResourceGroup = resourceGroup; + AdditionalInfo = additionalInfo; OrderNumber = orderNumber; InstanceName = instanceName; InstanceId = instanceId; @@ -147,6 +151,12 @@ public Marketplace() [JsonProperty(PropertyName = "properties.resourceGroup")] public string ResourceGroup { get; private set; } + /// + /// Gets additional information. + /// + [JsonProperty(PropertyName = "properties.additionalInfo")] + public string AdditionalInfo { get; private set; } + /// /// Gets the order number. /// diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ModernChargeSummary.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ModernChargeSummary.cs new file mode 100644 index 0000000000000..3b4311b179309 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ModernChargeSummary.cs @@ -0,0 +1,147 @@ +// +// 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; + + /// + /// Modern charge summary. + /// + [Newtonsoft.Json.JsonObject("modern")] + [Rest.Serialization.JsonTransformation] + public partial class ModernChargeSummary : ChargeSummary + { + /// + /// Initializes a new instance of the ModernChargeSummary class. + /// + public ModernChargeSummary() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ModernChargeSummary class. + /// + /// The full qualified ARM ID of an event. + /// The ID that uniquely identifies an event. + /// + /// Resource type. + /// The etag for the resource. + /// Resource tags. + /// The id of the billing period resource + /// that the charge belongs to. + /// Usage start date. + /// Usage end date. + /// Azure Charges. + /// Charges Billed + /// separately. + /// Marketplace Charges. + /// Billing Account Id + /// Billing Profile Id + /// Invoice Section Id + /// Customer Id + /// Is charge Invoiced + public ModernChargeSummary(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), IDictionary tags = default(IDictionary), string billingPeriodId = default(string), string usageStart = default(string), string usageEnd = default(string), Amount azureCharges = default(Amount), Amount chargesBilledSeparately = default(Amount), Amount marketplaceCharges = default(Amount), string billingAccountId = default(string), string billingProfileId = default(string), string invoiceSectionId = default(string), string customerId = default(string), bool? isInvoiced = default(bool?)) + : base(id, name, type, etag, tags) + { + BillingPeriodId = billingPeriodId; + UsageStart = usageStart; + UsageEnd = usageEnd; + AzureCharges = azureCharges; + ChargesBilledSeparately = chargesBilledSeparately; + MarketplaceCharges = marketplaceCharges; + BillingAccountId = billingAccountId; + BillingProfileId = billingProfileId; + InvoiceSectionId = invoiceSectionId; + CustomerId = customerId; + IsInvoiced = isInvoiced; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the id of the billing period resource that the charge belongs + /// to. + /// + [JsonProperty(PropertyName = "properties.billingPeriodId")] + public string BillingPeriodId { get; private set; } + + /// + /// Gets usage start date. + /// + [JsonProperty(PropertyName = "properties.usageStart")] + public string UsageStart { get; private set; } + + /// + /// Gets usage end date. + /// + [JsonProperty(PropertyName = "properties.usageEnd")] + public string UsageEnd { get; private set; } + + /// + /// Gets azure Charges. + /// + [JsonProperty(PropertyName = "properties.azureCharges")] + public Amount AzureCharges { get; private set; } + + /// + /// Gets charges Billed separately. + /// + [JsonProperty(PropertyName = "properties.chargesBilledSeparately")] + public Amount ChargesBilledSeparately { get; private set; } + + /// + /// Gets marketplace Charges. + /// + [JsonProperty(PropertyName = "properties.marketplaceCharges")] + public Amount MarketplaceCharges { get; private set; } + + /// + /// Gets billing Account Id + /// + [JsonProperty(PropertyName = "properties.billingAccountId")] + public string BillingAccountId { get; private set; } + + /// + /// Gets billing Profile Id + /// + [JsonProperty(PropertyName = "properties.billingProfileId")] + public string BillingProfileId { get; private set; } + + /// + /// Gets invoice Section Id + /// + [JsonProperty(PropertyName = "properties.invoiceSectionId")] + public string InvoiceSectionId { get; private set; } + + /// + /// Gets customer Id + /// + [JsonProperty(PropertyName = "properties.customerId")] + public string CustomerId { get; private set; } + + /// + /// Gets is charge Invoiced + /// + [JsonProperty(PropertyName = "properties.isInvoiced")] + public bool? IsInvoiced { get; private set; } + + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ModernReservationRecommendation.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ModernReservationRecommendation.cs new file mode 100644 index 0000000000000..40bd034d54953 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ModernReservationRecommendation.cs @@ -0,0 +1,199 @@ +// +// 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; + + /// + /// Modern reservation recommendation. + /// + [Newtonsoft.Json.JsonObject("modern")] + [Rest.Serialization.JsonTransformation] + public partial class ModernReservationRecommendation : ReservationRecommendation + { + /// + /// Initializes a new instance of the ModernReservationRecommendation + /// class. + /// + public ModernReservationRecommendation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ModernReservationRecommendation + /// class. + /// + /// The full qualified ARM ID of an event. + /// The ID that uniquely identifies an event. + /// + /// Resource type. + /// The etag for the resource. + /// Resource tags. + /// Resource location + /// Resource sku + /// Resource + /// Location. + /// 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. + /// The total amount of cost + /// without reserved instances. + /// Recommended quality for reserved + /// instances. + /// The total amount of + /// cost with reserved instances. + /// Total estimated savings with reserved + /// instances. + /// The usage date for looking + /// back. + /// Shared or single recommendation. + /// List of sku properties + /// This is the ARM Sku name. + public ModernReservationRecommendation(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), IDictionary tags = default(IDictionary), string location = default(string), string sku = default(string), string modernReservationRecommendationLocation = default(string), int? lookBackPeriod = default(int?), double? instanceFlexibilityRatio = default(double?), string instanceFlexibilityGroup = default(string), string normalizedSize = default(string), double? recommendedQuantityNormalized = default(double?), System.Guid? meterId = default(System.Guid?), string term = default(string), Amount costWithNoReservedInstances = default(Amount), decimal? recommendedQuantity = default(decimal?), Amount totalCostWithReservedInstances = default(Amount), Amount netSavings = default(Amount), System.DateTime? firstUsageDate = default(System.DateTime?), string scope = default(string), IList skuProperties = default(IList), string skuName = default(string)) + : base(id, name, type, etag, tags, location, sku) + { + ModernReservationRecommendationLocation = modernReservationRecommendationLocation; + LookBackPeriod = lookBackPeriod; + InstanceFlexibilityRatio = instanceFlexibilityRatio; + InstanceFlexibilityGroup = instanceFlexibilityGroup; + NormalizedSize = normalizedSize; + RecommendedQuantityNormalized = recommendedQuantityNormalized; + MeterId = meterId; + Term = term; + CostWithNoReservedInstances = costWithNoReservedInstances; + RecommendedQuantity = recommendedQuantity; + TotalCostWithReservedInstances = totalCostWithReservedInstances; + NetSavings = netSavings; + FirstUsageDate = firstUsageDate; + Scope = scope; + SkuProperties = skuProperties; + SkuName = skuName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource Location. + /// + [JsonProperty(PropertyName = "properties.location")] + public string ModernReservationRecommendationLocation { get; private set; } + + /// + /// Gets the number of days of usage to look back for recommendation. + /// + [JsonProperty(PropertyName = "properties.lookBackPeriod")] + public int? LookBackPeriod { get; private set; } + + /// + /// Gets the instance Flexibility Ratio. + /// + [JsonProperty(PropertyName = "properties.instanceFlexibilityRatio")] + public double? 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) + /// + [JsonProperty(PropertyName = "properties.meterId")] + public System.Guid? MeterId { get; private set; } + + /// + /// Gets RI recommendations in one or three year terms. + /// + [JsonProperty(PropertyName = "properties.term")] + public string Term { get; private set; } + + /// + /// Gets the total amount of cost without reserved instances. + /// + [JsonProperty(PropertyName = "properties.costWithNoReservedInstances")] + public Amount CostWithNoReservedInstances { get; private set; } + + /// + /// Gets recommended quality for reserved instances. + /// + [JsonProperty(PropertyName = "properties.recommendedQuantity")] + public decimal? RecommendedQuantity { get; private set; } + + /// + /// Gets the total amount of cost with reserved instances. + /// + [JsonProperty(PropertyName = "properties.totalCostWithReservedInstances")] + public Amount TotalCostWithReservedInstances { get; private set; } + + /// + /// Gets total estimated savings with reserved instances. + /// + [JsonProperty(PropertyName = "properties.netSavings")] + public Amount NetSavings { get; private set; } + + /// + /// Gets the usage date for looking back. + /// + [JsonProperty(PropertyName = "properties.firstUsageDate")] + public System.DateTime? FirstUsageDate { get; private set; } + + /// + /// Gets shared or single recommendation. + /// + [JsonProperty(PropertyName = "properties.scope")] + public string Scope { get; private set; } + + /// + /// Gets list of sku properties + /// + [JsonProperty(PropertyName = "properties.skuProperties")] + public IList SkuProperties { get; private set; } + + /// + /// Gets this is the ARM Sku name. + /// + [JsonProperty(PropertyName = "properties.skuName")] + public string SkuName { get; private set; } + + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ModernReservationTransaction.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ModernReservationTransaction.cs new file mode 100644 index 0000000000000..528f447280228 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ModernReservationTransaction.cs @@ -0,0 +1,237 @@ +// +// 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; + + /// + /// Modern Reservation transaction resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class ModernReservationTransaction : ReservationTransactionResource + { + /// + /// Initializes a new instance of the ModernReservationTransaction + /// class. + /// + public ModernReservationTransaction() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ModernReservationTransaction + /// class. + /// + /// Resource Id. + /// Resource name. + /// Resource type. + /// Resource tags. + /// The charge of the transaction. + /// This is the ARM Sku name. It can be used + /// to join with the serviceType field in additional info in usage + /// records. + /// The billing frequency, which can be + /// either one-time or recurring. + /// Billing profile Id. + /// Billing profile name. + /// The ISO currency in which the transaction is + /// charged, for example, USD. + /// The description of the + /// transaction. + /// The date of the transaction + /// The type of the transaction (Purchase, + /// Cancel, etc.) + /// Invoice Number + /// Invoice Id as on the invoice where the + /// specific transaction appears. + /// Invoice Section Id + /// Invoice Section Name. + /// The subscription guid that + /// makes the transaction. + /// The subscription name that + /// makes the transaction. + /// The quantity of the transaction. + /// The region of the transaction. + /// The reservation order ID is the + /// identifier for a reservation purchase. Each reservation order ID + /// represents a single purchase transaction. A reservation order + /// contains reservations. The reservation order specifies the VM size + /// and region for the reservations. + /// The name of the reservation + /// order. + /// This is the term of the transaction. + public ModernReservationTransaction(string id = default(string), string name = default(string), string type = default(string), IList tags = default(IList), decimal? amount = default(decimal?), string armSkuName = default(string), string billingFrequency = default(string), string billingProfileId = default(string), string billingProfileName = default(string), string currency = default(string), string description = default(string), System.DateTime? eventDate = default(System.DateTime?), string eventType = default(string), string invoice = default(string), string invoiceId = default(string), string invoiceSectionId = default(string), string invoiceSectionName = default(string), System.Guid? purchasingSubscriptionGuid = default(System.Guid?), string purchasingSubscriptionName = default(string), decimal? quantity = default(decimal?), string region = default(string), string reservationOrderId = default(string), string reservationOrderName = default(string), string term = default(string)) + : base(id, name, type, tags) + { + Amount = amount; + ArmSkuName = armSkuName; + BillingFrequency = billingFrequency; + BillingProfileId = billingProfileId; + BillingProfileName = billingProfileName; + Currency = currency; + Description = description; + EventDate = eventDate; + EventType = eventType; + Invoice = invoice; + InvoiceId = invoiceId; + InvoiceSectionId = invoiceSectionId; + InvoiceSectionName = invoiceSectionName; + PurchasingSubscriptionGuid = purchasingSubscriptionGuid; + PurchasingSubscriptionName = purchasingSubscriptionName; + Quantity = quantity; + Region = region; + ReservationOrderId = reservationOrderId; + ReservationOrderName = reservationOrderName; + Term = term; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the charge of the transaction. + /// + [JsonProperty(PropertyName = "properties.amount")] + public decimal? Amount { get; private set; } + + /// + /// Gets this is the ARM Sku name. It can be used to join with the + /// serviceType field in additional info in usage records. + /// + [JsonProperty(PropertyName = "properties.armSkuName")] + public string ArmSkuName { get; private set; } + + /// + /// Gets the billing frequency, which can be either one-time or + /// recurring. + /// + [JsonProperty(PropertyName = "properties.billingFrequency")] + public string BillingFrequency { get; private set; } + + /// + /// Gets billing profile Id. + /// + [JsonProperty(PropertyName = "properties.billingProfileId")] + public string BillingProfileId { get; private set; } + + /// + /// Gets billing profile name. + /// + [JsonProperty(PropertyName = "properties.billingProfileName")] + public string BillingProfileName { get; private set; } + + /// + /// Gets the ISO currency in which the transaction is charged, for + /// example, USD. + /// + [JsonProperty(PropertyName = "properties.currency")] + public string Currency { get; private set; } + + /// + /// Gets the description of the transaction. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; private set; } + + /// + /// Gets the date of the transaction + /// + [JsonProperty(PropertyName = "properties.eventDate")] + public System.DateTime? EventDate { get; private set; } + + /// + /// Gets the type of the transaction (Purchase, Cancel, etc.) + /// + [JsonProperty(PropertyName = "properties.eventType")] + public string EventType { get; private set; } + + /// + /// Gets invoice Number + /// + [JsonProperty(PropertyName = "properties.invoice")] + public string Invoice { get; private set; } + + /// + /// Gets invoice Id as on the invoice where the specific transaction + /// appears. + /// + [JsonProperty(PropertyName = "properties.invoiceId")] + public string InvoiceId { get; private set; } + + /// + /// Gets invoice Section Id + /// + [JsonProperty(PropertyName = "properties.invoiceSectionId")] + public string InvoiceSectionId { get; private set; } + + /// + /// Gets invoice Section Name. + /// + [JsonProperty(PropertyName = "properties.invoiceSectionName")] + public string InvoiceSectionName { get; private set; } + + /// + /// Gets the subscription guid that makes the transaction. + /// + [JsonProperty(PropertyName = "properties.purchasingSubscriptionGuid")] + public System.Guid? PurchasingSubscriptionGuid { get; private set; } + + /// + /// Gets the subscription name that makes the transaction. + /// + [JsonProperty(PropertyName = "properties.purchasingSubscriptionName")] + public string PurchasingSubscriptionName { get; private set; } + + /// + /// Gets the quantity of the transaction. + /// + [JsonProperty(PropertyName = "properties.quantity")] + public decimal? Quantity { get; private set; } + + /// + /// Gets the region of the transaction. + /// + [JsonProperty(PropertyName = "properties.region")] + public string Region { get; private set; } + + /// + /// Gets the reservation order ID is the identifier for a reservation + /// purchase. Each reservation order ID represents a single purchase + /// transaction. A reservation order contains reservations. The + /// reservation order specifies the VM size and region for the + /// reservations. + /// + [JsonProperty(PropertyName = "properties.reservationOrderId")] + public string ReservationOrderId { get; private set; } + + /// + /// Gets the name of the reservation order. + /// + [JsonProperty(PropertyName = "properties.reservationOrderName")] + public string ReservationOrderName { get; private set; } + + /// + /// Gets this is the term of the transaction. + /// + [JsonProperty(PropertyName = "properties.term")] + public string Term { get; private set; } + + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ModernUsageDetail.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ModernUsageDetail.cs new file mode 100644 index 0000000000000..42abbccd8fc1c --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ModernUsageDetail.cs @@ -0,0 +1,733 @@ +// +// 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; + + /// + /// Modern usage detail. + /// + [Newtonsoft.Json.JsonObject("modern")] + [Rest.Serialization.JsonTransformation] + public partial class ModernUsageDetail : UsageDetail + { + /// + /// Initializes a new instance of the ModernUsageDetail class. + /// + public ModernUsageDetail() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ModernUsageDetail class. + /// + /// The full qualified ARM ID of an event. + /// The ID that uniquely identifies an event. + /// + /// Resource type. + /// The etag for the resource. + /// Resource tags. + /// Billing Account identifier. + /// Name of the Billing + /// Account. + /// Billing Period Start Date as + /// in the invoice. + /// Billing Period End Date as in + /// the invoice. + /// Identifier for the billing profile + /// that groups costs across invoices in the a singular billing + /// currency across across the customers who have onboarded the + /// Microsoft customer agreement and the customers in CSP who have made + /// entitlement purchases like SaaS, Marketplace, RI, etc. + /// Name of the billing profile that + /// groups costs across invoices in the a singular billing currency + /// across across the customers who have onboarded the Microsoft + /// customer agreement and the customers in CSP who have made + /// entitlement purchases like SaaS, Marketplace, RI, etc. + /// Unique Microsoft generated + /// identifier for the Azure Subscription. + /// Name of the Azure + /// Subscription. + /// Date for the usage record. + /// Name of the product that has accrued charges + /// by consumption or purchase as listed in the invoice. Not available + /// for Marketplace. + /// The meter id (GUID). Not available for + /// marketplace. For reserved instance this represents the primary + /// meter for which the reservation was purchased. For the actual VM + /// Size for which the reservation is purchased see + /// productOrderName. + /// Identifies the name of the meter against + /// which consumption is measured. + /// Identifies the location of the datacenter + /// for certain services that are priced based on datacenter + /// location. + /// Identifies the top-level service for + /// the usage. + /// Defines the type or sub-category of + /// Azure service that can affect the rate. + /// List the service family for the product + /// purchased or charged (Example: Storage ; Compute). + /// Measure the quantity purchased or + /// consumed.The amount of the meter used during the billing + /// period. + /// Identifies the Unit that the service is + /// charged in. For example, GB, hours, 10,000 s. + /// Instance Name. + /// Estimated extendedCost or blended cost + /// before tax in USD. + /// Unit Price is the price applicable to you. + /// (your EA or other contract price). + /// The currency defining the billed + /// cost. + /// Name of the resource + /// location. + /// Consumed service name. Name of the + /// azure resource provider that emits the usage or was purchased. This + /// value is not provided for marketplace usage. + /// Service-specific metadata. + /// Legacy field with optional + /// service-specific metadata. + /// Additional details of this usage item. + /// Use this field to get usage line item specific details such as the + /// actual VM Size (ServiceType) or the ratio in which the reservation + /// discount is applied. + /// Identifier of the project that is + /// being charged in the invoice. Not applicable for Microsoft Customer + /// Agreements onboarded by partners. + /// Name of the project that is being + /// charged in the invoice. Not applicable for Microsoft Customer + /// Agreements onboarded by partners. + /// The cost center of this department if it + /// is a department and a cost center is provided. + /// Name of the Azure resource group used + /// for cohesive lifecycle management of resources. + /// ARM resource id of the reservation. + /// Only applies to records relevant to reservations. + /// User provided display name of the + /// reservation. Last known name for a particular day is populated in + /// the daily data. Only applies to records relevant to + /// reservations. + /// The identifier for the asset or Azure + /// plan name that the subscription belongs to. For example: Azure + /// Plan. For reservations this is the Reservation Order ID. + /// Product Order Name. For reservations + /// this is the SKU that was purchased. + /// Determines if the cost is + /// eligible to be paid for using Azure credits. + /// Term (in months). Displays the term for the + /// validity of the offer. For example. In case of reserved instances + /// it displays 12 months for yearly term of reserved instance. For one + /// time purchases or recurring purchases, the terms displays 1 month; + /// This is not applicable for Azure consumption. + /// Name of the publisher of the service + /// including Microsoft or Third Party publishers. + /// Type of publisher that identifies if + /// the publisher is first party, third party reseller or third party + /// agency. + /// Indicates a charge represents credits, + /// usage, a Marketplace purchase, a reservation fee, or a + /// refund. + /// Indicates how frequently this charge will + /// occur. OneTime for purchases which only happen once, Monthly for + /// fees which recur every month, and UsageBased for charges based on + /// how much a service is used. + /// ExtendedCost or blended cost + /// before tax in billed currency. + /// ExtendedCost or blended cost + /// before tax in pricing currency to correlate with prices. + /// Exchange rate used in conversion from + /// pricing currency to billing currency. + /// Date on which exchange rate used in + /// conversion from pricing currency to billing currency. + /// Invoice ID as on the invoice where the + /// specific transaction appears. + /// Reference to an original invoice + /// there is a refund (negative cost). This is populated only when + /// there is a refund. + /// Pricing Billing Currency. + /// Identifier for the product that has + /// accrued charges by consumption or purchase . This is the + /// concatenated key of productId and SkuId in partner center. + /// Resource Location + /// Normalized. + /// Start date for the rating + /// period when the service usage was rated for charges. The prices for + /// Azure services are determined for the rating period. + /// End date for the period when the + /// service usage was rated for charges. The prices for Azure services + /// are determined based on the rating period. + /// Identifier of the customer's AAD + /// tenant. + /// Name of the customer's AAD + /// tenant. + /// Identifier for the partner's AAD + /// tenant. + /// Name of the partner' AAD tenant. + /// MPNId for the reseller associated with + /// the subscription. + /// Reseller Name. + /// Publisher Id. + /// Market Price that's charged for the + /// usage. + /// Exchange Rate from + /// pricing currency to billing currency. + /// The amount of PayG cost + /// before tax in billing currency. + /// The amount of PayG cost before tax in + /// US Dollar currency. + /// Rate of discount applied if + /// there is a partner earned credit (PEC) based on partner admin link + /// access. + /// Flag to indicate if + /// partner earned credit has been applied or not. + /// Retail price for the resource. + public ModernUsageDetail(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), IDictionary tags = default(IDictionary), string billingAccountId = default(string), string billingAccountName = default(string), System.DateTime? billingPeriodStartDate = default(System.DateTime?), System.DateTime? billingPeriodEndDate = default(System.DateTime?), string billingProfileId = default(string), string billingProfileName = default(string), string subscriptionGuid = default(string), string subscriptionName = default(string), System.DateTime? date = default(System.DateTime?), string product = default(string), System.Guid? meterId = default(System.Guid?), string meterName = default(string), string meterRegion = default(string), string meterCategory = default(string), string meterSubCategory = default(string), string serviceFamily = default(string), decimal? quantity = default(decimal?), string unitOfMeasure = default(string), string instanceName = default(string), decimal? costInUSD = default(decimal?), decimal? unitPrice = default(decimal?), string billingCurrencyCode = default(string), string resourceLocation = default(string), string consumedService = default(string), string serviceInfo1 = default(string), string serviceInfo2 = default(string), string additionalInfo = default(string), string invoiceSectionId = default(string), string invoiceSectionName = default(string), string costCenter = default(string), string resourceGroup = default(string), string reservationId = default(string), string reservationName = default(string), string productOrderId = default(string), string productOrderName = default(string), bool? isAzureCreditEligible = default(bool?), string term = default(string), string publisherName = default(string), string publisherType = default(string), string chargeType = default(string), string frequency = default(string), decimal? costInBillingCurrency = default(decimal?), decimal? costInPricingCurrency = default(decimal?), string exchangeRate = default(string), System.DateTime? exchangeRateDate = default(System.DateTime?), string invoiceId = default(string), string previousInvoiceId = default(string), string pricingCurrencyCode = default(string), string productIdentifier = default(string), string resourceLocationNormalized = default(string), System.DateTime? servicePeriodStartDate = default(System.DateTime?), System.DateTime? servicePeriodEndDate = default(System.DateTime?), string customerTenantId = default(string), string customerName = default(string), string partnerTenantId = default(string), string partnerName = default(string), string resellerMpnId = default(string), string resellerName = default(string), string publisherId = default(string), decimal? marketPrice = default(decimal?), decimal? exchangeRatePricingToBilling = default(decimal?), decimal? paygCostInBillingCurrency = default(decimal?), decimal? paygCostInUSD = default(decimal?), decimal? partnerEarnedCreditRate = default(decimal?), string partnerEarnedCreditApplied = default(string), decimal? payGPrice = default(decimal?)) + : base(id, name, type, etag, tags) + { + BillingAccountId = billingAccountId; + BillingAccountName = billingAccountName; + BillingPeriodStartDate = billingPeriodStartDate; + BillingPeriodEndDate = billingPeriodEndDate; + BillingProfileId = billingProfileId; + BillingProfileName = billingProfileName; + SubscriptionGuid = subscriptionGuid; + SubscriptionName = subscriptionName; + Date = date; + Product = product; + MeterId = meterId; + MeterName = meterName; + MeterRegion = meterRegion; + MeterCategory = meterCategory; + MeterSubCategory = meterSubCategory; + ServiceFamily = serviceFamily; + Quantity = quantity; + UnitOfMeasure = unitOfMeasure; + InstanceName = instanceName; + CostInUSD = costInUSD; + UnitPrice = unitPrice; + BillingCurrencyCode = billingCurrencyCode; + ResourceLocation = resourceLocation; + ConsumedService = consumedService; + ServiceInfo1 = serviceInfo1; + ServiceInfo2 = serviceInfo2; + AdditionalInfo = additionalInfo; + InvoiceSectionId = invoiceSectionId; + InvoiceSectionName = invoiceSectionName; + CostCenter = costCenter; + ResourceGroup = resourceGroup; + ReservationId = reservationId; + ReservationName = reservationName; + ProductOrderId = productOrderId; + ProductOrderName = productOrderName; + IsAzureCreditEligible = isAzureCreditEligible; + Term = term; + PublisherName = publisherName; + PublisherType = publisherType; + ChargeType = chargeType; + Frequency = frequency; + CostInBillingCurrency = costInBillingCurrency; + CostInPricingCurrency = costInPricingCurrency; + ExchangeRate = exchangeRate; + ExchangeRateDate = exchangeRateDate; + InvoiceId = invoiceId; + PreviousInvoiceId = previousInvoiceId; + PricingCurrencyCode = pricingCurrencyCode; + ProductIdentifier = productIdentifier; + ResourceLocationNormalized = resourceLocationNormalized; + ServicePeriodStartDate = servicePeriodStartDate; + ServicePeriodEndDate = servicePeriodEndDate; + CustomerTenantId = customerTenantId; + CustomerName = customerName; + PartnerTenantId = partnerTenantId; + PartnerName = partnerName; + ResellerMpnId = resellerMpnId; + ResellerName = resellerName; + PublisherId = publisherId; + MarketPrice = marketPrice; + ExchangeRatePricingToBilling = exchangeRatePricingToBilling; + PaygCostInBillingCurrency = paygCostInBillingCurrency; + PaygCostInUSD = paygCostInUSD; + PartnerEarnedCreditRate = partnerEarnedCreditRate; + PartnerEarnedCreditApplied = partnerEarnedCreditApplied; + PayGPrice = payGPrice; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets billing Account identifier. + /// + [JsonProperty(PropertyName = "properties.billingAccountId")] + public string BillingAccountId { get; private set; } + + /// + /// Gets name of the Billing Account. + /// + [JsonProperty(PropertyName = "properties.billingAccountName")] + public string BillingAccountName { get; private set; } + + /// + /// Gets billing Period Start Date as in the invoice. + /// + [JsonProperty(PropertyName = "properties.billingPeriodStartDate")] + public System.DateTime? BillingPeriodStartDate { get; private set; } + + /// + /// Gets billing Period End Date as in the invoice. + /// + [JsonProperty(PropertyName = "properties.billingPeriodEndDate")] + public System.DateTime? BillingPeriodEndDate { get; private set; } + + /// + /// Gets identifier for the billing profile that groups costs across + /// invoices in the a singular billing currency across across the + /// customers who have onboarded the Microsoft customer agreement and + /// the customers in CSP who have made entitlement purchases like SaaS, + /// Marketplace, RI, etc. + /// + [JsonProperty(PropertyName = "properties.billingProfileId")] + public string BillingProfileId { get; private set; } + + /// + /// Gets name of the billing profile that groups costs across invoices + /// in the a singular billing currency across across the customers who + /// have onboarded the Microsoft customer agreement and the customers + /// in CSP who have made entitlement purchases like SaaS, Marketplace, + /// RI, etc. + /// + [JsonProperty(PropertyName = "properties.billingProfileName")] + public string BillingProfileName { get; private set; } + + /// + /// Gets unique Microsoft generated identifier for the Azure + /// Subscription. + /// + [JsonProperty(PropertyName = "properties.subscriptionGuid")] + public string SubscriptionGuid { get; private set; } + + /// + /// Gets name of the Azure Subscription. + /// + [JsonProperty(PropertyName = "properties.subscriptionName")] + public string SubscriptionName { get; private set; } + + /// + /// Gets date for the usage record. + /// + [JsonProperty(PropertyName = "properties.date")] + public System.DateTime? Date { get; private set; } + + /// + /// Gets name of the product that has accrued charges by consumption or + /// purchase as listed in the invoice. Not available for Marketplace. + /// + [JsonProperty(PropertyName = "properties.product")] + public string Product { get; private set; } + + /// + /// Gets the meter id (GUID). Not available for marketplace. For + /// reserved instance this represents the primary meter for which the + /// reservation was purchased. For the actual VM Size for which the + /// reservation is purchased see productOrderName. + /// + [JsonProperty(PropertyName = "properties.meterId")] + public System.Guid? MeterId { get; private set; } + + /// + /// Gets identifies the name of the meter against which consumption is + /// measured. + /// + [JsonProperty(PropertyName = "properties.meterName")] + public string MeterName { get; private set; } + + /// + /// Gets identifies the location of the datacenter for certain services + /// that are priced based on datacenter location. + /// + [JsonProperty(PropertyName = "properties.meterRegion")] + public string MeterRegion { get; private set; } + + /// + /// Gets identifies the top-level service for the usage. + /// + [JsonProperty(PropertyName = "properties.meterCategory")] + public string MeterCategory { get; private set; } + + /// + /// Gets defines the type or sub-category of Azure service that can + /// affect the rate. + /// + [JsonProperty(PropertyName = "properties.meterSubCategory")] + public string MeterSubCategory { get; private set; } + + /// + /// Gets list the service family for the product purchased or charged + /// (Example: Storage ; Compute). + /// + [JsonProperty(PropertyName = "properties.serviceFamily")] + public string ServiceFamily { get; private set; } + + /// + /// Gets measure the quantity purchased or consumed.The amount of the + /// meter used during the billing period. + /// + [JsonProperty(PropertyName = "properties.quantity")] + public decimal? Quantity { get; private set; } + + /// + /// Gets identifies the Unit that the service is charged in. For + /// example, GB, hours, 10,000 s. + /// + [JsonProperty(PropertyName = "properties.unitOfMeasure")] + public string UnitOfMeasure { get; private set; } + + /// + /// Gets instance Name. + /// + [JsonProperty(PropertyName = "properties.instanceName")] + public string InstanceName { get; private set; } + + /// + /// Gets estimated extendedCost or blended cost before tax in USD. + /// + [JsonProperty(PropertyName = "properties.costInUSD")] + public decimal? CostInUSD { get; private set; } + + /// + /// Gets unit Price is the price applicable to you. (your EA or other + /// contract price). + /// + [JsonProperty(PropertyName = "properties.unitPrice")] + public decimal? UnitPrice { get; private set; } + + /// + /// Gets the currency defining the billed cost. + /// + [JsonProperty(PropertyName = "properties.billingCurrencyCode")] + public string BillingCurrencyCode { get; private set; } + + /// + /// Gets name of the resource location. + /// + [JsonProperty(PropertyName = "properties.resourceLocation")] + public string ResourceLocation { get; private set; } + + /// + /// Gets consumed service name. Name of the azure resource provider + /// that emits the usage or was purchased. This value is not provided + /// for marketplace usage. + /// + [JsonProperty(PropertyName = "properties.consumedService")] + public string ConsumedService { get; private set; } + + /// + /// Gets service-specific metadata. + /// + [JsonProperty(PropertyName = "properties.serviceInfo1")] + public string ServiceInfo1 { get; private set; } + + /// + /// Gets legacy field with optional service-specific metadata. + /// + [JsonProperty(PropertyName = "properties.serviceInfo2")] + public string ServiceInfo2 { get; private set; } + + /// + /// Gets additional details of this usage item. Use this field to get + /// usage line item specific details such as the actual VM Size + /// (ServiceType) or the ratio in which the reservation discount is + /// applied. + /// + [JsonProperty(PropertyName = "properties.additionalInfo")] + public string AdditionalInfo { get; private set; } + + /// + /// Gets identifier of the project that is being charged in the + /// invoice. Not applicable for Microsoft Customer Agreements onboarded + /// by partners. + /// + [JsonProperty(PropertyName = "properties.invoiceSectionId")] + public string InvoiceSectionId { get; private set; } + + /// + /// Gets name of the project that is being charged in the invoice. Not + /// applicable for Microsoft Customer Agreements onboarded by partners. + /// + [JsonProperty(PropertyName = "properties.invoiceSectionName")] + public string InvoiceSectionName { get; private set; } + + /// + /// Gets the cost center of this department if it is a department and a + /// cost center is provided. + /// + [JsonProperty(PropertyName = "properties.costCenter")] + public string CostCenter { get; private set; } + + /// + /// Gets name of the Azure resource group used for cohesive lifecycle + /// management of resources. + /// + [JsonProperty(PropertyName = "properties.resourceGroup")] + public string ResourceGroup { get; private set; } + + /// + /// Gets ARM resource id of the reservation. Only applies to records + /// relevant to reservations. + /// + [JsonProperty(PropertyName = "properties.reservationId")] + public string ReservationId { get; private set; } + + /// + /// Gets user provided display name of the reservation. Last known name + /// for a particular day is populated in the daily data. Only applies + /// to records relevant to reservations. + /// + [JsonProperty(PropertyName = "properties.reservationName")] + public string ReservationName { get; private set; } + + /// + /// Gets the identifier for the asset or Azure plan name that the + /// subscription belongs to. For example: Azure Plan. For reservations + /// this is the Reservation Order ID. + /// + [JsonProperty(PropertyName = "properties.productOrderId")] + public string ProductOrderId { get; private set; } + + /// + /// Gets product Order Name. For reservations this is the SKU that was + /// purchased. + /// + [JsonProperty(PropertyName = "properties.productOrderName")] + public string ProductOrderName { get; private set; } + + /// + /// Gets determines if the cost is eligible to be paid for using Azure + /// credits. + /// + [JsonProperty(PropertyName = "properties.isAzureCreditEligible")] + public bool? IsAzureCreditEligible { get; private set; } + + /// + /// Gets term (in months). Displays the term for the validity of the + /// offer. For example. In case of reserved instances it displays 12 + /// months for yearly term of reserved instance. For one time purchases + /// or recurring purchases, the terms displays 1 month; This is not + /// applicable for Azure consumption. + /// + [JsonProperty(PropertyName = "properties.term")] + public string Term { get; private set; } + + /// + /// Gets name of the publisher of the service including Microsoft or + /// Third Party publishers. + /// + [JsonProperty(PropertyName = "properties.publisherName")] + public string PublisherName { get; private set; } + + /// + /// Gets type of publisher that identifies if the publisher is first + /// party, third party reseller or third party agency. + /// + [JsonProperty(PropertyName = "properties.publisherType")] + public string PublisherType { get; private set; } + + /// + /// Gets indicates a charge represents credits, usage, a Marketplace + /// purchase, a reservation fee, or a refund. + /// + [JsonProperty(PropertyName = "properties.chargeType")] + public string ChargeType { get; private set; } + + /// + /// Gets indicates how frequently this charge will occur. OneTime for + /// purchases which only happen once, Monthly for fees which recur + /// every month, and UsageBased for charges based on how much a service + /// is used. + /// + [JsonProperty(PropertyName = "properties.frequency")] + public string Frequency { get; private set; } + + /// + /// Gets extendedCost or blended cost before tax in billed currency. + /// + [JsonProperty(PropertyName = "properties.costInBillingCurrency")] + public decimal? CostInBillingCurrency { get; private set; } + + /// + /// Gets extendedCost or blended cost before tax in pricing currency to + /// correlate with prices. + /// + [JsonProperty(PropertyName = "properties.costInPricingCurrency")] + public decimal? CostInPricingCurrency { get; private set; } + + /// + /// Gets exchange rate used in conversion from pricing currency to + /// billing currency. + /// + [JsonProperty(PropertyName = "properties.exchangeRate")] + public string ExchangeRate { get; private set; } + + /// + /// Gets date on which exchange rate used in conversion from pricing + /// currency to billing currency. + /// + [JsonProperty(PropertyName = "properties.exchangeRateDate")] + public System.DateTime? ExchangeRateDate { get; private set; } + + /// + /// Gets invoice ID as on the invoice where the specific transaction + /// appears. + /// + [JsonProperty(PropertyName = "properties.invoiceId")] + public string InvoiceId { get; private set; } + + /// + /// Gets reference to an original invoice there is a refund (negative + /// cost). This is populated only when there is a refund. + /// + [JsonProperty(PropertyName = "properties.previousInvoiceId")] + public string PreviousInvoiceId { get; private set; } + + /// + /// Gets pricing Billing Currency. + /// + [JsonProperty(PropertyName = "properties.pricingCurrencyCode")] + public string PricingCurrencyCode { get; private set; } + + /// + /// Gets identifier for the product that has accrued charges by + /// consumption or purchase . This is the concatenated key of productId + /// and SkuId in partner center. + /// + [JsonProperty(PropertyName = "properties.productIdentifier")] + public string ProductIdentifier { get; private set; } + + /// + /// Gets resource Location Normalized. + /// + [JsonProperty(PropertyName = "properties.resourceLocationNormalized")] + public string ResourceLocationNormalized { get; private set; } + + /// + /// Gets start date for the rating period when the service usage was + /// rated for charges. The prices for Azure services are determined for + /// the rating period. + /// + [JsonProperty(PropertyName = "properties.servicePeriodStartDate")] + public System.DateTime? ServicePeriodStartDate { get; private set; } + + /// + /// Gets end date for the period when the service usage was rated for + /// charges. The prices for Azure services are determined based on the + /// rating period. + /// + [JsonProperty(PropertyName = "properties.servicePeriodEndDate")] + public System.DateTime? ServicePeriodEndDate { get; private set; } + + /// + /// Gets identifier of the customer's AAD tenant. + /// + [JsonProperty(PropertyName = "properties.customerTenantId")] + public string CustomerTenantId { get; private set; } + + /// + /// Gets name of the customer's AAD tenant. + /// + [JsonProperty(PropertyName = "properties.customerName")] + public string CustomerName { get; private set; } + + /// + /// Gets identifier for the partner's AAD tenant. + /// + [JsonProperty(PropertyName = "properties.partnerTenantId")] + public string PartnerTenantId { get; private set; } + + /// + /// Gets name of the partner' AAD tenant. + /// + [JsonProperty(PropertyName = "properties.partnerName")] + public string PartnerName { get; private set; } + + /// + /// Gets mPNId for the reseller associated with the subscription. + /// + [JsonProperty(PropertyName = "properties.resellerMpnId")] + public string ResellerMpnId { get; private set; } + + /// + /// Gets reseller Name. + /// + [JsonProperty(PropertyName = "properties.resellerName")] + public string ResellerName { get; private set; } + + /// + /// Gets publisher Id. + /// + [JsonProperty(PropertyName = "properties.publisherId")] + public string PublisherId { get; private set; } + + /// + /// Gets market Price that's charged for the usage. + /// + [JsonProperty(PropertyName = "properties.marketPrice")] + public decimal? MarketPrice { get; private set; } + + /// + /// Gets exchange Rate from pricing currency to billing currency. + /// + [JsonProperty(PropertyName = "properties.exchangeRatePricingToBilling")] + public decimal? ExchangeRatePricingToBilling { get; private set; } + + /// + /// Gets the amount of PayG cost before tax in billing currency. + /// + [JsonProperty(PropertyName = "properties.paygCostInBillingCurrency")] + public decimal? PaygCostInBillingCurrency { get; private set; } + + /// + /// Gets the amount of PayG cost before tax in US Dollar currency. + /// + [JsonProperty(PropertyName = "properties.paygCostInUSD")] + public decimal? PaygCostInUSD { get; private set; } + + /// + /// Gets rate of discount applied if there is a partner earned credit + /// (PEC) based on partner admin link access. + /// + [JsonProperty(PropertyName = "properties.partnerEarnedCreditRate")] + public decimal? PartnerEarnedCreditRate { get; private set; } + + /// + /// Gets flag to indicate if partner earned credit has been applied or + /// not. + /// + [JsonProperty(PropertyName = "properties.partnerEarnedCreditApplied")] + public string PartnerEarnedCreditApplied { get; private set; } + + /// + /// Gets retail price for the resource. + /// + [JsonProperty(PropertyName = "properties.payGPrice")] + public decimal? PayGPrice { get; private set; } + + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Notification.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Notification.cs index bc6befaaaa59c..d86e4d8366563 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Notification.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Notification.cs @@ -41,12 +41,19 @@ public Notification() /// threshold. It is always percent and has to be between 0 and /// 1000. /// Email addresses to send the budget - /// notification to when the threshold is exceeded. + /// notification to when the threshold is exceeded. Must have at least + /// one contact email or contact group specified at the Subscription or + /// Resource Group scopes. All other scopes must have at least one + /// contact email specified. /// Contact roles to send the budget /// notification to when the threshold is exceeded. /// Action groups to send the budget - /// notification to when the threshold is exceeded. - public Notification(bool enabled, string operatorProperty, decimal threshold, IList contactEmails, IList contactRoles = default(IList), IList contactGroups = default(IList)) + /// notification to when the threshold is exceeded. Must be provided as + /// a fully qualified Azure resource id. Only supported at Subscription + /// or Resource Group scopes. + /// The type of threshold. Possible values + /// include: 'Actual' + public Notification(bool enabled, string operatorProperty, decimal threshold, IList contactEmails, IList contactRoles = default(IList), IList contactGroups = default(IList), string thresholdType = default(string)) { Enabled = enabled; OperatorProperty = operatorProperty; @@ -54,6 +61,7 @@ public Notification() ContactEmails = contactEmails; ContactRoles = contactRoles; ContactGroups = contactGroups; + ThresholdType = thresholdType; CustomInit(); } @@ -85,7 +93,10 @@ public Notification() /// /// Gets or sets email addresses to send the budget notification to - /// when the threshold is exceeded. + /// when the threshold is exceeded. Must have at least one contact + /// email or contact group specified at the Subscription or Resource + /// Group scopes. All other scopes must have at least one contact email + /// specified. /// [JsonProperty(PropertyName = "contactEmails")] public IList ContactEmails { get; set; } @@ -99,11 +110,20 @@ public Notification() /// /// Gets or sets action groups to send the budget notification to when - /// the threshold is exceeded. + /// the threshold is exceeded. Must be provided as a fully qualified + /// Azure resource id. Only supported at Subscription or Resource Group + /// scopes. /// [JsonProperty(PropertyName = "contactGroups")] public IList ContactGroups { get; set; } + /// + /// Gets or sets the type of threshold. Possible values include: + /// 'Actual' + /// + [JsonProperty(PropertyName = "thresholdType")] + public string ThresholdType { get; set; } + /// /// Validate the object. /// @@ -126,9 +146,9 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.MaxItems, "ContactEmails", 50); } - if (ContactEmails.Count < 1) + if (ContactEmails.Count < 0) { - throw new ValidationException(ValidationRules.MinItems, "ContactEmails", 1); + throw new ValidationException(ValidationRules.MinItems, "ContactEmails", 0); } } if (ContactGroups != null) diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Operation.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Operation.cs index db8c7299478e0..84ed65f480481 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Operation.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Operation.cs @@ -29,12 +29,14 @@ public Operation() /// /// Initializes a new instance of the Operation class. /// + /// Operation Id. /// Operation name: /// {provider}/{resource}/{operation}. /// The object that represents the /// operation. - public Operation(string name = default(string), OperationDisplay display = default(OperationDisplay)) + public Operation(string id = default(string), string name = default(string), OperationDisplay display = default(OperationDisplay)) { + Id = id; Name = name; Display = display; CustomInit(); @@ -45,6 +47,12 @@ public Operation() /// partial void CustomInit(); + /// + /// Gets operation Id. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + /// /// Gets operation name: {provider}/{resource}/{operation}. /// diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/OperationDisplay.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/OperationDisplay.cs index b2c4a02b8ba9a..b8968cb9ca342 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/OperationDisplay.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/OperationDisplay.cs @@ -35,11 +35,13 @@ public OperationDisplay() /// performed: UsageDetail, etc. /// Operation type: Read, write, delete, /// etc. - public OperationDisplay(string provider = default(string), string resource = default(string), string operation = default(string)) + /// Description of the operation. + public OperationDisplay(string provider = default(string), string resource = default(string), string operation = default(string), string description = default(string)) { Provider = provider; Resource = resource; Operation = operation; + Description = description; CustomInit(); } @@ -67,5 +69,11 @@ public OperationDisplay() [JsonProperty(PropertyName = "operation")] public string Operation { get; private set; } + /// + /// Gets description of the operation. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; private set; } + } } diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/PriceSheetResult.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/PriceSheetResult.cs index e1aa3923a539e..caacceca4b36d 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/PriceSheetResult.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/PriceSheetResult.cs @@ -34,18 +34,22 @@ public PriceSheetResult() /// /// Initializes a new instance of the PriceSheetResult class. /// - /// Resource Id. - /// Resource name. + /// The full qualified ARM ID of an event. + /// The ID that uniquely identifies an event. + /// /// Resource type. + /// The etag for the resource. /// Resource tags. /// Price sheet /// The link (url) to the next page of /// results. - public PriceSheetResult(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), IList pricesheets = default(IList), string nextLink = default(string)) - : base(id, name, type, tags) + /// Pricesheet download details. + public PriceSheetResult(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), IDictionary tags = default(IDictionary), IList pricesheets = default(IList), string nextLink = default(string), MeterDetails download = default(MeterDetails)) + : base(id, name, type, etag, tags) { Pricesheets = pricesheets; NextLink = nextLink; + Download = download; CustomInit(); } @@ -66,5 +70,11 @@ public PriceSheetResult() [JsonProperty(PropertyName = "properties.nextLink")] public string NextLink { get; private set; } + /// + /// Gets pricesheet download details. + /// + [JsonProperty(PropertyName = "properties.download")] + public MeterDetails Download { get; private set; } + } } diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Reseller.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Reseller.cs new file mode 100644 index 0000000000000..9816e290b6fe5 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Reseller.cs @@ -0,0 +1,60 @@ +// +// 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; + + /// + /// The reseller properties. + /// + public partial class Reseller + { + /// + /// Initializes a new instance of the Reseller class. + /// + public Reseller() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Reseller class. + /// + /// The reseller property ID. + /// The reseller property + /// description. + public Reseller(string resellerId = default(string), string resellerDescription = default(string)) + { + ResellerId = resellerId; + ResellerDescription = resellerDescription; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the reseller property ID. + /// + [JsonProperty(PropertyName = "resellerId")] + public string ResellerId { get; private set; } + + /// + /// Gets the reseller property description. + /// + [JsonProperty(PropertyName = "resellerDescription")] + public string ResellerDescription { get; private 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..a19d27923748a 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 @@ -34,15 +34,21 @@ public ReservationDetail() /// /// Initializes a new instance of the ReservationDetail class. /// - /// Resource Id. - /// Resource name. + /// The full qualified ARM ID of an event. + /// The ID that uniquely identifies an event. + /// /// Resource type. + /// The etag for the resource. /// Resource tags. /// The reservation order ID is the /// identifier for a reservation purchase. Each reservation order ID /// 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 +69,13 @@ 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?)) - : base(id, name, type, tags) + /// The reservation kind. + public ReservationDetail(string id = default(string), string name = default(string), string type = default(string), string etag = 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?), string kind = default(string)) + : base(id, name, type, etag, tags) { ReservationOrderId = reservationOrderId; + InstanceFlexibilityRatio = instanceFlexibilityRatio; + InstanceFlexibilityGroup = instanceFlexibilityGroup; ReservationId = reservationId; SkuName = skuName; ReservedHours = reservedHours; @@ -74,6 +83,7 @@ public ReservationDetail() UsedHours = usedHours; InstanceId = instanceId; TotalReservedQuantity = totalReservedQuantity; + Kind = kind; CustomInit(); } @@ -92,6 +102,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 @@ -142,5 +164,11 @@ public ReservationDetail() [JsonProperty(PropertyName = "properties.totalReservedQuantity")] public decimal? TotalReservedQuantity { get; private set; } + /// + /// Gets the reservation kind. + /// + [JsonProperty(PropertyName = "properties.kind")] + public string Kind { get; private set; } + } } 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..bb920ce10007a 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 @@ -10,17 +10,14 @@ 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; /// - /// Reservation recommendation resource. + /// A reservation recommendation resource. /// - [Rest.Serialization.JsonTransformation] public partial class ReservationRecommendation { /// @@ -34,45 +31,23 @@ public ReservationRecommendation() /// /// Initializes a new instance of the ReservationRecommendation class. /// - /// Resource Id. - /// Resource name. + /// The full qualified ARM ID of an event. + /// The ID that uniquely identifies an event. + /// /// Resource type. + /// The etag for the resource. /// Resource tags. /// Resource location /// Resource sku - /// The number of days of usage to look - /// back for recommendation. - /// The meter id (GUID) - /// RI recommendations in one or three year - /// terms. - /// The total amount of cost - /// without reserved instances. - /// Recommended quality for reserved - /// instances. - /// The total amount of - /// cost with reserved instances. - /// Total estimated savings with reserved - /// instances. - /// 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), string etag = default(string), IDictionary tags = default(IDictionary), string location = default(string), string sku = default(string)) { Id = id; Name = name; Type = type; + Etag = etag; Tags = tags; Location = location; Sku = sku; - LookBackPeriod = lookBackPeriod; - MeterId = meterId; - Term = term; - CostWithNoReservedInstances = costWithNoReservedInstances; - RecommendedQuantity = recommendedQuantity; - TotalCostWithReservedInstances = totalCostWithReservedInstances; - NetSavings = netSavings; - FirstUsageDate = firstUsageDate; - Scope = scope; CustomInit(); } @@ -82,13 +57,13 @@ public ReservationRecommendation() partial void CustomInit(); /// - /// Gets resource Id. + /// Gets the full qualified ARM ID of an event. /// [JsonProperty(PropertyName = "id")] public string Id { get; private set; } /// - /// Gets resource name. + /// Gets the ID that uniquely identifies an event. /// [JsonProperty(PropertyName = "name")] public string Name { get; private set; } @@ -99,6 +74,12 @@ public ReservationRecommendation() [JsonProperty(PropertyName = "type")] public string Type { get; private set; } + /// + /// Gets the etag for the resource. + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; private set; } + /// /// Gets resource tags. /// @@ -117,59 +98,5 @@ public ReservationRecommendation() [JsonProperty(PropertyName = "sku")] public string Sku { get; private set; } - /// - /// Gets the number of days of usage to look back for recommendation. - /// - [JsonProperty(PropertyName = "properties.lookBackPeriod")] - public string LookBackPeriod { get; private set; } - - /// - /// Gets the meter id (GUID) - /// - [JsonProperty(PropertyName = "properties.meterId")] - public System.Guid? MeterId { get; private set; } - - /// - /// Gets RI recommendations in one or three year terms. - /// - [JsonProperty(PropertyName = "properties.term")] - public string Term { get; private set; } - - /// - /// Gets the total amount of cost without reserved instances. - /// - [JsonProperty(PropertyName = "properties.costWithNoReservedInstances")] - public decimal? CostWithNoReservedInstances { get; private set; } - - /// - /// Gets recommended quality for reserved instances. - /// - [JsonProperty(PropertyName = "properties.recommendedQuantity")] - public decimal? RecommendedQuantity { get; private set; } - - /// - /// Gets the total amount of cost with reserved instances. - /// - [JsonProperty(PropertyName = "properties.totalCostWithReservedInstances")] - public decimal? TotalCostWithReservedInstances { get; private set; } - - /// - /// Gets total estimated savings with reserved instances. - /// - [JsonProperty(PropertyName = "properties.netSavings")] - public decimal? NetSavings { get; private set; } - - /// - /// Gets the usage date for looking back. - /// - [JsonProperty(PropertyName = "properties.firstUsageDate")] - public System.DateTime? FirstUsageDate { get; private set; } - - /// - /// Gets shared or single recommendation. - /// - [JsonProperty(PropertyName = "properties.scope")] - public string Scope { get; private set; } - } } diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ReservationRecommendationDetailsCalculatedSavingsProperties.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ReservationRecommendationDetailsCalculatedSavingsProperties.cs new file mode 100644 index 0000000000000..50ec199bfff25 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ReservationRecommendationDetailsCalculatedSavingsProperties.cs @@ -0,0 +1,109 @@ +// +// 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; + + /// + /// Details of estimated savings. + /// + public partial class ReservationRecommendationDetailsCalculatedSavingsProperties + { + /// + /// Initializes a new instance of the + /// ReservationRecommendationDetailsCalculatedSavingsProperties class. + /// + public ReservationRecommendationDetailsCalculatedSavingsProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ReservationRecommendationDetailsCalculatedSavingsProperties class. + /// + /// The cost without reservation. + /// The difference between total reservation + /// cost and reservation cost. + /// The quantity for calculated savings. + /// The exact cost of the estimated usage + /// using reservation. + /// The cost of the suggested + /// quantity. + /// The number of reserved units used + /// to calculate savings. Always 1 for virtual machines. + /// The amount saved by purchasing the + /// recommended quantity of reservation. + public ReservationRecommendationDetailsCalculatedSavingsProperties(double? onDemandCost = default(double?), double? overageCost = default(double?), double? quantity = default(double?), double? reservationCost = default(double?), double? totalReservationCost = default(double?), double? reservedUnitCount = default(double?), double? savings = default(double?)) + { + OnDemandCost = onDemandCost; + OverageCost = overageCost; + Quantity = quantity; + ReservationCost = reservationCost; + TotalReservationCost = totalReservationCost; + ReservedUnitCount = reservedUnitCount; + Savings = savings; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the cost without reservation. + /// + [JsonProperty(PropertyName = "onDemandCost")] + public double? OnDemandCost { get; private set; } + + /// + /// Gets the difference between total reservation cost and reservation + /// cost. + /// + [JsonProperty(PropertyName = "overageCost")] + public double? OverageCost { get; private set; } + + /// + /// Gets the quantity for calculated savings. + /// + [JsonProperty(PropertyName = "quantity")] + public double? Quantity { get; private set; } + + /// + /// Gets the exact cost of the estimated usage using reservation. + /// + [JsonProperty(PropertyName = "reservationCost")] + public double? ReservationCost { get; private set; } + + /// + /// Gets the cost of the suggested quantity. + /// + [JsonProperty(PropertyName = "totalReservationCost")] + public double? TotalReservationCost { get; private set; } + + /// + /// Gets or sets the number of reserved units used to calculate + /// savings. Always 1 for virtual machines. + /// + [JsonProperty(PropertyName = "reservedUnitCount")] + public double? ReservedUnitCount { get; set; } + + /// + /// Gets the amount saved by purchasing the recommended quantity of + /// reservation. + /// + [JsonProperty(PropertyName = "savings")] + public double? Savings { get; private set; } + + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ReservationRecommendationDetailsModel.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ReservationRecommendationDetailsModel.cs new file mode 100644 index 0000000000000..4a6268f560179 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ReservationRecommendationDetailsModel.cs @@ -0,0 +1,126 @@ +// +// 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; + + /// + /// Reservation recommendation details. + /// + [Rest.Serialization.JsonTransformation] + public partial class ReservationRecommendationDetailsModel : Resource + { + /// + /// Initializes a new instance of the + /// ReservationRecommendationDetailsModel class. + /// + public ReservationRecommendationDetailsModel() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ReservationRecommendationDetailsModel class. + /// + /// The full qualified ARM ID of an event. + /// The ID that uniquely identifies an event. + /// + /// Resource type. + /// The etag for the resource. + /// Resource tags. + /// Resource Location. + /// Resource sku + /// An ISO 4217 currency code identifier for the + /// costs and savings + /// Resource specific properties. + /// Resource Group. + /// Savings information for the + /// recommendation. + /// Scope of the reservation, ex: Single or + /// Shared. + /// Historical usage details used to calculate the + /// estimated savings. + public ReservationRecommendationDetailsModel(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), IDictionary tags = default(IDictionary), string location = default(string), string sku = default(string), string currency = default(string), ReservationRecommendationDetailsResourceProperties resource = default(ReservationRecommendationDetailsResourceProperties), string resourceGroup = default(string), ReservationRecommendationDetailsSavingsProperties savings = default(ReservationRecommendationDetailsSavingsProperties), string scope = default(string), ReservationRecommendationDetailsUsageProperties usage = default(ReservationRecommendationDetailsUsageProperties)) + : base(id, name, type, etag, tags) + { + Location = location; + Sku = sku; + Currency = currency; + Resource = resource; + ResourceGroup = resourceGroup; + Savings = savings; + Scope = scope; + Usage = usage; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource Location. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets resource sku + /// + [JsonProperty(PropertyName = "sku")] + public string Sku { get; set; } + + /// + /// Gets an ISO 4217 currency code identifier for the costs and savings + /// + [JsonProperty(PropertyName = "properties.currency")] + public string Currency { get; private set; } + + /// + /// Gets resource specific properties. + /// + [JsonProperty(PropertyName = "properties.resource")] + public ReservationRecommendationDetailsResourceProperties Resource { get; private set; } + + /// + /// Gets resource Group. + /// + [JsonProperty(PropertyName = "properties.resourceGroup")] + public string ResourceGroup { get; private set; } + + /// + /// Gets savings information for the recommendation. + /// + [JsonProperty(PropertyName = "properties.savings")] + public ReservationRecommendationDetailsSavingsProperties Savings { get; private set; } + + /// + /// Gets scope of the reservation, ex: Single or Shared. + /// + [JsonProperty(PropertyName = "properties.scope")] + public string Scope { get; private set; } + + /// + /// Gets historical usage details used to calculate the estimated + /// savings. + /// + [JsonProperty(PropertyName = "properties.usage")] + public ReservationRecommendationDetailsUsageProperties Usage { get; private set; } + + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ReservationRecommendationDetailsResourceProperties.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ReservationRecommendationDetailsResourceProperties.cs new file mode 100644 index 0000000000000..de7d4fe2d5002 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ReservationRecommendationDetailsResourceProperties.cs @@ -0,0 +1,99 @@ +// +// 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.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Details of the resource. + /// + public partial class ReservationRecommendationDetailsResourceProperties + { + /// + /// Initializes a new instance of the + /// ReservationRecommendationDetailsResourceProperties class. + /// + public ReservationRecommendationDetailsResourceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ReservationRecommendationDetailsResourceProperties class. + /// + /// List of subscriptions for which the + /// reservation is applied. + /// On demand rate of the resource. + /// Azure product ex: Standard_E8s_v3 + /// etc. + /// Azure resource region ex:EastUS, WestUS + /// etc. + /// Reservation rate of the + /// resource. + /// The azure resource type. + public ReservationRecommendationDetailsResourceProperties(IList appliedScopes = default(IList), double? onDemandRate = default(double?), string product = default(string), string region = default(string), double? reservationRate = default(double?), string resourceType = default(string)) + { + AppliedScopes = appliedScopes; + OnDemandRate = onDemandRate; + Product = product; + Region = region; + ReservationRate = reservationRate; + ResourceType = resourceType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets list of subscriptions for which the reservation is applied. + /// + [JsonProperty(PropertyName = "appliedScopes")] + public IList AppliedScopes { get; private set; } + + /// + /// Gets on demand rate of the resource. + /// + [JsonProperty(PropertyName = "onDemandRate")] + public double? OnDemandRate { get; private set; } + + /// + /// Gets azure product ex: Standard_E8s_v3 etc. + /// + [JsonProperty(PropertyName = "product")] + public string Product { get; private set; } + + /// + /// Gets azure resource region ex:EastUS, WestUS etc. + /// + [JsonProperty(PropertyName = "region")] + public string Region { get; private set; } + + /// + /// Gets reservation rate of the resource. + /// + [JsonProperty(PropertyName = "reservationRate")] + public double? ReservationRate { get; private set; } + + /// + /// Gets the azure resource type. + /// + [JsonProperty(PropertyName = "resourceType")] + public string ResourceType { get; private set; } + + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ReservationRecommendationDetailsSavingsProperties.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ReservationRecommendationDetailsSavingsProperties.cs new file mode 100644 index 0000000000000..ea622863e0e96 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ReservationRecommendationDetailsSavingsProperties.cs @@ -0,0 +1,99 @@ +// +// 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.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Details of the estimated savings. + /// + public partial class ReservationRecommendationDetailsSavingsProperties + { + /// + /// Initializes a new instance of the + /// ReservationRecommendationDetailsSavingsProperties class. + /// + public ReservationRecommendationDetailsSavingsProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ReservationRecommendationDetailsSavingsProperties class. + /// + /// List of calculated savings. + /// Number of days of usage to look back + /// used for computing the recommendation. + /// Number of recommended units of + /// the resource. + /// Term period of the reservation, + /// ex: P1Y or P3Y. + /// Type of savings, ex: instance. + /// Measurement unit ex: hour etc. + public ReservationRecommendationDetailsSavingsProperties(IList calculatedSavings = default(IList), int? lookBackPeriod = default(int?), double? recommendedQuantity = default(double?), string reservationOrderTerm = default(string), string savingsType = default(string), string unitOfMeasure = default(string)) + { + CalculatedSavings = calculatedSavings; + LookBackPeriod = lookBackPeriod; + RecommendedQuantity = recommendedQuantity; + ReservationOrderTerm = reservationOrderTerm; + SavingsType = savingsType; + UnitOfMeasure = unitOfMeasure; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of calculated savings. + /// + [JsonProperty(PropertyName = "calculatedSavings")] + public IList CalculatedSavings { get; set; } + + /// + /// Gets number of days of usage to look back used for computing the + /// recommendation. + /// + [JsonProperty(PropertyName = "lookBackPeriod")] + public int? LookBackPeriod { get; private set; } + + /// + /// Gets number of recommended units of the resource. + /// + [JsonProperty(PropertyName = "recommendedQuantity")] + public double? RecommendedQuantity { get; private set; } + + /// + /// Gets term period of the reservation, ex: P1Y or P3Y. + /// + [JsonProperty(PropertyName = "reservationOrderTerm")] + public string ReservationOrderTerm { get; private set; } + + /// + /// Gets type of savings, ex: instance. + /// + [JsonProperty(PropertyName = "savingsType")] + public string SavingsType { get; private set; } + + /// + /// Gets measurement unit ex: hour etc. + /// + [JsonProperty(PropertyName = "unitOfMeasure")] + public string UnitOfMeasure { get; private set; } + + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ReservationRecommendationDetailsUsageProperties.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ReservationRecommendationDetailsUsageProperties.cs new file mode 100644 index 0000000000000..8c03e54915dcb --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ReservationRecommendationDetailsUsageProperties.cs @@ -0,0 +1,100 @@ +// +// 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.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Details about historical usage data that has been used for computing + /// the recommendation. + /// + public partial class ReservationRecommendationDetailsUsageProperties + { + /// + /// Initializes a new instance of the + /// ReservationRecommendationDetailsUsageProperties class. + /// + public ReservationRecommendationDetailsUsageProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ReservationRecommendationDetailsUsageProperties class. + /// + /// The first usage date used for + /// looking back for computing the recommendation. + /// The last usage date used for + /// looking back for computing the recommendation. + /// What the usage data values represent + /// ex: virtual machine instance. + /// The breakdown of historical resource usage. + /// The values are in the order of usage between the + /// firstConsumptionDate and the lastConsumptionDate. + /// The grain of the values represented in the + /// usage data ex: hourly. + public ReservationRecommendationDetailsUsageProperties(string firstConsumptionDate = default(string), string lastConsumptionDate = default(string), string lookBackUnitType = default(string), IList usageData = default(IList), string usageGrain = default(string)) + { + FirstConsumptionDate = firstConsumptionDate; + LastConsumptionDate = lastConsumptionDate; + LookBackUnitType = lookBackUnitType; + UsageData = usageData; + UsageGrain = usageGrain; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the first usage date used for looking back for computing the + /// recommendation. + /// + [JsonProperty(PropertyName = "firstConsumptionDate")] + public string FirstConsumptionDate { get; private set; } + + /// + /// Gets the last usage date used for looking back for computing the + /// recommendation. + /// + [JsonProperty(PropertyName = "lastConsumptionDate")] + public string LastConsumptionDate { get; private set; } + + /// + /// Gets what the usage data values represent ex: virtual machine + /// instance. + /// + [JsonProperty(PropertyName = "lookBackUnitType")] + public string LookBackUnitType { get; private set; } + + /// + /// Gets the breakdown of historical resource usage. The values are in + /// the order of usage between the firstConsumptionDate and the + /// lastConsumptionDate. + /// + [JsonProperty(PropertyName = "usageData")] + public IList UsageData { get; private set; } + + /// + /// Gets the grain of the values represented in the usage data ex: + /// hourly. + /// + [JsonProperty(PropertyName = "usageGrain")] + public string UsageGrain { get; private set; } + + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ReservationSummary.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ReservationSummary.cs index d38076dcb31b0..1ce7a68e5c695 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ReservationSummary.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ReservationSummary.cs @@ -34,9 +34,11 @@ public ReservationSummary() /// /// Initializes a new instance of the ReservationSummary class. /// - /// Resource Id. - /// Resource name. + /// The full qualified ARM ID of an event. + /// The ID that uniquely identifies an event. + /// /// Resource type. + /// The etag for the resource. /// Resource tags. /// The reservation order ID is the /// identifier for a reservation purchase. Each reservation order ID @@ -69,8 +71,19 @@ public ReservationSummary() /// utilization in the usage time (day or month). E.g. if usage record /// corresponds to 12/10/2017 and on that for hour 4 and 5, utilization /// was 100%, this field will return 100% for that day. - public ReservationSummary(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?), decimal? minUtilizationPercentage = default(decimal?), decimal? avgUtilizationPercentage = default(decimal?), decimal? maxUtilizationPercentage = default(decimal?)) - : base(id, name, type, tags) + /// The reservation kind. + /// This is the purchased quantity for + /// the reservationId. + /// This is the remaining quantity for + /// the reservationId. + /// This is the total count of + /// instances that are reserved for the reservationId. + /// This is the used quantity for the + /// reservationId. + /// This is the utilized percentage + /// for the reservation Id. + public ReservationSummary(string id = default(string), string name = default(string), string type = default(string), string etag = 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?), decimal? minUtilizationPercentage = default(decimal?), decimal? avgUtilizationPercentage = default(decimal?), decimal? maxUtilizationPercentage = default(decimal?), string kind = default(string), decimal? purchasedQuantity = default(decimal?), decimal? remainingQuantity = default(decimal?), decimal? totalReservedQuantity = default(decimal?), decimal? usedQuantity = default(decimal?), decimal? utilizedPercentage = default(decimal?)) + : base(id, name, type, etag, tags) { ReservationOrderId = reservationOrderId; ReservationId = reservationId; @@ -81,6 +94,12 @@ public ReservationSummary() MinUtilizationPercentage = minUtilizationPercentage; AvgUtilizationPercentage = avgUtilizationPercentage; MaxUtilizationPercentage = maxUtilizationPercentage; + Kind = kind; + PurchasedQuantity = purchasedQuantity; + RemainingQuantity = remainingQuantity; + TotalReservedQuantity = totalReservedQuantity; + UsedQuantity = usedQuantity; + UtilizedPercentage = utilizedPercentage; CustomInit(); } @@ -161,5 +180,42 @@ public ReservationSummary() [JsonProperty(PropertyName = "properties.maxUtilizationPercentage")] public decimal? MaxUtilizationPercentage { get; private set; } + /// + /// Gets the reservation kind. + /// + [JsonProperty(PropertyName = "properties.kind")] + public string Kind { get; private set; } + + /// + /// Gets this is the purchased quantity for the reservationId. + /// + [JsonProperty(PropertyName = "properties.purchasedQuantity")] + public decimal? PurchasedQuantity { get; private set; } + + /// + /// Gets this is the remaining quantity for the reservationId. + /// + [JsonProperty(PropertyName = "properties.remainingQuantity")] + public decimal? RemainingQuantity { get; private set; } + + /// + /// Gets this is the total count of instances that are reserved for the + /// reservationId. + /// + [JsonProperty(PropertyName = "properties.totalReservedQuantity")] + public decimal? TotalReservedQuantity { get; private set; } + + /// + /// Gets this is the used quantity for the reservationId. + /// + [JsonProperty(PropertyName = "properties.usedQuantity")] + public decimal? UsedQuantity { get; private set; } + + /// + /// Gets this is the utilized percentage for the reservation Id. + /// + [JsonProperty(PropertyName = "properties.utilizedPercentage")] + public decimal? UtilizedPercentage { get; private set; } + } } diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ReservationTransaction.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ReservationTransaction.cs new file mode 100644 index 0000000000000..7dd106329e47d --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ReservationTransaction.cs @@ -0,0 +1,238 @@ +// +// 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; + + /// + /// Reservation transaction resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class ReservationTransaction : ReservationTransactionResource + { + /// + /// Initializes a new instance of the ReservationTransaction class. + /// + public ReservationTransaction() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ReservationTransaction class. + /// + /// Resource Id. + /// Resource name. + /// Resource type. + /// Resource tags. + /// The date of the transaction + /// The reservation order ID is the + /// identifier for a reservation purchase. Each reservation order ID + /// represents a single purchase transaction. A reservation order + /// contains reservations. The reservation order specifies the VM size + /// and region for the reservations. + /// The description of the + /// transaction. + /// The type of the transaction (Purchase, + /// Cancel, etc.) + /// The quantity of the transaction. + /// The charge of the transaction. + /// The ISO currency in which the transaction is + /// charged, for example, USD. + /// The name of the reservation + /// order. + /// The purchasing + /// enrollment. + /// The subscription guid that + /// makes the transaction. + /// The subscription name that + /// makes the transaction. + /// This is the ARM Sku name. It can be used + /// to join with the serviceType field in additional info in usage + /// records. + /// This is the term of the transaction. + /// The region of the transaction. + /// The name of the account that makes the + /// transaction. + /// The email of the account owner that + /// makes the transaction. + /// The department name. + /// The cost center of this department if it + /// is a department and a cost center is provided. + /// The current enrollment. + /// The billing frequency, which can be + /// either one-time or recurring. + public ReservationTransaction(string id = default(string), string name = default(string), string type = default(string), IList tags = default(IList), System.DateTime? eventDate = default(System.DateTime?), string reservationOrderId = default(string), string description = default(string), string eventType = default(string), decimal? quantity = default(decimal?), decimal? amount = default(decimal?), string currency = default(string), string reservationOrderName = default(string), string purchasingEnrollment = default(string), System.Guid? purchasingSubscriptionGuid = default(System.Guid?), string purchasingSubscriptionName = default(string), string armSkuName = default(string), string term = default(string), string region = default(string), string accountName = default(string), string accountOwnerEmail = default(string), string departmentName = default(string), string costCenter = default(string), string currentEnrollment = default(string), string billingFrequency = default(string)) + : base(id, name, type, tags) + { + EventDate = eventDate; + ReservationOrderId = reservationOrderId; + Description = description; + EventType = eventType; + Quantity = quantity; + Amount = amount; + Currency = currency; + ReservationOrderName = reservationOrderName; + PurchasingEnrollment = purchasingEnrollment; + PurchasingSubscriptionGuid = purchasingSubscriptionGuid; + PurchasingSubscriptionName = purchasingSubscriptionName; + ArmSkuName = armSkuName; + Term = term; + Region = region; + AccountName = accountName; + AccountOwnerEmail = accountOwnerEmail; + DepartmentName = departmentName; + CostCenter = costCenter; + CurrentEnrollment = currentEnrollment; + BillingFrequency = billingFrequency; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the date of the transaction + /// + [JsonProperty(PropertyName = "properties.eventDate")] + public System.DateTime? EventDate { get; private set; } + + /// + /// Gets the reservation order ID is the identifier for a reservation + /// purchase. Each reservation order ID represents a single purchase + /// transaction. A reservation order contains reservations. The + /// reservation order specifies the VM size and region for the + /// reservations. + /// + [JsonProperty(PropertyName = "properties.reservationOrderId")] + public string ReservationOrderId { get; private set; } + + /// + /// Gets the description of the transaction. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; private set; } + + /// + /// Gets the type of the transaction (Purchase, Cancel, etc.) + /// + [JsonProperty(PropertyName = "properties.eventType")] + public string EventType { get; private set; } + + /// + /// Gets the quantity of the transaction. + /// + [JsonProperty(PropertyName = "properties.quantity")] + public decimal? Quantity { get; private set; } + + /// + /// Gets the charge of the transaction. + /// + [JsonProperty(PropertyName = "properties.amount")] + public decimal? Amount { get; private set; } + + /// + /// Gets the ISO currency in which the transaction is charged, for + /// example, USD. + /// + [JsonProperty(PropertyName = "properties.currency")] + public string Currency { get; private set; } + + /// + /// Gets the name of the reservation order. + /// + [JsonProperty(PropertyName = "properties.reservationOrderName")] + public string ReservationOrderName { get; private set; } + + /// + /// Gets the purchasing enrollment. + /// + [JsonProperty(PropertyName = "properties.purchasingEnrollment")] + public string PurchasingEnrollment { get; private set; } + + /// + /// Gets the subscription guid that makes the transaction. + /// + [JsonProperty(PropertyName = "properties.purchasingSubscriptionGuid")] + public System.Guid? PurchasingSubscriptionGuid { get; private set; } + + /// + /// Gets the subscription name that makes the transaction. + /// + [JsonProperty(PropertyName = "properties.purchasingSubscriptionName")] + public string PurchasingSubscriptionName { get; private set; } + + /// + /// Gets this is the ARM Sku name. It can be used to join with the + /// serviceType field in additional info in usage records. + /// + [JsonProperty(PropertyName = "properties.armSkuName")] + public string ArmSkuName { get; private set; } + + /// + /// Gets this is the term of the transaction. + /// + [JsonProperty(PropertyName = "properties.term")] + public string Term { get; private set; } + + /// + /// Gets the region of the transaction. + /// + [JsonProperty(PropertyName = "properties.region")] + public string Region { get; private set; } + + /// + /// Gets the name of the account that makes the transaction. + /// + [JsonProperty(PropertyName = "properties.accountName")] + public string AccountName { get; private set; } + + /// + /// Gets the email of the account owner that makes the transaction. + /// + [JsonProperty(PropertyName = "properties.accountOwnerEmail")] + public string AccountOwnerEmail { get; private set; } + + /// + /// Gets the department name. + /// + [JsonProperty(PropertyName = "properties.departmentName")] + public string DepartmentName { get; private set; } + + /// + /// Gets the cost center of this department if it is a department and a + /// cost center is provided. + /// + [JsonProperty(PropertyName = "properties.costCenter")] + public string CostCenter { get; private set; } + + /// + /// Gets the current enrollment. + /// + [JsonProperty(PropertyName = "properties.currentEnrollment")] + public string CurrentEnrollment { get; private set; } + + /// + /// Gets the billing frequency, which can be either one-time or + /// recurring. + /// + [JsonProperty(PropertyName = "properties.billingFrequency")] + public string BillingFrequency { get; private 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/ReservationTransactionResource.cs similarity index 53% rename from sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/UsageDetailsDownloadResponse.cs rename to sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ReservationTransactionResource.cs index 6eda8d43d49c1..b2509a4ba616c 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/UsageDetailsDownloadResponse.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ReservationTransactionResource.cs @@ -11,43 +11,40 @@ namespace Microsoft.Azure.Management.Consumption.Models { using Microsoft.Rest; - using Microsoft.Rest.Serialization; + using Microsoft.Rest.Azure; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; /// - /// Download response of Usage Details. + /// The Resource model definition. /// - [Rest.Serialization.JsonTransformation] - public partial class UsageDetailsDownloadResponse : Resource + public partial class ReservationTransactionResource : IResource { /// - /// Initializes a new instance of the UsageDetailsDownloadResponse + /// Initializes a new instance of the ReservationTransactionResource /// class. /// - public UsageDetailsDownloadResponse() + public ReservationTransactionResource() { CustomInit(); } /// - /// Initializes a new instance of the UsageDetailsDownloadResponse + /// Initializes a new instance of the ReservationTransactionResource /// 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) + public ReservationTransactionResource(string id = default(string), string name = default(string), string type = default(string), IList tags = default(IList)) { - DownloadUrlProperty = downloadUrlProperty; - ValidTill = validTill; + Id = id; + Name = name; + Type = type; + Tags = tags; CustomInit(); } @@ -57,16 +54,28 @@ public UsageDetailsDownloadResponse() partial void CustomInit(); /// - /// Gets the URL to the csv file. + /// Gets resource Id. /// - [JsonProperty(PropertyName = "properties.downloadUrl")] - public string DownloadUrlProperty { get; private set; } + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } /// - /// Gets the time in UTC at which this download URL will expire. + /// Gets resource name. /// - [JsonProperty(PropertyName = "properties.validTill")] - public string ValidTill { get; private set; } + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IList Tags { get; private set; } } } diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Resource.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Resource.cs index 7d8bdfb8f086a..e45d248d1e088 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Resource.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Resource.cs @@ -33,15 +33,18 @@ public Resource() /// /// Initializes a new instance of the Resource class. /// - /// Resource Id. - /// Resource name. + /// The full qualified ARM ID of an event. + /// The ID that uniquely identifies an event. + /// /// Resource type. + /// The etag for the resource. /// Resource tags. - public Resource(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary)) + public Resource(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), IDictionary tags = default(IDictionary)) { Id = id; Name = name; Type = type; + Etag = etag; Tags = tags; CustomInit(); } @@ -52,13 +55,13 @@ public Resource() partial void CustomInit(); /// - /// Gets resource Id. + /// Gets the full qualified ARM ID of an event. /// [JsonProperty(PropertyName = "id")] public string Id { get; private set; } /// - /// Gets resource name. + /// Gets the ID that uniquely identifies an event. /// [JsonProperty(PropertyName = "name")] public string Name { get; private set; } @@ -69,6 +72,12 @@ public Resource() [JsonProperty(PropertyName = "type")] public string Type { get; private set; } + /// + /// Gets the etag for the resource. + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; private set; } + /// /// Gets resource tags. /// diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/CategoryType.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Scope10.cs similarity index 73% rename from sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/CategoryType.cs rename to sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Scope10.cs index 90ec91af4a81d..e534bbc5852bf 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/CategoryType.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Scope10.cs @@ -12,11 +12,11 @@ namespace Microsoft.Azure.Management.Consumption.Models { /// - /// Defines values for CategoryType. + /// Defines values for Scope10. /// - public static class CategoryType + public static class Scope10 { - public const string Cost = "Cost"; - public const string Usage = "Usage"; + public const string Single = "Single"; + public const string Shared = "Shared"; } } diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Scope12.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Scope12.cs new file mode 100644 index 0000000000000..eb03b6af0f9bf --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Scope12.cs @@ -0,0 +1,22 @@ +// +// 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 +{ + + /// + /// Defines values for Scope12. + /// + public static class Scope12 + { + public const string Single = "Single"; + public const string Shared = "Shared"; + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/SkuProperty.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/SkuProperty.cs new file mode 100644 index 0000000000000..f2f332a69b9b1 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/SkuProperty.cs @@ -0,0 +1,59 @@ +// +// 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; + + /// + /// The Sku property + /// + public partial class SkuProperty + { + /// + /// Initializes a new instance of the SkuProperty class. + /// + public SkuProperty() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SkuProperty class. + /// + /// The name of sku property. + /// The value of sku property. + public SkuProperty(string name = default(string), string value = default(string)) + { + Name = name; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the name of sku property. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the value of sku property. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; private set; } + + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Status.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Status.cs new file mode 100644 index 0000000000000..cd035c92a7eca --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Status.cs @@ -0,0 +1,26 @@ +// +// 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 +{ + + /// + /// Defines values for Status. + /// + public static class Status + { + public const string None = "None"; + public const string Active = "Active"; + public const string Inactive = "Inactive"; + public const string Expired = "Expired"; + public const string Complete = "Complete"; + public const string Canceled = "Canceled"; + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Tag.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Tag.cs index ea212513c0396..15a3774ad5ea5 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Tag.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Tag.cs @@ -11,6 +11,8 @@ namespace Microsoft.Azure.Management.Consumption.Models { using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// @@ -30,9 +32,11 @@ public Tag() /// Initializes a new instance of the Tag class. /// /// Tag key. - public Tag(string key = default(string)) + /// Tag values. + public Tag(string key = default(string), IList value = default(IList)) { Key = key; + Value = value; CustomInit(); } @@ -47,5 +51,11 @@ public Tag() [JsonProperty(PropertyName = "key")] public string Key { get; set; } + /// + /// Gets or sets tag values. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + } } diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/TagsResult.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/TagsResult.cs index 85d682f027081..77e1a3f3273d0 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/TagsResult.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/TagsResult.cs @@ -41,10 +41,16 @@ public TagsResult() /// update scenario, this field will be used to determine whether the /// user is updating the latest version or not. /// A list of Tag. - public TagsResult(string id = default(string), string name = default(string), string type = default(string), string eTag = default(string), IList tags = default(IList)) + /// The link (url) to the next page of + /// results. + /// The link (url) to the previous page of + /// results. + public TagsResult(string id = default(string), string name = default(string), string type = default(string), string eTag = default(string), IList tags = default(IList), string nextLink = default(string), string previousLink = default(string)) : base(id, name, type, eTag) { Tags = tags; + NextLink = nextLink; + PreviousLink = previousLink; CustomInit(); } @@ -59,5 +65,17 @@ public TagsResult() [JsonProperty(PropertyName = "properties.tags")] public IList Tags { get; set; } + /// + /// Gets the link (url) to the next page of results. + /// + [JsonProperty(PropertyName = "properties.nextLink")] + public string NextLink { get; private set; } + + /// + /// Gets the link (url) to the previous page of results. + /// + [JsonProperty(PropertyName = "properties.previousLink")] + public string PreviousLink { get; private set; } + } } diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Term.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Term.cs new file mode 100644 index 0000000000000..a2138690fbe79 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Term.cs @@ -0,0 +1,28 @@ +// +// 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 +{ + + /// + /// Defines values for Term. + /// + public static class Term + { + /// + /// 1 year reservation term + /// + public const string P1Y = "P1Y"; + /// + /// 3 year reservation term + /// + public const string P3Y = "P3Y"; + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ThresholdType.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ThresholdType.cs new file mode 100644 index 0000000000000..cf74fe6ae69b6 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ThresholdType.cs @@ -0,0 +1,21 @@ +// +// 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 +{ + + /// + /// Defines values for ThresholdType. + /// + public static class ThresholdType + { + public const string Actual = "Actual"; + } +} 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/UsageDetail.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/UsageDetail.cs index 8ff10325964c9..11a7b5d164843 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/UsageDetail.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/UsageDetail.cs @@ -10,9 +10,6 @@ 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; @@ -20,7 +17,6 @@ namespace Microsoft.Azure.Management.Consumption.Models /// /// An usage detail resource. /// - [Rest.Serialization.JsonTransformation] public partial class UsageDetail : Resource { /// @@ -34,132 +30,15 @@ public UsageDetail() /// /// Initializes a new instance of the UsageDetail class. /// - /// Resource Id. - /// Resource name. + /// The full qualified ARM ID of an event. + /// The ID that uniquely identifies an event. + /// /// Resource type. + /// The etag for the resource. /// Resource tags. - /// Billing Account identifier. - /// Billing Account Name. - /// The billing period start - /// date. - /// The billing period end - /// date. - /// Billing Profile identifier. - /// Billing Profile Name. - /// Account Owner Id. - /// Account Name. - /// Subscription guid. - /// Subscription name. - /// Date for the usage record. - /// Product name for the consumed service or - /// purchase. Not available for Marketplace. - /// Part Number of the service used. Can be - /// used to join with the price sheet. Not available for - /// marketplace. - /// The meter id (GUID). Not available for - /// marketplace. For reserved instance this represents the primary - /// meter for which the reservation was purchased. For the actual VM - /// Size for which the reservation is purchased see - /// productOrderName. - /// The details about the meter. By default - /// this is not populated, unless it's specified in $expand. - /// The usage quantity. - /// Effective Price that’s charged for the - /// usage. - /// The amount of cost before tax. - /// Unit Price is the price applicable to you. - /// (your EA or other contract price). - /// Billing Currency. - /// Resource Location. - /// Consumed service name. Name of the - /// azure resource provider that emits the usage or was purchased. This - /// value is not provided for marketplace usage. - /// Azure resource manager resource - /// identifier. - /// Resource Name. - /// Service Info 1. - /// Service Info 2. - /// Additional details of this usage item. - /// By default this is not populated, unless it's specified in $expand. - /// Use this field to get usage line item specific details such as the - /// actual VM Size (ServiceType) or the ratio in which the reservation - /// discount is applied. - /// Invoice Section Name. - /// The cost center of this department if it - /// is a department and a cost center is provided. - /// Resource Group Name. - /// ARM resource id of the reservation. - /// Only applies to records relevant to reservations. - /// User provided display name of the - /// reservation. Last known name for a particular day is populated in - /// the daily data. Only applies to records relevant to - /// reservations. - /// Product Order Id. For reservations - /// this is the Reservation Order ID. - /// Product Order Name. For reservations - /// this is the SKU that was purchased. - /// Offer Id. Ex: MS-AZR-0017P, - /// MS-AZR-0148P. - /// Is Azure Credit - /// Eligible. - /// Term (in months). 1 month for monthly recurring - /// purchase. 12 months for a 1 year reservation. 36 months for a 3 - /// year reservation. - /// Publisher Name. - /// Publisher Type. - /// Plan Name. - /// Indicates a charge represents credits, - /// usage, a Marketplace purchase, a reservation fee, or a - /// refund. - /// Indicates how frequently this charge will - /// occur. OneTime for purchases which only happen once, Monthly for - /// fees which recur every month, and UsageBased for charges based on - /// how much a service is used. - public UsageDetail(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string billingAccountId = default(string), string billingAccountName = default(string), System.DateTime? billingPeriodStartDate = default(System.DateTime?), System.DateTime? billingPeriodEndDate = default(System.DateTime?), string billingProfileId = default(string), string billingProfileName = default(string), string accountOwnerId = default(string), string accountName = default(string), string subscriptionId = default(string), string subscriptionName = default(string), System.DateTime? date = default(System.DateTime?), string product = default(string), string partNumber = default(string), System.Guid? meterId = default(System.Guid?), MeterDetailsResponse meterDetails = default(MeterDetailsResponse), decimal? quantity = default(decimal?), decimal? effectivePrice = default(decimal?), decimal? cost = default(decimal?), decimal? unitPrice = default(decimal?), string billingCurrency = default(string), string resourceLocation = default(string), string consumedService = default(string), string resourceId = default(string), string resourceName = default(string), string serviceInfo1 = default(string), string serviceInfo2 = default(string), string additionalInfo = default(string), string invoiceSection = default(string), string costCenter = default(string), string resourceGroup = default(string), string reservationId = default(string), string reservationName = default(string), string productOrderId = default(string), string productOrderName = default(string), string offerId = default(string), bool? isAzureCreditEligible = default(bool?), string term = default(string), string publisherName = default(string), string publisherType = default(string), string planName = default(string), string chargeType = default(string), string frequency = default(string)) - : base(id, name, type, tags) + public UsageDetail(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), IDictionary tags = default(IDictionary)) + : base(id, name, type, etag, tags) { - BillingAccountId = billingAccountId; - BillingAccountName = billingAccountName; - BillingPeriodStartDate = billingPeriodStartDate; - BillingPeriodEndDate = billingPeriodEndDate; - BillingProfileId = billingProfileId; - BillingProfileName = billingProfileName; - AccountOwnerId = accountOwnerId; - AccountName = accountName; - SubscriptionId = subscriptionId; - SubscriptionName = subscriptionName; - Date = date; - Product = product; - PartNumber = partNumber; - MeterId = meterId; - MeterDetails = meterDetails; - Quantity = quantity; - EffectivePrice = effectivePrice; - Cost = cost; - UnitPrice = unitPrice; - BillingCurrency = billingCurrency; - ResourceLocation = resourceLocation; - ConsumedService = consumedService; - ResourceId = resourceId; - ResourceName = resourceName; - ServiceInfo1 = serviceInfo1; - ServiceInfo2 = serviceInfo2; - AdditionalInfo = additionalInfo; - InvoiceSection = invoiceSection; - CostCenter = costCenter; - ResourceGroup = resourceGroup; - ReservationId = reservationId; - ReservationName = reservationName; - ProductOrderId = productOrderId; - ProductOrderName = productOrderName; - OfferId = offerId; - IsAzureCreditEligible = isAzureCreditEligible; - Term = term; - PublisherName = publisherName; - PublisherType = publisherType; - PlanName = planName; - ChargeType = chargeType; - Frequency = frequency; CustomInit(); } @@ -168,282 +47,5 @@ public UsageDetail() /// partial void CustomInit(); - /// - /// Gets billing Account identifier. - /// - [JsonProperty(PropertyName = "properties.billingAccountId")] - public string BillingAccountId { get; private set; } - - /// - /// Gets billing Account Name. - /// - [JsonProperty(PropertyName = "properties.billingAccountName")] - public string BillingAccountName { get; private set; } - - /// - /// Gets the billing period start date. - /// - [JsonProperty(PropertyName = "properties.billingPeriodStartDate")] - public System.DateTime? BillingPeriodStartDate { get; private set; } - - /// - /// Gets the billing period end date. - /// - [JsonProperty(PropertyName = "properties.billingPeriodEndDate")] - public System.DateTime? BillingPeriodEndDate { get; private set; } - - /// - /// Gets billing Profile identifier. - /// - [JsonProperty(PropertyName = "properties.billingProfileId")] - public string BillingProfileId { get; private set; } - - /// - /// Gets billing Profile Name. - /// - [JsonProperty(PropertyName = "properties.billingProfileName")] - public string BillingProfileName { get; private set; } - - /// - /// Gets account Owner Id. - /// - [JsonProperty(PropertyName = "properties.accountOwnerId")] - public string AccountOwnerId { get; private set; } - - /// - /// Gets account Name. - /// - [JsonProperty(PropertyName = "properties.accountName")] - public string AccountName { get; private set; } - - /// - /// Gets subscription guid. - /// - [JsonProperty(PropertyName = "properties.subscriptionId")] - public string SubscriptionId { get; private set; } - - /// - /// Gets subscription name. - /// - [JsonProperty(PropertyName = "properties.subscriptionName")] - public string SubscriptionName { get; private set; } - - /// - /// Gets date for the usage record. - /// - [JsonProperty(PropertyName = "properties.date")] - public System.DateTime? Date { get; private set; } - - /// - /// Gets product name for the consumed service or purchase. Not - /// available for Marketplace. - /// - [JsonProperty(PropertyName = "properties.product")] - public string Product { get; private set; } - - /// - /// Gets part Number of the service used. Can be used to join with the - /// price sheet. Not available for marketplace. - /// - [JsonProperty(PropertyName = "properties.partNumber")] - public string PartNumber { get; private set; } - - /// - /// Gets the meter id (GUID). Not available for marketplace. For - /// reserved instance this represents the primary meter for which the - /// reservation was purchased. For the actual VM Size for which the - /// reservation is purchased see productOrderName. - /// - [JsonProperty(PropertyName = "properties.meterId")] - public System.Guid? MeterId { get; private set; } - - /// - /// Gets the details about the meter. By default this is not populated, - /// unless it's specified in $expand. - /// - [JsonProperty(PropertyName = "properties.meterDetails")] - public MeterDetailsResponse MeterDetails { get; private set; } - - /// - /// Gets the usage quantity. - /// - [JsonProperty(PropertyName = "properties.quantity")] - public decimal? Quantity { get; private set; } - - /// - /// Gets effective Price that’s charged for the usage. - /// - [JsonProperty(PropertyName = "properties.effectivePrice")] - public decimal? EffectivePrice { get; private set; } - - /// - /// Gets the amount of cost before tax. - /// - [JsonProperty(PropertyName = "properties.cost")] - public decimal? Cost { get; private set; } - - /// - /// Gets unit Price is the price applicable to you. (your EA or other - /// contract price). - /// - [JsonProperty(PropertyName = "properties.unitPrice")] - public decimal? UnitPrice { get; private set; } - - /// - /// Gets billing Currency. - /// - [JsonProperty(PropertyName = "properties.billingCurrency")] - public string BillingCurrency { get; private set; } - - /// - /// Gets resource Location. - /// - [JsonProperty(PropertyName = "properties.resourceLocation")] - public string ResourceLocation { get; private set; } - - /// - /// Gets consumed service name. Name of the azure resource provider - /// that emits the usage or was purchased. This value is not provided - /// for marketplace usage. - /// - [JsonProperty(PropertyName = "properties.consumedService")] - public string ConsumedService { get; private set; } - - /// - /// Gets azure resource manager resource identifier. - /// - [JsonProperty(PropertyName = "properties.resourceId")] - public string ResourceId { get; private set; } - - /// - /// Gets resource Name. - /// - [JsonProperty(PropertyName = "properties.resourceName")] - public string ResourceName { get; private set; } - - /// - /// Gets service Info 1. - /// - [JsonProperty(PropertyName = "properties.serviceInfo1")] - public string ServiceInfo1 { get; private set; } - - /// - /// Gets service Info 2. - /// - [JsonProperty(PropertyName = "properties.serviceInfo2")] - public string ServiceInfo2 { get; private set; } - - /// - /// Gets additional details of this usage item. By default this is not - /// populated, unless it's specified in $expand. Use this field to get - /// usage line item specific details such as the actual VM Size - /// (ServiceType) or the ratio in which the reservation discount is - /// applied. - /// - [JsonProperty(PropertyName = "properties.additionalInfo")] - public string AdditionalInfo { get; private set; } - - /// - /// Gets invoice Section Name. - /// - [JsonProperty(PropertyName = "properties.invoiceSection")] - public string InvoiceSection { get; private set; } - - /// - /// Gets the cost center of this department if it is a department and a - /// cost center is provided. - /// - [JsonProperty(PropertyName = "properties.costCenter")] - public string CostCenter { get; private set; } - - /// - /// Gets resource Group Name. - /// - [JsonProperty(PropertyName = "properties.resourceGroup")] - public string ResourceGroup { get; private set; } - - /// - /// Gets ARM resource id of the reservation. Only applies to records - /// relevant to reservations. - /// - [JsonProperty(PropertyName = "properties.reservationId")] - public string ReservationId { get; private set; } - - /// - /// Gets user provided display name of the reservation. Last known name - /// for a particular day is populated in the daily data. Only applies - /// to records relevant to reservations. - /// - [JsonProperty(PropertyName = "properties.reservationName")] - public string ReservationName { get; private set; } - - /// - /// Gets product Order Id. For reservations this is the Reservation - /// Order ID. - /// - [JsonProperty(PropertyName = "properties.productOrderId")] - public string ProductOrderId { get; private set; } - - /// - /// Gets product Order Name. For reservations this is the SKU that was - /// purchased. - /// - [JsonProperty(PropertyName = "properties.productOrderName")] - public string ProductOrderName { get; private set; } - - /// - /// Gets offer Id. Ex: MS-AZR-0017P, MS-AZR-0148P. - /// - [JsonProperty(PropertyName = "properties.offerId")] - public string OfferId { get; private set; } - - /// - /// Gets is Azure Credit Eligible. - /// - [JsonProperty(PropertyName = "properties.isAzureCreditEligible")] - public bool? IsAzureCreditEligible { get; private set; } - - /// - /// Gets term (in months). 1 month for monthly recurring purchase. 12 - /// months for a 1 year reservation. 36 months for a 3 year - /// reservation. - /// - [JsonProperty(PropertyName = "properties.term")] - public string Term { get; private set; } - - /// - /// Gets publisher Name. - /// - [JsonProperty(PropertyName = "properties.publisherName")] - public string PublisherName { get; private set; } - - /// - /// Gets publisher Type. - /// - [JsonProperty(PropertyName = "properties.publisherType")] - public string PublisherType { get; private set; } - - /// - /// Gets plan Name. - /// - [JsonProperty(PropertyName = "properties.planName")] - public string PlanName { get; private set; } - - /// - /// Gets indicates a charge represents credits, usage, a Marketplace - /// purchase, a reservation fee, or a refund. - /// - [JsonProperty(PropertyName = "properties.chargeType")] - public string ChargeType { get; private set; } - - /// - /// Gets indicates how frequently this charge will occur. OneTime for - /// purchases which only happen once, Monthly for fees which recur - /// every month, and UsageBased for charges based on how much a service - /// is used. - /// - [JsonProperty(PropertyName = "properties.frequency")] - public string Frequency { get; private set; } - } } 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/PriceSheetOperations.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/PriceSheetOperations.cs index aed615d8df842..b04f610fd6722 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/PriceSheetOperations.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/PriceSheetOperations.cs @@ -51,8 +51,8 @@ internal PriceSheetOperations(ConsumptionManagementClient client) public ConsumptionManagementClient Client { get; private set; } /// - /// Gets the price sheet for a scope by subscriptionId. Price sheet is - /// available via this API only for May 1, 2014 or later. + /// Gets the price sheet for a subscription. Price sheet is available via this + /// API only for May 1, 2014 or later. /// /// /// diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/PriceSheetOperationsExtensions.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/PriceSheetOperationsExtensions.cs index d4815b9f87a89..71d190495a461 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/PriceSheetOperationsExtensions.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/PriceSheetOperationsExtensions.cs @@ -22,8 +22,8 @@ namespace Microsoft.Azure.Management.Consumption public static partial class PriceSheetOperationsExtensions { /// - /// Gets the price sheet for a scope by subscriptionId. Price sheet is - /// available via this API only for May 1, 2014 or later. + /// Gets the price sheet for a subscription. Price sheet is available via this + /// API only for May 1, 2014 or later. /// /// /// @@ -48,8 +48,8 @@ public static partial class PriceSheetOperationsExtensions } /// - /// Gets the price sheet for a scope by subscriptionId. Price sheet is - /// available via this API only for May 1, 2014 or later. + /// Gets the price sheet for a subscription. Price sheet is available via this + /// API only for May 1, 2014 or later. /// /// /// diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationRecommendationDetailsOperations.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationRecommendationDetailsOperations.cs new file mode 100644 index 0000000000000..bdf7ef73ebbc2 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationRecommendationDetailsOperations.cs @@ -0,0 +1,304 @@ +// +// 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 +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ReservationRecommendationDetailsOperations operations. + /// + internal partial class ReservationRecommendationDetailsOperations : IServiceOperations, IReservationRecommendationDetailsOperations + { + /// + /// Initializes a new instance of the ReservationRecommendationDetailsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ReservationRecommendationDetailsOperations(ConsumptionManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ConsumptionManagementClient + /// + public ConsumptionManagementClient Client { get; private set; } + + /// + /// Details of a reservation recommendation for what-if analysis of reserved + /// instances. + /// + /// + /// + /// The scope associated with reservation recommendation details operations. + /// This includes '/subscriptions/{subscriptionId}/' for subscription scope, + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resource group scope, + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// BillingAccount scope, and + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope + /// + /// + /// Scope of the reservation. Possible values include: 'Single', 'Shared' + /// + /// + /// Used to select the region the recommendation should be generated for. + /// + /// + /// Specify length of reservation recommendation term. Possible values include: + /// 'P1Y', 'P3Y' + /// + /// + /// Filter the time period on which reservation recommendation results are + /// based. Possible values include: 'Last07Days', 'Last30Days', 'Last60Days' + /// + /// + /// Filter the products for which reservation recommendation results are + /// generated. Examples: Standard_DS1_v2 (for VM), + /// Premium_SSD_Managed_Disks_P30 (for Managed Disks) + /// + /// + /// 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> GetWithHttpMessagesAsync(string scope, string scope1, string region, string term, string lookBackPeriod, string product, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (scope1 == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope1"); + } + if (region == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "region"); + } + if (term == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "term"); + } + if (lookBackPeriod == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "lookBackPeriod"); + } + if (product == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "product"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("scope", scope); + tracingParameters.Add("scope1", scope1); + tracingParameters.Add("region", region); + tracingParameters.Add("term", term); + tracingParameters.Add("lookBackPeriod", lookBackPeriod); + tracingParameters.Add("product", product); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Consumption/reservationRecommendationDetails").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 (scope1 != null) + { + _queryParameters.Add(string.Format("scope={0}", System.Uri.EscapeDataString(scope1))); + } + if (region != null) + { + _queryParameters.Add(string.Format("region={0}", System.Uri.EscapeDataString(region))); + } + if (term != null) + { + _queryParameters.Add(string.Format("term={0}", System.Uri.EscapeDataString(term))); + } + if (lookBackPeriod != null) + { + _queryParameters.Add(string.Format("lookBackPeriod={0}", System.Uri.EscapeDataString(lookBackPeriod))); + } + if (product != null) + { + _queryParameters.Add(string.Format("product={0}", System.Uri.EscapeDataString(product))); + } + 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 && (int)_statusCode != 204) + { + var ex = new HighCasedErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + HighCasedErrorResponse _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; + } + + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationRecommendationDetailsOperationsExtensions.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationRecommendationDetailsOperationsExtensions.cs new file mode 100644 index 0000000000000..0a247a75d4a59 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationRecommendationDetailsOperationsExtensions.cs @@ -0,0 +1,115 @@ +// +// 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 +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ReservationRecommendationDetailsOperations. + /// + public static partial class ReservationRecommendationDetailsOperationsExtensions + { + /// + /// Details of a reservation recommendation for what-if analysis of reserved + /// instances. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with reservation recommendation details operations. + /// This includes '/subscriptions/{subscriptionId}/' for subscription scope, + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resource group scope, + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// BillingAccount scope, and + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope + /// + /// + /// Scope of the reservation. Possible values include: 'Single', 'Shared' + /// + /// + /// Used to select the region the recommendation should be generated for. + /// + /// + /// Specify length of reservation recommendation term. Possible values include: + /// 'P1Y', 'P3Y' + /// + /// + /// Filter the time period on which reservation recommendation results are + /// based. Possible values include: 'Last07Days', 'Last30Days', 'Last60Days' + /// + /// + /// Filter the products for which reservation recommendation results are + /// generated. Examples: Standard_DS1_v2 (for VM), + /// Premium_SSD_Managed_Disks_P30 (for Managed Disks) + /// + public static ReservationRecommendationDetailsModel Get(this IReservationRecommendationDetailsOperations operations, string scope, string scope1, string region, string term, string lookBackPeriod, string product) + { + return operations.GetAsync(scope, scope1, region, term, lookBackPeriod, product).GetAwaiter().GetResult(); + } + + /// + /// Details of a reservation recommendation for what-if analysis of reserved + /// instances. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with reservation recommendation details operations. + /// This includes '/subscriptions/{subscriptionId}/' for subscription scope, + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resource group scope, + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// BillingAccount scope, and + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope + /// + /// + /// Scope of the reservation. Possible values include: 'Single', 'Shared' + /// + /// + /// Used to select the region the recommendation should be generated for. + /// + /// + /// Specify length of reservation recommendation term. Possible values include: + /// 'P1Y', 'P3Y' + /// + /// + /// Filter the time period on which reservation recommendation results are + /// based. Possible values include: 'Last07Days', 'Last30Days', 'Last60Days' + /// + /// + /// Filter the products for which reservation recommendation results are + /// generated. Examples: Standard_DS1_v2 (for VM), + /// Premium_SSD_Managed_Disks_P30 (for Managed Disks) + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IReservationRecommendationDetailsOperations operations, string scope, string scope1, string region, string term, string lookBackPeriod, string product, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(scope, scope1, region, term, lookBackPeriod, product, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} 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..354a4686fdcc3 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationRecommendationsOperations.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationRecommendationsOperations.cs @@ -54,9 +54,25 @@ internal ReservationRecommendationsOperations(ConsumptionManagementClient client /// List of recommendations for purchasing reserved instances. /// /// + /// + /// The scope associated with reservation recommendations operations. This + /// includes '/subscriptions/{subscriptionId}/' for subscription scope, + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resource group scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// BillingAccount scope, and + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope + /// /// - /// May be used to filter reservationRecommendations by properties/scope and - /// properties/lookBackPeriod. + /// May be used to filter reservationRecommendations by: properties/scope with + /// allowed values ['Single', 'Shared'] and default value 'Single'; + /// properties/resourceType with allowed values ['VirtualMachines', + /// 'SQLDatabases', 'PostgreSQL', 'ManagedDisk', 'MySQL', 'RedHat', 'MariaDB', + /// 'RedisCache', 'CosmosDB', 'SqlDataWarehouse', 'SUSELinux', 'AppService', + /// 'BlockBlob', 'AzureDataExplorer', 'VMwareCloudSimple'] and default value + /// 'VirtualMachines'; and properties/lookBackPeriod with allowed values + /// ['Last7Days', 'Last30Days', 'Last60Days'] and default value 'Last7Days'. /// /// /// Headers that will be added to request. @@ -79,15 +95,15 @@ internal ReservationRecommendationsOperations(ConsumptionManagementClient client /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(string scope, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - if (Client.SubscriptionId == null) + if (scope == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -97,13 +113,14 @@ internal ReservationRecommendationsOperations(ConsumptionManagementClient client _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("filter", filter); + tracingParameters.Add("scope", scope); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Consumption/reservationRecommendations").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Consumption/reservationRecommendations").ToString(); + _url = _url.Replace("{scope}", scope); List _queryParameters = new List(); if (filter != null) { @@ -171,7 +188,7 @@ internal ReservationRecommendationsOperations(ConsumptionManagementClient client HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 204) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -340,7 +357,7 @@ internal ReservationRecommendationsOperations(ConsumptionManagementClient client HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 204) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try 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..e29e258f49359 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationRecommendationsOperationsExtensions.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationRecommendationsOperationsExtensions.cs @@ -28,13 +28,29 @@ public static partial class ReservationRecommendationsOperationsExtensions /// /// The operations group for this extension method. /// + /// + /// The scope associated with reservation recommendations operations. This + /// includes '/subscriptions/{subscriptionId}/' for subscription scope, + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resource group scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// BillingAccount scope, and + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope + /// /// - /// May be used to filter reservationRecommendations by properties/scope and - /// properties/lookBackPeriod. + /// May be used to filter reservationRecommendations by: properties/scope with + /// allowed values ['Single', 'Shared'] and default value 'Single'; + /// properties/resourceType with allowed values ['VirtualMachines', + /// 'SQLDatabases', 'PostgreSQL', 'ManagedDisk', 'MySQL', 'RedHat', 'MariaDB', + /// 'RedisCache', 'CosmosDB', 'SqlDataWarehouse', 'SUSELinux', 'AppService', + /// 'BlockBlob', 'AzureDataExplorer', 'VMwareCloudSimple'] and default value + /// 'VirtualMachines'; and properties/lookBackPeriod with allowed values + /// ['Last7Days', 'Last30Days', 'Last60Days'] and default value 'Last7Days'. /// - public static IPage List(this IReservationRecommendationsOperations operations, string filter = default(string)) + public static IPage List(this IReservationRecommendationsOperations operations, string scope, string filter = default(string)) { - return operations.ListAsync(filter).GetAwaiter().GetResult(); + return operations.ListAsync(scope, filter).GetAwaiter().GetResult(); } /// @@ -44,16 +60,32 @@ public static partial class ReservationRecommendationsOperationsExtensions /// /// The operations group for this extension method. /// + /// + /// The scope associated with reservation recommendations operations. This + /// includes '/subscriptions/{subscriptionId}/' for subscription scope, + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for + /// resource group scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// BillingAccount scope, and + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope + /// /// - /// May be used to filter reservationRecommendations by properties/scope and - /// properties/lookBackPeriod. + /// May be used to filter reservationRecommendations by: properties/scope with + /// allowed values ['Single', 'Shared'] and default value 'Single'; + /// properties/resourceType with allowed values ['VirtualMachines', + /// 'SQLDatabases', 'PostgreSQL', 'ManagedDisk', 'MySQL', 'RedHat', 'MariaDB', + /// 'RedisCache', 'CosmosDB', 'SqlDataWarehouse', 'SUSELinux', 'AppService', + /// 'BlockBlob', 'AzureDataExplorer', 'VMwareCloudSimple'] and default value + /// 'VirtualMachines'; and properties/lookBackPeriod with allowed values + /// ['Last7Days', 'Last30Days', 'Last60Days'] and default value 'Last7Days'. /// /// /// The cancellation token. /// - public static async Task> ListAsync(this IReservationRecommendationsOperations operations, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this IReservationRecommendationsOperations operations, string scope, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListWithHttpMessagesAsync(filter, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListWithHttpMessagesAsync(scope, filter, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationTransactionsOperations.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationTransactionsOperations.cs new file mode 100644 index 0000000000000..b74baa9b0cc56 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationTransactionsOperations.cs @@ -0,0 +1,775 @@ +// +// 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 +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ReservationTransactionsOperations operations. + /// + internal partial class ReservationTransactionsOperations : IServiceOperations, IReservationTransactionsOperations + { + /// + /// Initializes a new instance of the ReservationTransactionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ReservationTransactionsOperations(ConsumptionManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ConsumptionManagementClient + /// + public ConsumptionManagementClient Client { get; private set; } + + /// + /// List of transactions for reserved instances on billing account scope + /// + /// + /// + /// BillingAccount ID + /// + /// + /// Filter reservation transactions by date range. The properties/EventDate 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>> ListWithHttpMessagesAsync(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, "List", 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/reservationTransactions").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 transactions for reserved instances on billing account scope + /// + /// + /// + /// BillingAccount ID + /// + /// + /// Azure Billing Profile ID. + /// + /// + /// Filter reservation transactions by date range. The properties/EventDate 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>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountId, string billingProfileId, 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"); + } + if (billingProfileId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileId"); + } + // 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("billingProfileId", billingProfileId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.Consumption/reservationTransactions").ToString(); + _url = _url.Replace("{billingAccountId}", System.Uri.EscapeDataString(billingAccountId)); + _url = _url.Replace("{billingProfileId}", System.Uri.EscapeDataString(billingProfileId)); + 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 transactions for 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>> ListNextWithHttpMessagesAsync(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, "ListNext", 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) + { + 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 transactions for 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>> ListByBillingProfileNextWithHttpMessagesAsync(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, "ListByBillingProfileNext", 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) + { + 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; + } + + } +} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationTransactionsOperationsExtensions.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationTransactionsOperationsExtensions.cs new file mode 100644 index 0000000000000..113f9fe45ce63 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationTransactionsOperationsExtensions.cs @@ -0,0 +1,191 @@ +// +// 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 +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ReservationTransactionsOperations. + /// + public static partial class ReservationTransactionsOperationsExtensions + { + /// + /// List of transactions for reserved instances on billing account scope + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// BillingAccount ID + /// + /// + /// Filter reservation transactions by date range. The properties/EventDate for + /// start date and end date. The filter supports 'le' and 'ge' + /// + public static IPage List(this IReservationTransactionsOperations operations, string billingAccountId, string filter = default(string)) + { + return operations.ListAsync(billingAccountId, filter).GetAwaiter().GetResult(); + } + + /// + /// List of transactions for reserved instances on billing account scope + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// BillingAccount ID + /// + /// + /// Filter reservation transactions by date range. The properties/EventDate for + /// start date and end date. The filter supports 'le' and 'ge' + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IReservationTransactionsOperations operations, string billingAccountId, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(billingAccountId, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List of transactions for reserved instances on billing account scope + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// BillingAccount ID + /// + /// + /// Azure Billing Profile ID. + /// + /// + /// Filter reservation transactions by date range. The properties/EventDate for + /// start date and end date. The filter supports 'le' and 'ge' + /// + public static IPage ListByBillingProfile(this IReservationTransactionsOperations operations, string billingAccountId, string billingProfileId, string filter = default(string)) + { + return operations.ListByBillingProfileAsync(billingAccountId, billingProfileId, filter).GetAwaiter().GetResult(); + } + + /// + /// List of transactions for reserved instances on billing account scope + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// BillingAccount ID + /// + /// + /// Azure Billing Profile ID. + /// + /// + /// Filter reservation transactions by date range. The properties/EventDate for + /// start date and end date. The filter supports 'le' and 'ge' + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingProfileAsync(this IReservationTransactionsOperations operations, string billingAccountId, string billingProfileId, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountId, billingProfileId, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List of transactions for 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 ListNext(this IReservationTransactionsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List of transactions for 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> ListNextAsync(this IReservationTransactionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List of transactions for 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 ListByBillingProfileNext(this IReservationTransactionsOperations operations, string nextPageLink) + { + return operations.ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List of transactions for 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> ListByBillingProfileNextAsync(this IReservationTransactionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(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..7662e9252b9b0 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,233 @@ internal ReservationsDetailsOperations(ConsumptionManagementClient client) return _result; } + /// + /// Lists the reservations details for the defined scope and provided date + /// range. + /// + /// + /// + /// The scope associated with reservations details operations. This includes + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// BillingAccount scope (legacy), and + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope (modern). + /// + /// + /// Start date. Only applicable when querying with billing profile + /// + /// + /// End date. Only applicable when querying with billing profile + /// + /// + /// Filter reservation details by date range. The properties/UsageDate for + /// start date and end date. The filter supports 'le' and 'ge'. Not applicable + /// when querying with billing profile + /// + /// + /// Reservation Id GUID. Only valid if reservationOrderId is also provided. + /// Filter to a specific reservation + /// + /// + /// Reservation Order Id GUID. Required if reservationId is provided. Filter to + /// a specific reservation order + /// + /// + /// 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>> ListWithHttpMessagesAsync(string scope, string startDate = default(string), string endDate = default(string), string filter = default(string), string reservationId = default(string), string reservationOrderId = 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("startDate", startDate); + tracingParameters.Add("endDate", endDate); + tracingParameters.Add("filter", filter); + tracingParameters.Add("reservationId", reservationId); + tracingParameters.Add("reservationOrderId", reservationOrderId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Consumption/reservationDetails").ToString(); + _url = _url.Replace("{scope}", scope); + List _queryParameters = new List(); + if (startDate != null) + { + _queryParameters.Add(string.Format("startDate={0}", System.Uri.EscapeDataString(startDate))); + } + if (endDate != null) + { + _queryParameters.Add(string.Format("endDate={0}", System.Uri.EscapeDataString(endDate))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (reservationId != null) + { + _queryParameters.Add(string.Format("reservationId={0}", System.Uri.EscapeDataString(reservationId))); + } + if (reservationOrderId != null) + { + _queryParameters.Add(string.Format("reservationOrderId={0}", System.Uri.EscapeDataString(reservationOrderId))); + } + 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 +910,176 @@ 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 the defined scope and 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>> ListNextWithHttpMessagesAsync(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, "ListNext", 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..9e8809575b88e 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,90 @@ public static IPage ListByReservationOrderAndReservation(this } } + /// + /// Lists the reservations details for the defined scope and provided date + /// range. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with reservations details operations. This includes + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// BillingAccount scope (legacy), and + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope (modern). + /// + /// + /// Start date. Only applicable when querying with billing profile + /// + /// + /// End date. Only applicable when querying with billing profile + /// + /// + /// Filter reservation details by date range. The properties/UsageDate for + /// start date and end date. The filter supports 'le' and 'ge'. Not applicable + /// when querying with billing profile + /// + /// + /// Reservation Id GUID. Only valid if reservationOrderId is also provided. + /// Filter to a specific reservation + /// + /// + /// Reservation Order Id GUID. Required if reservationId is provided. Filter to + /// a specific reservation order + /// + public static IPage List(this IReservationsDetailsOperations operations, string scope, string startDate = default(string), string endDate = default(string), string filter = default(string), string reservationId = default(string), string reservationOrderId = default(string)) + { + return operations.ListAsync(scope, startDate, endDate, filter, reservationId, reservationOrderId).GetAwaiter().GetResult(); + } + + /// + /// Lists the reservations details for the defined scope and provided date + /// range. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with reservations details operations. This includes + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// BillingAccount scope (legacy), and + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope (modern). + /// + /// + /// Start date. Only applicable when querying with billing profile + /// + /// + /// End date. Only applicable when querying with billing profile + /// + /// + /// Filter reservation details by date range. The properties/UsageDate for + /// start date and end date. The filter supports 'le' and 'ge'. Not applicable + /// when querying with billing profile + /// + /// + /// Reservation Id GUID. Only valid if reservationOrderId is also provided. + /// Filter to a specific reservation + /// + /// + /// Reservation Order Id GUID. Required if reservationId is provided. Filter to + /// a specific reservation order + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IReservationsDetailsOperations operations, string scope, string startDate = default(string), string endDate = default(string), string filter = default(string), string reservationId = default(string), string reservationOrderId = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(scope, startDate, endDate, filter, reservationId, reservationOrderId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Lists the reservations details for provided date range. /// @@ -187,5 +271,43 @@ public static IPage ListByReservationOrderAndReservationNext( } } + /// + /// Lists the reservations details for the defined scope and provided date + /// range. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IReservationsDetailsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the reservations details for the defined scope and 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> ListNextAsync(this IReservationsDetailsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(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..58e071fc466ac 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,246 @@ internal ReservationsSummariesOperations(ConsumptionManagementClient client) return _result; } + /// + /// Lists the reservations summaries for the defined scope daily or monthly + /// grain. + /// + /// + /// + /// The scope associated with reservations summaries operations. This includes + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// BillingAccount scope (legacy), and + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope (modern). + /// + /// + /// Can be daily or monthly. Possible values include: 'DailyGrain', + /// 'MonthlyGrain' + /// + /// + /// Start date. Only applicable when querying with billing profile + /// + /// + /// End date. Only applicable when querying with billing profile + /// + /// + /// Required only for daily grain. The properties/UsageDate for start date and + /// end date. The filter supports 'le' and 'ge'. Not applicable when querying + /// with billing profile + /// + /// + /// Reservation Id GUID. Only valid if reservationOrderId is also provided. + /// Filter to a specific reservation + /// + /// + /// Reservation Order Id GUID. Required if reservationId is provided. Filter to + /// a specific reservation order + /// + /// + /// 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>> ListWithHttpMessagesAsync(string scope, string grain, string startDate = default(string), string endDate = default(string), string filter = default(string), string reservationId = default(string), string reservationOrderId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + 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("scope", scope); + tracingParameters.Add("grain", grain); + tracingParameters.Add("startDate", startDate); + tracingParameters.Add("endDate", endDate); + tracingParameters.Add("filter", filter); + tracingParameters.Add("reservationId", reservationId); + tracingParameters.Add("reservationOrderId", reservationOrderId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Consumption/reservationSummaries").ToString(); + _url = _url.Replace("{scope}", scope); + List _queryParameters = new List(); + if (grain != null) + { + _queryParameters.Add(string.Format("grain={0}", System.Uri.EscapeDataString(grain))); + } + if (startDate != null) + { + _queryParameters.Add(string.Format("startDate={0}", System.Uri.EscapeDataString(startDate))); + } + if (endDate != null) + { + _queryParameters.Add(string.Format("endDate={0}", System.Uri.EscapeDataString(endDate))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (reservationId != null) + { + _queryParameters.Add(string.Format("reservationId={0}", System.Uri.EscapeDataString(reservationId))); + } + if (reservationOrderId != null) + { + _queryParameters.Add(string.Format("reservationOrderId={0}", System.Uri.EscapeDataString(reservationOrderId))); + } + 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 +941,176 @@ 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 the defined scope 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>> ListNextWithHttpMessagesAsync(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, "ListNext", 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..85de294627aa2 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,98 @@ public static partial class ReservationsSummariesOperationsExtensions } } + /// + /// Lists the reservations summaries for the defined scope daily or monthly + /// grain. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with reservations summaries operations. This includes + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// BillingAccount scope (legacy), and + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope (modern). + /// + /// + /// Can be daily or monthly. Possible values include: 'DailyGrain', + /// 'MonthlyGrain' + /// + /// + /// Start date. Only applicable when querying with billing profile + /// + /// + /// End date. Only applicable when querying with billing profile + /// + /// + /// Required only for daily grain. The properties/UsageDate for start date and + /// end date. The filter supports 'le' and 'ge'. Not applicable when querying + /// with billing profile + /// + /// + /// Reservation Id GUID. Only valid if reservationOrderId is also provided. + /// Filter to a specific reservation + /// + /// + /// Reservation Order Id GUID. Required if reservationId is provided. Filter to + /// a specific reservation order + /// + public static IPage List(this IReservationsSummariesOperations operations, string scope, string grain, string startDate = default(string), string endDate = default(string), string filter = default(string), string reservationId = default(string), string reservationOrderId = default(string)) + { + return operations.ListAsync(scope, grain, startDate, endDate, filter, reservationId, reservationOrderId).GetAwaiter().GetResult(); + } + + /// + /// Lists the reservations summaries for the defined scope daily or monthly + /// grain. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with reservations summaries operations. This includes + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// BillingAccount scope (legacy), and + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for BillingProfile scope (modern). + /// + /// + /// Can be daily or monthly. Possible values include: 'DailyGrain', + /// 'MonthlyGrain' + /// + /// + /// Start date. Only applicable when querying with billing profile + /// + /// + /// End date. Only applicable when querying with billing profile + /// + /// + /// Required only for daily grain. The properties/UsageDate for start date and + /// end date. The filter supports 'le' and 'ge'. Not applicable when querying + /// with billing profile + /// + /// + /// Reservation Id GUID. Only valid if reservationOrderId is also provided. + /// Filter to a specific reservation + /// + /// + /// Reservation Order Id GUID. Required if reservationId is provided. Filter to + /// a specific reservation order + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IReservationsSummariesOperations operations, string scope, string grain, string startDate = default(string), string endDate = default(string), string filter = default(string), string reservationId = default(string), string reservationOrderId = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(scope, grain, startDate, endDate, filter, reservationId, reservationOrderId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Lists the reservations summaries for daily or monthly grain. /// @@ -203,5 +295,43 @@ public static IPage ListByReservationOrderAndReservationNext } } + /// + /// Lists the reservations summaries for the defined scope daily or monthly + /// grain. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IReservationsSummariesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the reservations summaries for the defined scope 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> ListNextAsync(this IReservationsSummariesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(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..81a02fa43090d 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,27 @@ 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", "2021-05-01"), + new Tuple("Billing", "Credits", "2021-05-01"), + new Tuple("Billing", "Events", "2021-05-01"), + new Tuple("Billing", "Lots", "2021-05-01"), + new Tuple("Billing", "PriceSheet", "2021-05-01"), + new Tuple("Billing", "ReservationTransactions", "2021-05-01"), + new Tuple("Capacity", "ReservationsDetails", "2021-05-01"), + new Tuple("Capacity", "ReservationsSummaries", "2021-05-01"), + new Tuple("Consumption", "Budgets", "2021-05-01"), + new Tuple("Consumption", "Charges", "2021-05-01"), + new Tuple("Consumption", "Forecasts", "2021-05-01"), + new Tuple("Consumption", "Marketplaces", "2021-05-01"), + new Tuple("Consumption", "Operations", "2021-05-01"), + new Tuple("Consumption", "PriceSheet", "2021-05-01"), + new Tuple("Consumption", "ReservationRecommendationDetails", "2021-05-01"), + new Tuple("Consumption", "ReservationRecommendations", "2021-05-01"), + new Tuple("Consumption", "ReservationsDetails", "2021-05-01"), + new Tuple("Consumption", "ReservationsSummaries", "2021-05-01"), + new Tuple("Consumption", "Tags", "2021-05-01"), + new Tuple("Consumption", "UsageDetails", "2021-05-01"), + new Tuple("Management", "AggregatedCost", "2021-05-01"), }.AsEnumerable(); } } diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/TagsOperations.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/TagsOperations.cs index f5e72efa6ffed..70108297b7f50 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/TagsOperations.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/TagsOperations.cs @@ -177,7 +177,7 @@ internal TagsOperations(ConsumptionManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 204) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try 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..a4f9b550c7764 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/UsageDetailsOperations.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/UsageDetailsOperations.cs @@ -58,8 +58,6 @@ internal UsageDetailsOperations(ConsumptionManagementClient client) /// /// 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 @@ -72,7 +70,16 @@ internal UsageDetailsOperations(ConsumptionManagementClient client) /// 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}' + /// '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. + /// Also, Modern Commerce Account scopes are + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// billingAccount scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + /// for invoiceSection scope, and + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' + /// specific for partners. /// /// /// May be used to expand the properties/additionalInfo or @@ -82,10 +89,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 +315,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..0adaeed9f9f57 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/UsageDetailsOperationsExtensions.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/UsageDetailsOperationsExtensions.cs @@ -32,8 +32,6 @@ public static partial class UsageDetailsOperationsExtensions /// /// 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 @@ -46,7 +44,16 @@ public static partial class UsageDetailsOperationsExtensions /// 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}' + /// '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. + /// Also, Modern Commerce Account scopes are + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// billingAccount scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + /// for invoiceSection scope, and + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' + /// specific for partners. /// /// /// May be used to expand the properties/additionalInfo or @@ -56,10 +63,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. @@ -92,8 +101,6 @@ public static partial class UsageDetailsOperationsExtensions /// /// 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 @@ -106,7 +113,16 @@ public static partial class UsageDetailsOperationsExtensions /// 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}' + /// '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. + /// Also, Modern Commerce Account scopes are + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for + /// billingAccount scope, + /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' + /// for billingProfile scope, + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}' + /// for invoiceSection scope, and + /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}' + /// specific for partners. /// /// /// May be used to expand the properties/additionalInfo or @@ -116,10 +132,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 +165,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.