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 6f1cd72d0302..f2b25316c7fb 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 9183e30378ad..3dd59936c759 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 5f4ccf5c72a2..40838c5b8565 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ConsumptionManagementClient.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ConsumptionManagementClient.cs @@ -49,7 +49,7 @@ public partial class ConsumptionManagementClient : ServiceClient /// Version of the API to be used with the client request. The current version - /// is 2019-04-01-preview. + /// is 2019-10-01. /// public string ApiVersion { get; private set; } @@ -121,6 +121,11 @@ public partial class ConsumptionManagementClient : ServiceClient public virtual IReservationRecommendationsOperations ReservationRecommendations { get; private set; } + /// + /// Gets the IReservationTransactionsOperations. + /// + public virtual IReservationTransactionsOperations ReservationTransactions { get; private set; } + /// /// Gets the IPriceSheetOperations. /// @@ -141,6 +146,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 +411,16 @@ private void Initialize() ReservationsSummaries = new ReservationsSummariesOperations(this); ReservationsDetails = new ReservationsDetailsOperations(this); ReservationRecommendations = new ReservationRecommendationsOperations(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 = "2019-10-01"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; @@ -426,6 +450,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 000000000000..86dd6b7d31bf --- /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 000000000000..f0347064ba4d --- /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 000000000000..fcc2f439b632 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/EventsOperations.cs @@ -0,0 +1,436 @@ +// +// 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 by billingAccountId and billingProfileId for 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>> ListWithHttpMessagesAsync(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, "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}/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 by billingAccountId and billingProfileId for 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>> 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; + } + + } +} 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 000000000000..04dc43e89668 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/EventsOperationsExtensions.cs @@ -0,0 +1,119 @@ +// +// 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 by billingAccountId and billingProfileId for 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 List(this IEventsOperations operations, string billingAccountId, string billingProfileId, string startDate, string endDate) + { + return operations.ListAsync(billingAccountId, billingProfileId, startDate, endDate).GetAwaiter().GetResult(); + } + + /// + /// Lists the events by billingAccountId and billingProfileId for 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> ListAsync(this IEventsOperations operations, string billingAccountId, string billingProfileId, string startDate, string endDate, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(billingAccountId, billingProfileId, startDate, endDate, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the events by billingAccountId and billingProfileId for 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 ListNext(this IEventsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the events by billingAccountId and billingProfileId for 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> ListNextAsync(this IEventsOperations 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/IChargesOperations.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IChargesOperations.cs index 2504a13be935..3b00e95b567a 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 e222d81ba322..baeab3127236 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IConsumptionManagementClient.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IConsumptionManagementClient.cs @@ -43,7 +43,7 @@ public partial interface IConsumptionManagementClient : System.IDisposable /// /// Version of the API to be used with the client request. The current - /// version is 2019-04-01-preview. + /// version is 2019-10-01. /// string ApiVersion { get; } @@ -116,6 +116,11 @@ public partial interface IConsumptionManagementClient : System.IDisposable /// IReservationRecommendationsOperations ReservationRecommendations { get; } + /// + /// Gets the IReservationTransactionsOperations. + /// + IReservationTransactionsOperations ReservationTransactions { get; } + /// /// Gets the IPriceSheetOperations. /// @@ -136,5 +141,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 000000000000..1e8cd2998e8d --- /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 000000000000..6994081cec22 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IEventsOperations.cs @@ -0,0 +1,84 @@ +// +// 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 by billingAccountId and billingProfileId for 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>> ListWithHttpMessagesAsync(string billingAccountId, string billingProfileId, string startDate, string endDate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the events by billingAccountId and billingProfileId for 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>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} 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 000000000000..ec71e793029d --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ILotsOperations.cs @@ -0,0 +1,76 @@ +// +// 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 the lots 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>> ListWithHttpMessagesAsync(string billingAccountId, string billingProfileId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the lots by billingAccountId and billingProfileId. + /// + /// + /// + /// 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/IMarketplacesOperations.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IMarketplacesOperations.cs index 78a4d29037a9..7f843e288047 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/IReservationRecommendationsOperations.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IReservationRecommendationsOperations.cs index 9c9af6f5a790..ecc44a65493d 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,26 @@ 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, + /// '/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 +63,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 000000000000..2b155335e1f5 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IReservationTransactionsOperations.cs @@ -0,0 +1,80 @@ +// +// 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 + /// + /// + /// + /// 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/IReservationsDetailsOperations.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/IReservationsDetailsOperations.cs index d3ff2f1edd4d..7ce0c81b1746 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,46 @@ 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 + /// + /// + /// 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), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Lists the reservations details for provided date range. /// /// @@ -126,5 +166,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 dc422c9c9743..096cc7877547 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,50 @@ 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 + /// + /// + /// 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), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Lists the reservations summaries for daily or monthly grain. /// /// @@ -134,5 +178,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 1ad611d71276..bd9b34540483 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 000000000000..a7ee034fb3bc --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/LotsOperations.cs @@ -0,0 +1,410 @@ +// +// 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 the lots 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>> ListWithHttpMessagesAsync(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, "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}/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 the lots by billingAccountId and billingProfileId. + /// + /// + /// + /// 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; + } + + } +} 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 000000000000..63da9b40f68c --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/LotsOperationsExtensions.cs @@ -0,0 +1,103 @@ +// +// 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 the lots by billingAccountId and billingProfileId. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// BillingAccount ID + /// + /// + /// Azure Billing Profile ID. + /// + public static IPage List(this ILotsOperations operations, string billingAccountId, string billingProfileId) + { + return operations.ListAsync(billingAccountId, billingProfileId).GetAwaiter().GetResult(); + } + + /// + /// Lists the lots by billingAccountId and billingProfileId. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// BillingAccount ID + /// + /// + /// Azure Billing Profile ID. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ILotsOperations operations, string billingAccountId, string billingProfileId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(billingAccountId, billingProfileId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the lots by billingAccountId and billingProfileId. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ILotsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the lots by billingAccountId and billingProfileId. + /// + /// + /// + /// 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 ILotsOperations 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/MarketplacesOperations.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/MarketplacesOperations.cs index d858ca0213eb..3b0ec7259b61 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 0d7f5e675967..d262afccf0d5 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 000000000000..9e6654b8f655 --- /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/Budget.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Budget.cs index fb09003f4ac6..9f050c992845 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Budget.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/Budget.cs @@ -41,7 +41,8 @@ public Budget() /// budget /// The time covered by a budget. Tracking of /// the amount will be reset based on the time grain. Possible values - /// include: 'Monthly', 'Quarterly', 'Annually' + /// include: 'Monthly', 'Quarterly', 'Annually', 'BillingMonth', + /// 'BillingQuarter', 'BillingAnnual' /// Has start and end date of the budget. The /// start date must be first of the month and should be less than the /// end date. Budget start date must be on or after June 1, 2017. @@ -94,7 +95,8 @@ public Budget() /// /// Gets or sets the time covered by a budget. Tracking of the amount /// will be reset based on the time grain. Possible values include: - /// 'Monthly', 'Quarterly', 'Annually' + /// 'Monthly', 'Quarterly', 'Annually', 'BillingMonth', + /// 'BillingQuarter', 'BillingAnnual' /// [JsonProperty(PropertyName = "properties.timeGrain")] public string TimeGrain { get; set; } diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ChargeSummary.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ChargeSummary.cs index 6c1b990582cb..4a283c524704 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 { /// @@ -38,25 +34,9 @@ public ChargeSummary() /// Resource name. /// Resource type. /// 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)) + public ChargeSummary(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary)) : base(id, name, type, tags) { - BillingPeriodId = billingPeriodId; - UsageStart = usageStart; - UsageEnd = usageEnd; - AzureCharges = azureCharges; - ChargesBilledSeparately = chargesBilledSeparately; - MarketplaceCharges = marketplaceCharges; - Currency = currency; CustomInit(); } @@ -65,48 +45,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 000000000000..917c716f3a3d --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/CreditBalanceSummary.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; + + /// + /// 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. + public CreditBalanceSummary(Amount estimatedBalance = default(Amount), Amount currentBalance = default(Amount)) + { + EstimatedBalance = estimatedBalance; + CurrentBalance = currentBalance; + 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; } + + } +} 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 000000000000..c03ba833c75a --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/CreditSummary.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 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. + /// + /// Resource Id. + /// Resource name. + /// Resource type. + /// Resource tags. + /// Summary of balances associated with + /// this credit summary. + /// Pending credit + /// adjustments. + /// Expired credit. + /// Pending eligible + /// charges. + public CreditSummary(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), CreditBalanceSummary balanceSummary = default(CreditBalanceSummary), Amount pendingCreditAdjustments = default(Amount), Amount expiredCredit = default(Amount), Amount pendingEligibleCharges = default(Amount)) + : base(id, name, type, tags) + { + BalanceSummary = balanceSummary; + PendingCreditAdjustments = pendingCreditAdjustments; + ExpiredCredit = expiredCredit; + PendingEligibleCharges = pendingEligibleCharges; + 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; } + + } +} 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 000000000000..8853cf5ff483 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/EventSummary.cs @@ -0,0 +1,130 @@ +// +// 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. + /// + /// Resource Id. + /// Resource name. + /// Resource type. + /// Resource tags. + /// Transaction date. + /// Transaction description. + /// New Credit. + /// Adjustments amount. + /// Credit expired. + /// Charges amount. + /// Closed balance. + /// The type of event. Possible values include: + /// 'SettledCharges', 'PendingCharges', 'PendingAdjustments', + /// 'PendingNewCredit', 'PendingExpiredCredit', 'UnKnown', + /// 'NewCredit' + /// Invoice number. + public EventSummary(string id = default(string), string name = default(string), string type = 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)) + : base(id, name, type, tags) + { + TransactionDate = transactionDate; + Description = description; + NewCredit = newCredit; + Adjustments = adjustments; + CreditExpired = creditExpired; + Charges = charges; + ClosedBalance = closedBalance; + EventType = eventType; + InvoiceNumber = invoiceNumber; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets transaction date. + /// + [JsonProperty(PropertyName = "properties.transactionDate")] + public System.DateTime? TransactionDate { get; private set; } + + /// + /// Gets transaction description. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; private set; } + + /// + /// Gets new Credit. + /// + [JsonProperty(PropertyName = "properties.newCredit")] + public Amount NewCredit { get; private set; } + + /// + /// Gets adjustments amount. + /// + [JsonProperty(PropertyName = "properties.adjustments")] + public Amount Adjustments { get; private set; } + + /// + /// Gets credit expired. + /// + [JsonProperty(PropertyName = "properties.creditExpired")] + public Amount CreditExpired { get; private set; } + + /// + /// Gets charges amount. + /// + [JsonProperty(PropertyName = "properties.charges")] + public Amount Charges { get; private set; } + + /// + /// Gets closed balance. + /// + [JsonProperty(PropertyName = "properties.closedBalance")] + public Amount ClosedBalance { get; private set; } + + /// + /// Gets or sets the type of event. Possible values include: + /// 'SettledCharges', 'PendingCharges', 'PendingAdjustments', + /// 'PendingNewCredit', 'PendingExpiredCredit', 'UnKnown', 'NewCredit' + /// + [JsonProperty(PropertyName = "properties.eventType")] + public string EventType { get; set; } + + /// + /// Gets invoice number. + /// + [JsonProperty(PropertyName = "properties.invoiceNumber")] + public string InvoiceNumber { 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 000000000000..7126b76162f6 --- /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/LegacyChargeSummary.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/LegacyChargeSummary.cs new file mode 100644 index 000000000000..31ce5e144533 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/LegacyChargeSummary.cs @@ -0,0 +1,113 @@ +// +// 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. + /// + /// Resource Id. + /// Resource name. + /// Resource type. + /// 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), 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) + { + 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 000000000000..31b21be59621 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/LegacyReservationRecommendation.cs @@ -0,0 +1,180 @@ +// +// 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. + /// + /// Resource Id. + /// Resource name. + /// Resource type. + /// 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) + /// 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), IDictionary tags = default(IDictionary), string location = default(string), string sku = default(string), string lookBackPeriod = default(string), int? instanceFlexibilityRatio = default(int?), string instanceFlexibilityGroup = default(string), string normalizedSize = default(string), double? recommendedQuantityNormalized = default(double?), System.Guid? meterId = default(System.Guid?), string term = default(string), decimal? costWithNoReservedInstances = default(decimal?), decimal? recommendedQuantity = default(decimal?), decimal? totalCostWithReservedInstances = default(decimal?), decimal? netSavings = default(decimal?), System.DateTime? firstUsageDate = default(System.DateTime?), string scope = default(string), IList skuProperties = default(IList)) + : base(id, name, type, tags, location, sku) + { + 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; + 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 int? InstanceFlexibilityRatio { get; private set; } + + /// + /// Gets the instance Flexibility Group. + /// + [JsonProperty(PropertyName = "properties.instanceFlexibilityGroup")] + public string InstanceFlexibilityGroup { get; private set; } + + /// + /// Gets the normalized Size. + /// + [JsonProperty(PropertyName = "properties.normalizedSize")] + public string NormalizedSize { get; private set; } + + /// + /// Gets the recommended Quantity Normalized. + /// + [JsonProperty(PropertyName = "properties.recommendedQuantityNormalized")] + public double? RecommendedQuantityNormalized { get; private set; } + + /// + /// Gets the meter id (GUID) + /// + [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; } + + /// + /// 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/LegacyUsageDetail.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/LegacyUsageDetail.cs new file mode 100644 index 000000000000..78d373de96ea --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/LegacyUsageDetail.cs @@ -0,0 +1,450 @@ +// +// 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. + /// + /// Resource Id. + /// Resource name. + /// Resource type. + /// 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 LegacyUsageDetail(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) + { + 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 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/LotSource.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/LotSource.cs new file mode 100644 index 000000000000..0e9762ff5f07 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/LotSource.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 LotSource. + /// + public static class LotSource + { + public const string PurchasedCredit = "PurchasedCredit"; + public const string PromotionalCredit = "PromotionalCredit"; + } +} 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 000000000000..9cfc459f5c14 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/LotSummary.cs @@ -0,0 +1,103 @@ +// +// 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. + /// + /// Resource Id. + /// Resource name. + /// Resource type. + /// Resource tags. + /// Original amount. + /// Closed balance. + /// Lot source. Possible values include: + /// 'PurchasedCredit', 'PromotionalCredit' + /// Start date. + /// Expiration date. + /// PO number. + public LotSummary(string id = default(string), string name = default(string), string type = 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)) + : base(id, name, type, tags) + { + OriginalAmount = originalAmount; + ClosedBalance = closedBalance; + Source = source; + StartDate = startDate; + ExpirationDate = expirationDate; + PoNumber = poNumber; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets original amount. + /// + [JsonProperty(PropertyName = "properties.originalAmount")] + public Amount OriginalAmount { get; private set; } + + /// + /// Gets closed balance. + /// + [JsonProperty(PropertyName = "properties.closedBalance")] + public Amount ClosedBalance { get; private set; } + + /// + /// Gets lot source. Possible values include: 'PurchasedCredit', + /// 'PromotionalCredit' + /// + [JsonProperty(PropertyName = "properties.source")] + public string Source { get; private set; } + + /// + /// Gets start date. + /// + [JsonProperty(PropertyName = "properties.startDate")] + public System.DateTime? StartDate { get; private set; } + + /// + /// Gets expiration date. + /// + [JsonProperty(PropertyName = "properties.expirationDate")] + public System.DateTime? ExpirationDate { get; private set; } + + /// + /// Gets PO number. + /// + [JsonProperty(PropertyName = "properties.poNumber")] + public string PoNumber { get; private set; } + + } +} 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 000000000000..594e1a8c4175 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ModernChargeSummary.cs @@ -0,0 +1,145 @@ +// +// 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. + /// + /// Resource Id. + /// Resource name. + /// Resource type. + /// 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), 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, 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 000000000000..6f1f9bfd1b91 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ModernReservationRecommendation.cs @@ -0,0 +1,180 @@ +// +// 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. + /// + /// Resource Id. + /// Resource name. + /// Resource type. + /// 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) + /// 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 ModernReservationRecommendation(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string location = default(string), string sku = default(string), string lookBackPeriod = default(string), int? instanceFlexibilityRatio = default(int?), string instanceFlexibilityGroup = default(string), string normalizedSize = default(string), double? recommendedQuantityNormalized = default(double?), System.Guid? meterId = default(System.Guid?), string term = default(string), 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)) + : base(id, name, type, tags, location, sku) + { + 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; + 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 int? InstanceFlexibilityRatio { get; private set; } + + /// + /// Gets the instance Flexibility Group. + /// + [JsonProperty(PropertyName = "properties.instanceFlexibilityGroup")] + public string InstanceFlexibilityGroup { get; private set; } + + /// + /// Gets the normalized Size. + /// + [JsonProperty(PropertyName = "properties.normalizedSize")] + public string NormalizedSize { get; private set; } + + /// + /// Gets the recommended Quantity Normalized. + /// + [JsonProperty(PropertyName = "properties.recommendedQuantityNormalized")] + public double? RecommendedQuantityNormalized { get; private set; } + + /// + /// Gets the meter id (GUID) + /// + [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; } + + } +} 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 000000000000..d24b2a89b10f --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ModernUsageDetail.cs @@ -0,0 +1,722 @@ +// +// 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. + /// + /// Resource Id. + /// Resource name. + /// Resource type. + /// 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 Info 1. + /// Service Info 2. + /// 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. + /// Identifer 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. + public ModernUsageDetail(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 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)) + : base(id, name, type, 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; + 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 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. 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 identifer 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; } + + } +} 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 f3903d5f9cb8..77c6286abcf8 100644 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ReservationDetail.cs +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ReservationDetail.cs @@ -43,6 +43,10 @@ public ReservationDetail() /// represents a single purchase transaction. A reservation order /// contains reservations. The reservation order specifies the VM size /// and region for the reservations. + /// The instance Flexibility + /// Ratio. + /// The instance Flexibility + /// Group. /// The reservation ID is the identifier of /// a reservation within a reservation order. Each reservation is the /// grouping for applying the benefit scope and also specifies the @@ -63,10 +67,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?)) + /// The reservation kind. + public ReservationDetail(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string reservationOrderId = default(string), string instanceFlexibilityRatio = default(string), string instanceFlexibilityGroup = default(string), string reservationId = default(string), string skuName = default(string), decimal? reservedHours = default(decimal?), System.DateTime? usageDate = default(System.DateTime?), decimal? usedHours = default(decimal?), string instanceId = default(string), decimal? totalReservedQuantity = default(decimal?), string kind = default(string)) : base(id, name, type, tags) { ReservationOrderId = reservationOrderId; + InstanceFlexibilityRatio = instanceFlexibilityRatio; + InstanceFlexibilityGroup = instanceFlexibilityGroup; ReservationId = reservationId; SkuName = skuName; ReservedHours = reservedHours; @@ -74,6 +81,7 @@ public ReservationDetail() UsedHours = usedHours; InstanceId = instanceId; TotalReservedQuantity = totalReservedQuantity; + Kind = kind; CustomInit(); } @@ -92,6 +100,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 +162,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 7bf72c60b372..6b4c54ca3d4d 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 { /// @@ -40,23 +37,7 @@ public ReservationRecommendation() /// 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), IDictionary tags = default(IDictionary), string location = default(string), string sku = default(string)) { Id = id; Name = name; @@ -64,15 +45,6 @@ public ReservationRecommendation() 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(); } @@ -117,59 +89,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/ReservationSummary.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/ReservationSummary.cs index d38076dcb31b..d5fca5fbba3a 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 @@ -69,7 +69,18 @@ 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?)) + /// 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), 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, tags) { ReservationOrderId = reservationOrderId; @@ -81,6 +92,12 @@ public ReservationSummary() MinUtilizationPercentage = minUtilizationPercentage; AvgUtilizationPercentage = avgUtilizationPercentage; MaxUtilizationPercentage = maxUtilizationPercentage; + Kind = kind; + PurchasedQuantity = purchasedQuantity; + RemainingQuantity = remainingQuantity; + TotalReservedQuantity = totalReservedQuantity; + UsedQuantity = usedQuantity; + UtilizedPercentage = utilizedPercentage; CustomInit(); } @@ -161,5 +178,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 000000000000..fa77a0291e64 --- /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 : Resource + { + /// + /// 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), IDictionary tags = default(IDictionary), 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/SkuProperty.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/SkuProperty.cs new file mode 100644 index 000000000000..f2f332a69b9b --- /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/TimeGrainType.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/TimeGrainType.cs index 6e0a7feed11d..2b02f5b45443 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 8ff10325964c..41f8be23d28e 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 { /// @@ -38,128 +34,9 @@ public UsageDetail() /// Resource name. /// Resource type. /// 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)) + public UsageDetail(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary)) : base(id, name, type, 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 +45,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 26cf1f9a2de3..000000000000 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/UsageDetailsDownloadHeaders.cs +++ /dev/null @@ -1,77 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Consumption.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Defines headers for Download operation. - /// - public partial class UsageDetailsDownloadHeaders - { - /// - /// Initializes a new instance of the UsageDetailsDownloadHeaders - /// class. - /// - public UsageDetailsDownloadHeaders() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the UsageDetailsDownloadHeaders - /// class. - /// - /// GET this URL to retrieve the status of the - /// asynchronous operation. - /// The amount of delay to use while the - /// status of the operation is checked. The value is expressed in - /// seconds. - /// To get the progress of the - /// operation, call GET operation on the URL in Azure-AsyncOperation - /// header field. - public UsageDetailsDownloadHeaders(string location = default(string), string retryAfter = default(string), string azureAsyncOperation = default(string)) - { - Location = location; - RetryAfter = retryAfter; - AzureAsyncOperation = azureAsyncOperation; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets GET this URL to retrieve the status of the - /// asynchronous operation. - /// - [JsonProperty(PropertyName = "Location")] - public string Location { get; set; } - - /// - /// Gets or sets the amount of delay to use while the status of the - /// operation is checked. The value is expressed in seconds. - /// - [JsonProperty(PropertyName = "Retry-After")] - public string RetryAfter { get; set; } - - /// - /// Gets or sets to get the progress of the operation, call GET - /// operation on the URL in Azure-AsyncOperation header field. - /// - [JsonProperty(PropertyName = "Azure-AsyncOperation")] - public string AzureAsyncOperation { get; set; } - - } -} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/UsageDetailsDownloadResponse.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/UsageDetailsDownloadResponse.cs deleted file mode 100644 index 6eda8d43d49c..000000000000 --- a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/Models/UsageDetailsDownloadResponse.cs +++ /dev/null @@ -1,72 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Consumption.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Download response of Usage Details. - /// - [Rest.Serialization.JsonTransformation] - public partial class UsageDetailsDownloadResponse : Resource - { - /// - /// Initializes a new instance of the UsageDetailsDownloadResponse - /// class. - /// - public UsageDetailsDownloadResponse() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the UsageDetailsDownloadResponse - /// class. - /// - /// Resource Id. - /// Resource name. - /// Resource type. - /// Resource tags. - /// The URL to the csv file. - /// The time in UTC at which this download URL - /// will expire. - public UsageDetailsDownloadResponse(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string downloadUrlProperty = default(string), string validTill = default(string)) - : base(id, name, type, tags) - { - DownloadUrlProperty = downloadUrlProperty; - ValidTill = validTill; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the URL to the csv file. - /// - [JsonProperty(PropertyName = "properties.downloadUrl")] - public string DownloadUrlProperty { get; private set; } - - /// - /// Gets the time in UTC at which this download URL will expire. - /// - [JsonProperty(PropertyName = "properties.validTill")] - public string ValidTill { get; private set; } - - } -} diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationRecommendationsOperations.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationRecommendationsOperations.cs index b0c3ab64809a..4a7a5eb5fa62 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,23 @@ 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, + /// '/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 +93,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 +111,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) { 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 5358163308b1..ae1423692024 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,27 @@ 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, + /// '/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 +58,30 @@ 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, + /// '/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 000000000000..424d6ddc062f --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationTransactionsOperations.cs @@ -0,0 +1,410 @@ +// +// 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 + /// + /// + /// + /// 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; + } + + } +} 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 000000000000..c5a0f9b94448 --- /dev/null +++ b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/ReservationTransactionsOperationsExtensions.cs @@ -0,0 +1,105 @@ +// +// 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. + /// + /// + /// 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; + } + } + + } +} 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 b94241f33af7..8500cc71e271 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,215 @@ 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 + /// + /// + /// 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), 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("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 (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 +892,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 0d08b82a9067..d297d6ba2348 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,74 @@ 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 + /// + public static IPage List(this IReservationsDetailsOperations operations, string scope, string startDate = default(string), string endDate = default(string), string filter = default(string)) + { + return operations.ListAsync(scope, startDate, endDate, filter).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 + /// + /// + /// 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), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(scope, startDate, endDate, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Lists the reservations details for provided date range. /// @@ -187,5 +255,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 67051f50e750..91c9771b0651 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,228 @@ 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 + /// + /// + /// 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), 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("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 (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 +923,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 a2c21e8d0231..609ada9875b0 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,82 @@ 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 + /// + public static IPage List(this IReservationsSummariesOperations operations, string scope, string grain, string startDate = default(string), string endDate = default(string), string filter = default(string)) + { + return operations.ListAsync(scope, grain, startDate, endDate, filter).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 + /// + /// + /// 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), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(scope, grain, startDate, endDate, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Lists the reservations summaries for daily or monthly grain. /// @@ -203,5 +279,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 2329d9f3ba0c..7dbefc695103 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,26 @@ public static IEnumerable> ApiInfo_ConsumptionMana { return new Tuple[] { - new Tuple("Billing", "Balances", "2019-04-01-preview"), - new Tuple("Billing", "PriceSheet", "2019-04-01-preview"), - new Tuple("Capacity", "ReservationsDetails", "2019-04-01-preview"), - new Tuple("Capacity", "ReservationsSummaries", "2019-04-01-preview"), - new Tuple("Consumption", "Budgets", "2019-04-01-preview"), - new Tuple("Consumption", "Charges", "2019-04-01-preview"), - new Tuple("Consumption", "Forecasts", "2019-04-01-preview"), - new Tuple("Consumption", "Marketplaces", "2019-04-01-preview"), - new Tuple("Consumption", "Operations", "2019-04-01-preview"), - new Tuple("Consumption", "PriceSheet", "2019-04-01-preview"), - new Tuple("Consumption", "ReservationRecommendations", "2019-04-01-preview"), - new Tuple("Consumption", "Tags", "2019-04-01-preview"), - new Tuple("Consumption", "UsageDetails", "2019-04-01-preview"), - new Tuple("Management", "AggregatedCost", "2019-04-01-preview"), + new Tuple("Billing", "Balances", "2019-10-01"), + new Tuple("Billing", "Credits", "2019-10-01"), + new Tuple("Billing", "Events", "2019-10-01"), + new Tuple("Billing", "Lots", "2019-10-01"), + new Tuple("Billing", "PriceSheet", "2019-10-01"), + new Tuple("Billing", "ReservationTransactions", "2019-10-01"), + new Tuple("Capacity", "ReservationsDetails", "2019-10-01"), + new Tuple("Capacity", "ReservationsSummaries", "2019-10-01"), + new Tuple("Consumption", "Budgets", "2019-10-01"), + new Tuple("Consumption", "Charges", "2019-10-01"), + new Tuple("Consumption", "Forecasts", "2019-10-01"), + new Tuple("Consumption", "Marketplaces", "2019-10-01"), + new Tuple("Consumption", "Operations", "2019-10-01"), + new Tuple("Consumption", "PriceSheet", "2019-10-01"), + new Tuple("Consumption", "ReservationRecommendations", "2019-10-01"), + new Tuple("Consumption", "ReservationsDetails", "2019-10-01"), + new Tuple("Consumption", "ReservationsSummaries", "2019-10-01"), + new Tuple("Consumption", "Tags", "2019-10-01"), + new Tuple("Consumption", "UsageDetails", "2019-10-01"), + new Tuple("Management", "AggregatedCost", "2019-10-01"), }.AsEnumerable(); } } diff --git a/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/UsageDetailsOperations.cs b/sdk/consumption/Microsoft.Azure.Management.Consumption/src/Generated/UsageDetailsOperations.cs index 7bfa4cfdf7ae..a4f9b550c776 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 e40b96215e9f..0adaeed9f9f5 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.