diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/AddressOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/AddressOperations.cs new file mode 100644 index 0000000000000..39dd36a238d12 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/AddressOperations.cs @@ -0,0 +1,235 @@ +// +// 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.Billing +{ + 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; + + /// + /// AddressOperations operations. + /// + internal partial class AddressOperations : IServiceOperations, IAddressOperations + { + /// + /// Initializes a new instance of the AddressOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal AddressOperations(BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// Validates the address. + /// + /// + /// + /// + /// 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> ValidateWithHttpMessagesAsync(AddressDetails address, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (address == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "address"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("address", address); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Validate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/validateAddress").ToString(); + 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("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; + if(address != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(address, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // 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/billing/Microsoft.Azure.Management.Billing/src/Generated/AddressOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/AddressOperationsExtensions.cs new file mode 100644 index 0000000000000..c0e8399bdcc2c --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/AddressOperationsExtensions.cs @@ -0,0 +1,57 @@ +// +// 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.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for AddressOperations. + /// + public static partial class AddressOperationsExtensions + { + /// + /// Validates the address. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + public static ValidateAddressResponse Validate(this IAddressOperations operations, AddressDetails address) + { + return operations.ValidateAsync(address).GetAwaiter().GetResult(); + } + + /// + /// Validates the address. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task ValidateAsync(this IAddressOperations operations, AddressDetails address, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ValidateWithHttpMessagesAsync(address, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/AgreementsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/AgreementsOperations.cs index b7bfd8dccd112..355ab9591a9b8 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/AgreementsOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/AgreementsOperations.cs @@ -80,7 +80,7 @@ internal AgreementsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -100,7 +100,7 @@ internal AgreementsOperations(BillingManagementClient client) tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("expand", expand); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/AgreementsOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/AgreementsOperationsExtensions.cs index 2657b2b3af171..459d373677610 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/AgreementsOperationsExtensions.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/AgreementsOperationsExtensions.cs @@ -33,9 +33,9 @@ public static partial class AgreementsOperationsExtensions /// /// May be used to expand the participants. /// - public static AgreementListResult ListByBillingAccountName(this IAgreementsOperations operations, string billingAccountName, string expand = default(string)) + public static AgreementListResult ListByBillingAccount(this IAgreementsOperations operations, string billingAccountName, string expand = default(string)) { - return operations.ListByBillingAccountNameAsync(billingAccountName, expand).GetAwaiter().GetResult(); + return operations.ListByBillingAccountAsync(billingAccountName, expand).GetAwaiter().GetResult(); } /// @@ -53,9 +53,9 @@ public static partial class AgreementsOperationsExtensions /// /// The cancellation token. /// - public static async Task ListByBillingAccountNameAsync(this IAgreementsOperations operations, string billingAccountName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListByBillingAccountAsync(this IAgreementsOperations operations, string billingAccountName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByBillingAccountNameWithHttpMessagesAsync(billingAccountName, expand, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, expand, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingAccountsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingAccountsOperations.cs index 1d076d68748bf..e4b1b16addf6c 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingAccountsOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingAccountsOperations.cs @@ -54,7 +54,7 @@ internal BillingAccountsOperations(BillingManagementClient client) /// Lists all billing accounts for a user which he has access to. /// /// - /// May be used to expand the invoiceSections and billingProfiles. + /// May be used to expand the address, invoiceSections and billingProfiles. /// /// /// Headers that will be added to request. @@ -233,7 +233,7 @@ internal BillingAccountsOperations(BillingManagementClient client) /// billing Account Id. /// /// - /// May be used to expand the invoiceSections and billingProfiles. + /// May be used to expand the address, invoiceSections and billingProfiles. /// /// /// Headers that will be added to request. @@ -411,5 +411,218 @@ internal BillingAccountsOperations(BillingManagementClient client) return _result; } + /// + /// The operation to update a billing account. + /// + /// + /// billing Account Id. + /// + /// + /// Request parameters supplied to the update billing account operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string billingAccountName, BillingAccountUpdateRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(billingAccountName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The operation to update a billing account. + /// + /// + /// billing Account Id. + /// + /// + /// Request parameters supplied to the update billing account 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> BeginUpdateWithHttpMessagesAsync(string billingAccountName, BillingAccountUpdateRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + 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("PATCH"); + _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; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // 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); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingAccountsOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingAccountsOperationsExtensions.cs index ba67081d83811..073c2a3f17fec 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingAccountsOperationsExtensions.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingAccountsOperationsExtensions.cs @@ -28,7 +28,7 @@ public static partial class BillingAccountsOperationsExtensions /// The operations group for this extension method. /// /// - /// May be used to expand the invoiceSections and billingProfiles. + /// May be used to expand the address, invoiceSections and billingProfiles. /// public static BillingAccountListResult List(this IBillingAccountsOperations operations, string expand = default(string)) { @@ -42,7 +42,7 @@ public static partial class BillingAccountsOperationsExtensions /// The operations group for this extension method. /// /// - /// May be used to expand the invoiceSections and billingProfiles. + /// May be used to expand the address, invoiceSections and billingProfiles. /// /// /// The cancellation token. @@ -65,7 +65,7 @@ public static partial class BillingAccountsOperationsExtensions /// billing Account Id. /// /// - /// May be used to expand the invoiceSections and billingProfiles. + /// May be used to expand the address, invoiceSections and billingProfiles. /// public static BillingAccount Get(this IBillingAccountsOperations operations, string billingAccountName, string expand = default(string)) { @@ -82,7 +82,7 @@ public static partial class BillingAccountsOperationsExtensions /// billing Account Id. /// /// - /// May be used to expand the invoiceSections and billingProfiles. + /// May be used to expand the address, invoiceSections and billingProfiles. /// /// /// The cancellation token. @@ -95,5 +95,85 @@ public static partial class BillingAccountsOperationsExtensions } } + /// + /// The operation to update a billing account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Request parameters supplied to the update billing account operation. + /// + public static BillingAccount Update(this IBillingAccountsOperations operations, string billingAccountName, BillingAccountUpdateRequest parameters) + { + return operations.UpdateAsync(billingAccountName, parameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to update a billing account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Request parameters supplied to the update billing account operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IBillingAccountsOperations operations, string billingAccountName, BillingAccountUpdateRequest parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(billingAccountName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operation to update a billing account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Request parameters supplied to the update billing account operation. + /// + public static BillingAccount BeginUpdate(this IBillingAccountsOperations operations, string billingAccountName, BillingAccountUpdateRequest parameters) + { + return operations.BeginUpdateAsync(billingAccountName, parameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to update a billing account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Request parameters supplied to the update billing account operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IBillingAccountsOperations operations, string billingAccountName, BillingAccountUpdateRequest parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(billingAccountName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingManagementClient.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingManagementClient.cs index c1d0683efb03e..ff06f40bc480a 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingManagementClient.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingManagementClient.cs @@ -49,7 +49,7 @@ public partial class BillingManagementClient : ServiceClient /// Version of the API to be used with the client request. The current version - /// is 2018-11-01-preview. + /// is 2019-10-01-preview. /// public string ApiVersion { get; private set; } @@ -86,6 +86,11 @@ public partial class BillingManagementClient : ServiceClient public virtual IPaymentMethodsOperations PaymentMethods { get; private set; } + /// + /// Gets the IAddressOperations. + /// + public virtual IAddressOperations Address { get; private set; } + /// /// Gets the IAvailableBalancesOperations. /// @@ -96,45 +101,55 @@ public partial class BillingManagementClient : ServiceClient public virtual IBillingProfilesOperations BillingProfiles { get; private set; } + /// + /// Gets the ICustomersOperations. + /// + public virtual ICustomersOperations Customers { get; private set; } + /// /// Gets the IInvoiceSectionsOperations. /// public virtual IInvoiceSectionsOperations InvoiceSections { get; private set; } /// - /// Gets the IDepartmentsOperations. + /// Gets the IBillingPermissionsOperations. /// - public virtual IDepartmentsOperations Departments { get; private set; } + public virtual IBillingPermissionsOperations BillingPermissions { get; private set; } /// - /// Gets the IEnrollmentAccountsOperations. + /// Gets the IBillingSubscriptionsOperations. /// - public virtual IEnrollmentAccountsOperations EnrollmentAccounts { get; private set; } + public virtual IBillingSubscriptionsOperations BillingSubscriptions { get; private set; } /// - /// Gets the IInvoicesOperations. + /// Gets the IProductsOperations. /// - public virtual IInvoicesOperations Invoices { get; private set; } + public virtual IProductsOperations Products { get; private set; } /// - /// Gets the IPriceSheetOperations. + /// Gets the ITransactionsOperations. /// - public virtual IPriceSheetOperations PriceSheet { get; private set; } + public virtual ITransactionsOperations Transactions { get; private set; } /// - /// Gets the IBillingSubscriptionsOperations. + /// Gets the IDepartmentsOperations. /// - public virtual IBillingSubscriptionsOperations BillingSubscriptions { get; private set; } + public virtual IDepartmentsOperations Departments { get; private set; } /// - /// Gets the IProductsOperations. + /// Gets the IEnrollmentAccountsOperations. /// - public virtual IProductsOperations Products { get; private set; } + public virtual IEnrollmentAccountsOperations EnrollmentAccounts { get; private set; } /// - /// Gets the ITransactionsOperations. + /// Gets the IInvoicesOperations. /// - public virtual ITransactionsOperations Transactions { get; private set; } + public virtual IInvoicesOperations Invoices { get; private set; } + + /// + /// Gets the IPriceSheetOperations. + /// + public virtual IPriceSheetOperations PriceSheet { get; private set; } /// /// Gets the IPoliciesOperations. @@ -151,6 +166,16 @@ public partial class BillingManagementClient : ServiceClient public virtual ITransfersOperations Transfers { get; private set; } + /// + /// Gets the IPartnerTransfersOperations. + /// + public virtual IPartnerTransfersOperations PartnerTransfers { get; private set; } + + /// + /// Gets the IPartnerTransfersTransfersOperations. + /// + public virtual IPartnerTransfersTransfersOperations PartnerTransfersTransfers { get; private set; } + /// /// Gets the IRecipientTransfersOperations. /// @@ -161,11 +186,6 @@ public partial class BillingManagementClient : ServiceClient public virtual IOperations Operations { get; private set; } - /// - /// Gets the IBillingPermissionsOperations. - /// - public virtual IBillingPermissionsOperations BillingPermissions { get; private set; } - /// /// Gets the IBillingRoleDefinitionsOperations. /// @@ -181,6 +201,11 @@ public partial class BillingManagementClient : ServiceClient public virtual IAgreementsOperations Agreements { get; private set; } + /// + /// Gets the ILineOfCreditsOperations. + /// + public virtual ILineOfCreditsOperations LineOfCredits { get; private set; } + /// /// Initializes a new instance of the BillingManagementClient class. /// @@ -424,27 +449,32 @@ private void Initialize() { BillingAccounts = new BillingAccountsOperations(this); PaymentMethods = new PaymentMethodsOperations(this); + Address = new AddressOperations(this); AvailableBalances = new AvailableBalancesOperations(this); BillingProfiles = new BillingProfilesOperations(this); + Customers = new CustomersOperations(this); InvoiceSections = new InvoiceSectionsOperations(this); + BillingPermissions = new BillingPermissionsOperations(this); + BillingSubscriptions = new BillingSubscriptionsOperations(this); + Products = new ProductsOperations(this); + Transactions = new TransactionsOperations(this); Departments = new DepartmentsOperations(this); EnrollmentAccounts = new EnrollmentAccountsOperations(this); Invoices = new InvoicesOperations(this); PriceSheet = new PriceSheetOperations(this); - BillingSubscriptions = new BillingSubscriptionsOperations(this); - Products = new ProductsOperations(this); - Transactions = new TransactionsOperations(this); Policies = new PoliciesOperations(this); BillingProperty = new BillingPropertyOperations(this); Transfers = new TransfersOperations(this); + PartnerTransfers = new PartnerTransfersOperations(this); + PartnerTransfersTransfers = new PartnerTransfersTransfersOperations(this); RecipientTransfers = new RecipientTransfersOperations(this); Operations = new Operations(this); - BillingPermissions = new BillingPermissionsOperations(this); BillingRoleDefinitions = new BillingRoleDefinitionsOperations(this); BillingRoleAssignments = new BillingRoleAssignmentsOperations(this); Agreements = new AgreementsOperations(this); + LineOfCredits = new LineOfCreditsOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2018-11-01-preview"; + ApiVersion = "2019-10-01-preview"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingPermissionsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingPermissionsOperations.cs index 1018381b8005b..391530e8e1671 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingPermissionsOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingPermissionsOperations.cs @@ -50,6 +50,192 @@ internal BillingPermissionsOperations(BillingManagementClient client) /// public BillingManagementClient Client { get; private set; } + /// + /// Lists all billing permissions the caller has for a customer. + /// + /// + /// billing Account Id. + /// + /// + /// Customer name. + /// + /// + /// 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> ListByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (customerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "customerName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("customerName", customerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByCustomer", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/billingPermissions").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Lists all billing permissions for the caller under a billing account. /// @@ -100,7 +286,7 @@ internal BillingPermissionsOperations(BillingManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingPermissions").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingPermissions").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -233,6 +419,9 @@ internal BillingPermissionsOperations(BillingManagementClient client) /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -257,7 +446,7 @@ internal BillingPermissionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListByInvoiceSectionsWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListByInvoiceSectionsWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -267,6 +456,10 @@ internal BillingPermissionsOperations(BillingManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } if (invoiceSectionName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); @@ -279,14 +472,16 @@ internal BillingPermissionsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSections", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingPermissions").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingPermissions").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -414,7 +609,7 @@ internal BillingPermissionsOperations(BillingManagementClient client) } /// - /// Lists all billingPermissions for the caller has for a billing account. + /// Lists all billing permissions the caller has for a billing account. /// /// /// billing Account Id. @@ -471,7 +666,7 @@ internal BillingPermissionsOperations(BillingManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingPermissions").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingPermissions").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); List _queryParameters = new List(); diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingPermissionsOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingPermissionsOperationsExtensions.cs index a6b04a53d5e7b..1367a626c59df 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingPermissionsOperationsExtensions.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingPermissionsOperationsExtensions.cs @@ -21,6 +21,46 @@ namespace Microsoft.Azure.Management.Billing /// public static partial class BillingPermissionsOperationsExtensions { + /// + /// Lists all billing permissions the caller has for a customer. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Customer name. + /// + public static BillingPermissionsListResult ListByCustomer(this IBillingPermissionsOperations operations, string billingAccountName, string customerName) + { + return operations.ListByCustomerAsync(billingAccountName, customerName).GetAwaiter().GetResult(); + } + + /// + /// Lists all billing permissions the caller has for a customer. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Customer name. + /// + /// + /// The cancellation token. + /// + public static async Task ListByCustomerAsync(this IBillingPermissionsOperations operations, string billingAccountName, string customerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByCustomerWithHttpMessagesAsync(billingAccountName, customerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Lists all billing permissions for the caller under a billing account. /// @@ -64,12 +104,15 @@ public static BillingPermissionsListResult ListByBillingAccount(this IBillingPer /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// - public static BillingPermissionsListResult ListByInvoiceSections(this IBillingPermissionsOperations operations, string billingAccountName, string invoiceSectionName) + public static BillingPermissionsListResult ListByInvoiceSections(this IBillingPermissionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName) { - return operations.ListByInvoiceSectionsAsync(billingAccountName, invoiceSectionName).GetAwaiter().GetResult(); + return operations.ListByInvoiceSectionsAsync(billingAccountName, billingProfileName, invoiceSectionName).GetAwaiter().GetResult(); } /// @@ -81,22 +124,25 @@ public static BillingPermissionsListResult ListByInvoiceSections(this IBillingPe /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// /// The cancellation token. /// - public static async Task ListByInvoiceSectionsAsync(this IBillingPermissionsOperations operations, string billingAccountName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListByInvoiceSectionsAsync(this IBillingPermissionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByInvoiceSectionsWithHttpMessagesAsync(billingAccountName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByInvoiceSectionsWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Lists all billingPermissions for the caller has for a billing account. + /// Lists all billing permissions the caller has for a billing account. /// /// /// The operations group for this extension method. @@ -113,7 +159,7 @@ public static BillingPermissionsListResult ListByBillingProfile(this IBillingPer } /// - /// Lists all billingPermissions for the caller has for a billing account. + /// Lists all billing permissions the caller has for a billing account. /// /// /// The operations group for this extension method. diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingProfilesOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingProfilesOperations.cs index 9eece86c0e50b..061988d6dd628 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingProfilesOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingProfilesOperations.cs @@ -80,7 +80,7 @@ internal BillingProfilesOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -100,7 +100,7 @@ internal BillingProfilesOperations(BillingManagementClient client) tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("expand", expand); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -429,6 +429,31 @@ internal BillingProfilesOperations(BillingManagementClient client) return _result; } + /// + /// The operation to create a BillingProfile. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Request parameters supplied to the Create BillingProfile operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, BillingProfileCreationRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(billingAccountName, billingProfileName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + /// /// The operation to update a billing profile. /// @@ -439,7 +464,7 @@ internal BillingProfilesOperations(BillingManagementClient client) /// Billing Profile Id. /// /// - /// Parameters supplied to the update billing profile operation. + /// Request parameters supplied to the update billing profile operation. /// /// /// The headers that will be added to request. @@ -454,6 +479,219 @@ internal BillingProfilesOperations(BillingManagementClient client) return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } + /// + /// The operation to create a BillingProfile. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Request parameters supplied to the Create BillingProfile 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> BeginCreateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, BillingProfileCreationRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + 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("PUT"); + _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; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // 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; + } + /// /// The operation to update a billing profile. /// @@ -464,7 +702,7 @@ internal BillingProfilesOperations(BillingManagementClient client) /// Billing Profile Id. /// /// - /// Parameters supplied to the update billing profile operation. + /// Request parameters supplied to the update billing profile operation. /// /// /// Headers that will be added to request. @@ -535,7 +773,7 @@ internal BillingProfilesOperations(BillingManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("PATCH"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingProfilesOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingProfilesOperationsExtensions.cs index 7d9e353cfb461..a38bc7332d4e1 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingProfilesOperationsExtensions.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingProfilesOperationsExtensions.cs @@ -33,9 +33,9 @@ public static partial class BillingProfilesOperationsExtensions /// /// May be used to expand the invoiceSections. /// - public static BillingProfileListResult ListByBillingAccountName(this IBillingProfilesOperations operations, string billingAccountName, string expand = default(string)) + public static BillingProfileListResult ListByBillingAccount(this IBillingProfilesOperations operations, string billingAccountName, string expand = default(string)) { - return operations.ListByBillingAccountNameAsync(billingAccountName, expand).GetAwaiter().GetResult(); + return operations.ListByBillingAccountAsync(billingAccountName, expand).GetAwaiter().GetResult(); } /// @@ -53,9 +53,9 @@ public static partial class BillingProfilesOperationsExtensions /// /// The cancellation token. /// - public static async Task ListByBillingAccountNameAsync(this IBillingProfilesOperations operations, string billingAccountName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListByBillingAccountAsync(this IBillingProfilesOperations operations, string billingAccountName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByBillingAccountNameWithHttpMessagesAsync(billingAccountName, expand, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, expand, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -107,6 +107,52 @@ public static partial class BillingProfilesOperationsExtensions } } + /// + /// The operation to create a BillingProfile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Request parameters supplied to the Create BillingProfile operation. + /// + public static BillingProfile Create(this IBillingProfilesOperations operations, string billingAccountName, string billingProfileName, BillingProfileCreationRequest parameters) + { + return operations.CreateAsync(billingAccountName, billingProfileName, parameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to create a BillingProfile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Request parameters supplied to the Create BillingProfile operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IBillingProfilesOperations operations, string billingAccountName, string billingProfileName, BillingProfileCreationRequest parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(billingAccountName, billingProfileName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// The operation to update a billing profile. /// @@ -120,7 +166,7 @@ public static partial class BillingProfilesOperationsExtensions /// Billing Profile Id. /// /// - /// Parameters supplied to the update billing profile operation. + /// Request parameters supplied to the update billing profile operation. /// public static BillingProfile Update(this IBillingProfilesOperations operations, string billingAccountName, string billingProfileName, BillingProfile parameters) { @@ -140,7 +186,7 @@ public static BillingProfile Update(this IBillingProfilesOperations operations, /// Billing Profile Id. /// /// - /// Parameters supplied to the update billing profile operation. + /// Request parameters supplied to the update billing profile operation. /// /// /// The cancellation token. @@ -153,6 +199,52 @@ public static BillingProfile Update(this IBillingProfilesOperations operations, } } + /// + /// The operation to create a BillingProfile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Request parameters supplied to the Create BillingProfile operation. + /// + public static BillingProfile BeginCreate(this IBillingProfilesOperations operations, string billingAccountName, string billingProfileName, BillingProfileCreationRequest parameters) + { + return operations.BeginCreateAsync(billingAccountName, billingProfileName, parameters).GetAwaiter().GetResult(); + } + + /// + /// The operation to create a BillingProfile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Request parameters supplied to the Create BillingProfile operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateAsync(this IBillingProfilesOperations operations, string billingAccountName, string billingProfileName, BillingProfileCreationRequest parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(billingAccountName, billingProfileName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// The operation to update a billing profile. /// @@ -166,7 +258,7 @@ public static BillingProfile Update(this IBillingProfilesOperations operations, /// Billing Profile Id. /// /// - /// Parameters supplied to the update billing profile operation. + /// Request parameters supplied to the update billing profile operation. /// public static BillingProfile BeginUpdate(this IBillingProfilesOperations operations, string billingAccountName, string billingProfileName, BillingProfile parameters) { @@ -186,7 +278,7 @@ public static BillingProfile BeginUpdate(this IBillingProfilesOperations operati /// Billing Profile Id. /// /// - /// Parameters supplied to the update billing profile operation. + /// Request parameters supplied to the update billing profile operation. /// /// /// The cancellation token. diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingPropertyOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingPropertyOperations.cs index beaef84cd1f68..2fc34c5602fd8 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingPropertyOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingPropertyOperations.cs @@ -52,7 +52,7 @@ internal BillingPropertyOperations(BillingManagementClient client) /// /// Get billing property by subscription Id. - /// + /// /// /// /// Headers that will be added to request. diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingPropertyOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingPropertyOperationsExtensions.cs index 1cd9c6c24a446..99b7476e92a25 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingPropertyOperationsExtensions.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingPropertyOperationsExtensions.cs @@ -23,7 +23,7 @@ public static partial class BillingPropertyOperationsExtensions { /// /// Get billing property by subscription Id. - /// + /// /// /// /// The operations group for this extension method. @@ -35,7 +35,7 @@ public static BillingProperty Get(this IBillingPropertyOperations operations) /// /// Get billing property by subscription Id. - /// + /// /// /// /// The operations group for this extension method. diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingRoleAssignmentsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingRoleAssignmentsOperations.cs index ad2df2ce04443..5375183fd3b56 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingRoleAssignmentsOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingRoleAssignmentsOperations.cs @@ -108,7 +108,7 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments/{billingRoleAssignmentName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingRoleAssignmentName}", System.Uri.EscapeDataString(billingRoleAssignmentName)); List _queryParameters = new List(); @@ -266,7 +266,7 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> DeleteByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> DeleteByBillingAccountWithHttpMessagesAsync(string billingAccountName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -290,11 +290,11 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingRoleAssignmentName", billingRoleAssignmentName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "DeleteByBillingAccountName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "DeleteByBillingAccount", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments/{billingRoleAssignmentName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingRoleAssignmentName}", System.Uri.EscapeDataString(billingRoleAssignmentName)); List _queryParameters = new List(); @@ -428,6 +428,9 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -455,7 +458,7 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -465,6 +468,10 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } if (invoiceSectionName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); @@ -481,15 +488,17 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("billingRoleAssignmentName", billingRoleAssignmentName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetByInvoiceSectionName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetByInvoiceSection", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleAssignments/{billingRoleAssignmentName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); _url = _url.Replace("{billingRoleAssignmentName}", System.Uri.EscapeDataString(billingRoleAssignmentName)); List _queryParameters = new List(); @@ -623,6 +632,9 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -650,7 +662,7 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> DeleteByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> DeleteByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -660,6 +672,10 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } if (invoiceSectionName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); @@ -676,15 +692,17 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("billingRoleAssignmentName", billingRoleAssignmentName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "DeleteByInvoiceSectionName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "DeleteByInvoiceSection", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleAssignments/{billingRoleAssignmentName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); _url = _url.Replace("{billingRoleAssignmentName}", System.Uri.EscapeDataString(billingRoleAssignmentName)); List _queryParameters = new List(); @@ -845,7 +863,7 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -874,11 +892,11 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("billingRoleAssignmentName", billingRoleAssignmentName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetByBillingProfileName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetByBillingProfile", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/{billingRoleAssignmentName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{billingRoleAssignmentName}", System.Uri.EscapeDataString(billingRoleAssignmentName)); @@ -1040,7 +1058,7 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> DeleteByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> DeleteByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -1069,11 +1087,11 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("billingRoleAssignmentName", billingRoleAssignmentName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "DeleteByBillingProfileName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "DeleteByBillingProfile", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/{billingRoleAssignmentName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{billingRoleAssignmentName}", System.Uri.EscapeDataString(billingRoleAssignmentName)); @@ -1229,7 +1247,7 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -1248,11 +1266,11 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingRoleAssignments").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -1385,6 +1403,9 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// billing Account Id. /// + /// + /// Parameters supplied to add a role assignment. + /// /// /// Headers that will be added to request. /// @@ -1406,7 +1427,7 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> AddByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> AddByBillingAccountWithHttpMessagesAsync(string billingAccountName, BillingRoleAssignmentPayload parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -1416,7 +1437,10 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } - BillingRoleAssignmentPayload parameters = new BillingRoleAssignmentPayload(); + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1427,11 +1451,11 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "AddByBillingAccountName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "AddByBillingAccount", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/createBillingRoleAssignment").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/createBillingRoleAssignment").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -1570,6 +1594,9 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -1594,7 +1621,7 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -1604,6 +1631,10 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } if (invoiceSectionName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); @@ -1616,14 +1647,16 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSectionName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSection", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingRoleAssignments").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleAssignments").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -1756,9 +1789,15 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// + /// + /// Parameters supplied to add a role assignment. + /// /// /// Headers that will be added to request. /// @@ -1780,7 +1819,7 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> AddByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> AddByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, BillingRoleAssignmentPayload parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -1790,11 +1829,18 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } if (invoiceSectionName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); } - BillingRoleAssignmentPayload parameters = new BillingRoleAssignmentPayload(); + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1803,15 +1849,17 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "AddByInvoiceSectionName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "AddByInvoiceSection", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/createBillingRoleAssignment").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/createBillingRoleAssignment").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -1974,7 +2022,7 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -1998,11 +2046,11 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingRoleAssignments").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); List _queryParameters = new List(); @@ -2139,6 +2187,9 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// Billing Profile Id. /// + /// + /// Parameters supplied to add a role assignment. + /// /// /// Headers that will be added to request. /// @@ -2160,7 +2211,7 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> AddByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> AddByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, BillingRoleAssignmentPayload parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -2174,7 +2225,10 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); } - BillingRoleAssignmentPayload parameters = new BillingRoleAssignmentPayload(); + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2186,11 +2240,11 @@ internal BillingRoleAssignmentsOperations(BillingManagementClient client) tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "AddByBillingProfileName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "AddByBillingProfile", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/createBillingRoleAssignment").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/createBillingRoleAssignment").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); List _queryParameters = new List(); diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingRoleAssignmentsOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingRoleAssignmentsOperationsExtensions.cs index c4067a9f8cd30..cb60a1654a818 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingRoleAssignmentsOperationsExtensions.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingRoleAssignmentsOperationsExtensions.cs @@ -73,9 +73,9 @@ public static BillingRoleAssignment GetByBillingAccount(this IBillingRoleAssignm /// /// role assignment id. /// - public static BillingRoleAssignment DeleteByBillingAccountName(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingRoleAssignmentName) + public static BillingRoleAssignment DeleteByBillingAccount(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingRoleAssignmentName) { - return operations.DeleteByBillingAccountNameAsync(billingAccountName, billingRoleAssignmentName).GetAwaiter().GetResult(); + return operations.DeleteByBillingAccountAsync(billingAccountName, billingRoleAssignmentName).GetAwaiter().GetResult(); } /// @@ -93,9 +93,9 @@ public static BillingRoleAssignment DeleteByBillingAccountName(this IBillingRole /// /// The cancellation token. /// - public static async Task DeleteByBillingAccountNameAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingRoleAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteByBillingAccountAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingRoleAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.DeleteByBillingAccountNameWithHttpMessagesAsync(billingAccountName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.DeleteByBillingAccountWithHttpMessagesAsync(billingAccountName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -110,15 +110,18 @@ public static BillingRoleAssignment DeleteByBillingAccountName(this IBillingRole /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// /// role assignment id. /// - public static BillingRoleAssignment GetByInvoiceSectionName(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string invoiceSectionName, string billingRoleAssignmentName) + public static BillingRoleAssignment GetByInvoiceSection(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName) { - return operations.GetByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName, billingRoleAssignmentName).GetAwaiter().GetResult(); + return operations.GetByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName).GetAwaiter().GetResult(); } /// @@ -130,6 +133,9 @@ public static BillingRoleAssignment GetByInvoiceSectionName(this IBillingRoleAss /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -139,9 +145,9 @@ public static BillingRoleAssignment GetByInvoiceSectionName(this IBillingRoleAss /// /// The cancellation token. /// - public static async Task GetByInvoiceSectionNameAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string invoiceSectionName, string billingRoleAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetByInvoiceSectionAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetByInvoiceSectionNameWithHttpMessagesAsync(billingAccountName, invoiceSectionName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -156,15 +162,18 @@ public static BillingRoleAssignment GetByInvoiceSectionName(this IBillingRoleAss /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// /// role assignment id. /// - public static BillingRoleAssignment DeleteByInvoiceSectionName(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string invoiceSectionName, string billingRoleAssignmentName) + public static BillingRoleAssignment DeleteByInvoiceSection(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName) { - return operations.DeleteByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName, billingRoleAssignmentName).GetAwaiter().GetResult(); + return operations.DeleteByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName).GetAwaiter().GetResult(); } /// @@ -176,6 +185,9 @@ public static BillingRoleAssignment DeleteByInvoiceSectionName(this IBillingRole /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -185,9 +197,9 @@ public static BillingRoleAssignment DeleteByInvoiceSectionName(this IBillingRole /// /// The cancellation token. /// - public static async Task DeleteByInvoiceSectionNameAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string invoiceSectionName, string billingRoleAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteByInvoiceSectionAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.DeleteByInvoiceSectionNameWithHttpMessagesAsync(billingAccountName, invoiceSectionName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.DeleteByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -208,9 +220,9 @@ public static BillingRoleAssignment DeleteByInvoiceSectionName(this IBillingRole /// /// role assignment id. /// - public static BillingRoleAssignment GetByBillingProfileName(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string billingRoleAssignmentName) + public static BillingRoleAssignment GetByBillingProfile(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string billingRoleAssignmentName) { - return operations.GetByBillingProfileNameAsync(billingAccountName, billingProfileName, billingRoleAssignmentName).GetAwaiter().GetResult(); + return operations.GetByBillingProfileAsync(billingAccountName, billingProfileName, billingRoleAssignmentName).GetAwaiter().GetResult(); } /// @@ -231,9 +243,9 @@ public static BillingRoleAssignment GetByBillingProfileName(this IBillingRoleAss /// /// The cancellation token. /// - public static async Task GetByBillingProfileNameAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string billingRoleAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetByBillingProfileAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string billingRoleAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetByBillingProfileNameWithHttpMessagesAsync(billingAccountName, billingProfileName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -254,9 +266,9 @@ public static BillingRoleAssignment GetByBillingProfileName(this IBillingRoleAss /// /// role assignment id. /// - public static BillingRoleAssignment DeleteByBillingProfileName(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string billingRoleAssignmentName) + public static BillingRoleAssignment DeleteByBillingProfile(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string billingRoleAssignmentName) { - return operations.DeleteByBillingProfileNameAsync(billingAccountName, billingProfileName, billingRoleAssignmentName).GetAwaiter().GetResult(); + return operations.DeleteByBillingProfileAsync(billingAccountName, billingProfileName, billingRoleAssignmentName).GetAwaiter().GetResult(); } /// @@ -277,9 +289,9 @@ public static BillingRoleAssignment DeleteByBillingProfileName(this IBillingRole /// /// The cancellation token. /// - public static async Task DeleteByBillingProfileNameAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string billingRoleAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteByBillingProfileAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string billingRoleAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.DeleteByBillingProfileNameWithHttpMessagesAsync(billingAccountName, billingProfileName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.DeleteByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -294,9 +306,9 @@ public static BillingRoleAssignment DeleteByBillingProfileName(this IBillingRole /// /// billing Account Id. /// - public static BillingRoleAssignmentListResult ListByBillingAccountName(this IBillingRoleAssignmentsOperations operations, string billingAccountName) + public static BillingRoleAssignmentListResult ListByBillingAccount(this IBillingRoleAssignmentsOperations operations, string billingAccountName) { - return operations.ListByBillingAccountNameAsync(billingAccountName).GetAwaiter().GetResult(); + return operations.ListByBillingAccountAsync(billingAccountName).GetAwaiter().GetResult(); } /// @@ -311,9 +323,9 @@ public static BillingRoleAssignmentListResult ListByBillingAccountName(this IBil /// /// The cancellation token. /// - public static async Task ListByBillingAccountNameAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListByBillingAccountAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByBillingAccountNameWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -328,9 +340,12 @@ public static BillingRoleAssignmentListResult ListByBillingAccountName(this IBil /// /// billing Account Id. /// - public static BillingRoleAssignmentListResult AddByBillingAccountName(this IBillingRoleAssignmentsOperations operations, string billingAccountName) + /// + /// Parameters supplied to add a role assignment. + /// + public static BillingRoleAssignmentListResult AddByBillingAccount(this IBillingRoleAssignmentsOperations operations, string billingAccountName, BillingRoleAssignmentPayload parameters) { - return operations.AddByBillingAccountNameAsync(billingAccountName).GetAwaiter().GetResult(); + return operations.AddByBillingAccountAsync(billingAccountName, parameters).GetAwaiter().GetResult(); } /// @@ -342,12 +357,15 @@ public static BillingRoleAssignmentListResult AddByBillingAccountName(this IBill /// /// billing Account Id. /// + /// + /// Parameters supplied to add a role assignment. + /// /// /// The cancellation token. /// - public static async Task AddByBillingAccountNameAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task AddByBillingAccountAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, BillingRoleAssignmentPayload parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.AddByBillingAccountNameWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.AddByBillingAccountWithHttpMessagesAsync(billingAccountName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -362,12 +380,15 @@ public static BillingRoleAssignmentListResult AddByBillingAccountName(this IBill /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// - public static BillingRoleAssignmentListResult ListByInvoiceSectionName(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string invoiceSectionName) + public static BillingRoleAssignmentListResult ListByInvoiceSection(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName) { - return operations.ListByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName).GetAwaiter().GetResult(); + return operations.ListByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName).GetAwaiter().GetResult(); } /// @@ -379,15 +400,18 @@ public static BillingRoleAssignmentListResult ListByInvoiceSectionName(this IBil /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// /// The cancellation token. /// - public static async Task ListByInvoiceSectionNameAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListByInvoiceSectionAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByInvoiceSectionNameWithHttpMessagesAsync(billingAccountName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -402,12 +426,18 @@ public static BillingRoleAssignmentListResult ListByInvoiceSectionName(this IBil /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// - public static BillingRoleAssignmentListResult AddByInvoiceSectionName(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string invoiceSectionName) + /// + /// Parameters supplied to add a role assignment. + /// + public static BillingRoleAssignmentListResult AddByInvoiceSection(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, BillingRoleAssignmentPayload parameters) { - return operations.AddByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName).GetAwaiter().GetResult(); + return operations.AddByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters).GetAwaiter().GetResult(); } /// @@ -419,15 +449,21 @@ public static BillingRoleAssignmentListResult AddByInvoiceSectionName(this IBill /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// + /// + /// Parameters supplied to add a role assignment. + /// /// /// The cancellation token. /// - public static async Task AddByInvoiceSectionNameAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task AddByInvoiceSectionAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, BillingRoleAssignmentPayload parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.AddByInvoiceSectionNameWithHttpMessagesAsync(billingAccountName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.AddByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -445,9 +481,9 @@ public static BillingRoleAssignmentListResult AddByInvoiceSectionName(this IBill /// /// Billing Profile Id. /// - public static BillingRoleAssignmentListResult ListByBillingProfileName(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName) + public static BillingRoleAssignmentListResult ListByBillingProfile(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName) { - return operations.ListByBillingProfileNameAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + return operations.ListByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); } /// @@ -465,9 +501,9 @@ public static BillingRoleAssignmentListResult ListByBillingProfileName(this IBil /// /// The cancellation token. /// - public static async Task ListByBillingProfileNameAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListByBillingProfileAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByBillingProfileNameWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -485,9 +521,12 @@ public static BillingRoleAssignmentListResult ListByBillingProfileName(this IBil /// /// Billing Profile Id. /// - public static BillingRoleAssignmentListResult AddByBillingProfileName(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName) + /// + /// Parameters supplied to add a role assignment. + /// + public static BillingRoleAssignmentListResult AddByBillingProfile(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, BillingRoleAssignmentPayload parameters) { - return operations.AddByBillingProfileNameAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + return operations.AddByBillingProfileAsync(billingAccountName, billingProfileName, parameters).GetAwaiter().GetResult(); } /// @@ -502,12 +541,15 @@ public static BillingRoleAssignmentListResult AddByBillingProfileName(this IBill /// /// Billing Profile Id. /// + /// + /// Parameters supplied to add a role assignment. + /// /// /// The cancellation token. /// - public static async Task AddByBillingProfileNameAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task AddByBillingProfileAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, BillingRoleAssignmentPayload parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.AddByBillingProfileNameWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.AddByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingRoleDefinitionsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingRoleDefinitionsOperations.cs index 3388eb2759dad..db1c6fc46e7f4 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingRoleDefinitionsOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingRoleDefinitionsOperations.cs @@ -80,7 +80,7 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, string billingRoleDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetByBillingAccountWithHttpMessagesAsync(string billingAccountName, string billingRoleDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -104,11 +104,11 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingRoleDefinitionName", billingRoleDefinitionName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetByBillingAccountName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetByBillingAccount", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingRoleDefinitions/{billingRoleDefinitionName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleDefinitions/{billingRoleDefinitionName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingRoleDefinitionName}", System.Uri.EscapeDataString(billingRoleDefinitionName)); List _queryParameters = new List(); @@ -242,6 +242,9 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -269,7 +272,7 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string billingRoleDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -279,6 +282,10 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } if (invoiceSectionName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); @@ -295,15 +302,17 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("billingRoleDefinitionName", billingRoleDefinitionName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetByInvoiceSectionName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetByInvoiceSection", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingRoleDefinitions/{billingRoleDefinitionName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleDefinitions/{billingRoleDefinitionName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); _url = _url.Replace("{billingRoleDefinitionName}", System.Uri.EscapeDataString(billingRoleDefinitionName)); List _queryParameters = new List(); @@ -464,7 +473,7 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -493,11 +502,11 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("billingRoleDefinitionName", billingRoleDefinitionName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetByBillingProfileName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetByBillingProfile", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingRoleDefinitions/{billingRoleDefinitionName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions/{billingRoleDefinitionName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{billingRoleDefinitionName}", System.Uri.EscapeDataString(billingRoleDefinitionName)); @@ -653,7 +662,7 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -672,11 +681,11 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingRoleDefinitions").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleDefinitions").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -809,6 +818,9 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -833,7 +845,7 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -843,6 +855,10 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } if (invoiceSectionName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); @@ -855,14 +871,16 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSectionName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSection", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingRoleDefinitions").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleDefinitions").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -1019,7 +1037,7 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -1043,11 +1061,11 @@ internal BillingRoleDefinitionsOperations(BillingManagementClient client) tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingRoleDefinitions").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); List _queryParameters = new List(); diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingRoleDefinitionsOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingRoleDefinitionsOperationsExtensions.cs index cb1c83e8c9233..10e68be3ec676 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingRoleDefinitionsOperationsExtensions.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingRoleDefinitionsOperationsExtensions.cs @@ -33,9 +33,9 @@ public static partial class BillingRoleDefinitionsOperationsExtensions /// /// role definition id. /// - public static BillingRoleDefinition GetByBillingAccountName(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingRoleDefinitionName) + public static BillingRoleDefinition GetByBillingAccount(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingRoleDefinitionName) { - return operations.GetByBillingAccountNameAsync(billingAccountName, billingRoleDefinitionName).GetAwaiter().GetResult(); + return operations.GetByBillingAccountAsync(billingAccountName, billingRoleDefinitionName).GetAwaiter().GetResult(); } /// @@ -53,9 +53,9 @@ public static BillingRoleDefinition GetByBillingAccountName(this IBillingRoleDef /// /// The cancellation token. /// - public static async Task GetByBillingAccountNameAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingRoleDefinitionName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetByBillingAccountAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingRoleDefinitionName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetByBillingAccountNameWithHttpMessagesAsync(billingAccountName, billingRoleDefinitionName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetByBillingAccountWithHttpMessagesAsync(billingAccountName, billingRoleDefinitionName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -70,15 +70,18 @@ public static BillingRoleDefinition GetByBillingAccountName(this IBillingRoleDef /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// /// role definition id. /// - public static BillingRoleDefinition GetByInvoiceSectionName(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string invoiceSectionName, string billingRoleDefinitionName) + public static BillingRoleDefinition GetByInvoiceSection(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleDefinitionName) { - return operations.GetByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName, billingRoleDefinitionName).GetAwaiter().GetResult(); + return operations.GetByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleDefinitionName).GetAwaiter().GetResult(); } /// @@ -90,6 +93,9 @@ public static BillingRoleDefinition GetByInvoiceSectionName(this IBillingRoleDef /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -99,9 +105,9 @@ public static BillingRoleDefinition GetByInvoiceSectionName(this IBillingRoleDef /// /// The cancellation token. /// - public static async Task GetByInvoiceSectionNameAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string invoiceSectionName, string billingRoleDefinitionName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetByInvoiceSectionAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleDefinitionName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetByInvoiceSectionNameWithHttpMessagesAsync(billingAccountName, invoiceSectionName, billingRoleDefinitionName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleDefinitionName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -122,9 +128,9 @@ public static BillingRoleDefinition GetByInvoiceSectionName(this IBillingRoleDef /// /// role definition id. /// - public static BillingRoleDefinition GetByBillingProfileName(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, string billingRoleDefinitionName) + public static BillingRoleDefinition GetByBillingProfile(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, string billingRoleDefinitionName) { - return operations.GetByBillingProfileNameAsync(billingAccountName, billingProfileName, billingRoleDefinitionName).GetAwaiter().GetResult(); + return operations.GetByBillingProfileAsync(billingAccountName, billingProfileName, billingRoleDefinitionName).GetAwaiter().GetResult(); } /// @@ -145,9 +151,9 @@ public static BillingRoleDefinition GetByBillingProfileName(this IBillingRoleDef /// /// The cancellation token. /// - public static async Task GetByBillingProfileNameAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, string billingRoleDefinitionName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetByBillingProfileAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, string billingRoleDefinitionName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetByBillingProfileNameWithHttpMessagesAsync(billingAccountName, billingProfileName, billingRoleDefinitionName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, billingRoleDefinitionName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -162,9 +168,9 @@ public static BillingRoleDefinition GetByBillingProfileName(this IBillingRoleDef /// /// billing Account Id. /// - public static BillingRoleDefinitionListResult ListByBillingAccountName(this IBillingRoleDefinitionsOperations operations, string billingAccountName) + public static BillingRoleDefinitionListResult ListByBillingAccount(this IBillingRoleDefinitionsOperations operations, string billingAccountName) { - return operations.ListByBillingAccountNameAsync(billingAccountName).GetAwaiter().GetResult(); + return operations.ListByBillingAccountAsync(billingAccountName).GetAwaiter().GetResult(); } /// @@ -179,9 +185,9 @@ public static BillingRoleDefinitionListResult ListByBillingAccountName(this IBil /// /// The cancellation token. /// - public static async Task ListByBillingAccountNameAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListByBillingAccountAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByBillingAccountNameWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -196,12 +202,15 @@ public static BillingRoleDefinitionListResult ListByBillingAccountName(this IBil /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// - public static BillingRoleDefinitionListResult ListByInvoiceSectionName(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string invoiceSectionName) + public static BillingRoleDefinitionListResult ListByInvoiceSection(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName) { - return operations.ListByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName).GetAwaiter().GetResult(); + return operations.ListByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName).GetAwaiter().GetResult(); } /// @@ -213,15 +222,18 @@ public static BillingRoleDefinitionListResult ListByInvoiceSectionName(this IBil /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// /// The cancellation token. /// - public static async Task ListByInvoiceSectionNameAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListByInvoiceSectionAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByInvoiceSectionNameWithHttpMessagesAsync(billingAccountName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -239,9 +251,9 @@ public static BillingRoleDefinitionListResult ListByInvoiceSectionName(this IBil /// /// Billing Profile Id. /// - public static BillingRoleDefinitionListResult ListByBillingProfileName(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName) + public static BillingRoleDefinitionListResult ListByBillingProfile(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName) { - return operations.ListByBillingProfileNameAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + return operations.ListByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); } /// @@ -259,9 +271,9 @@ public static BillingRoleDefinitionListResult ListByBillingProfileName(this IBil /// /// The cancellation token. /// - public static async Task ListByBillingProfileNameAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListByBillingProfileAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByBillingProfileNameWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingSubscriptionsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingSubscriptionsOperations.cs index 08090ecc31179..fa77fa944c0a0 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingSubscriptionsOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingSubscriptionsOperations.cs @@ -51,12 +51,15 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) public BillingManagementClient Client { get; private set; } /// - /// Lists billing subscriptions by billing account name. + /// Lists billing subscription by customer id. /// /// /// /// billing Account Id. /// + /// + /// Customer name. + /// /// /// Headers that will be added to request. /// @@ -78,12 +81,16 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (billingAccountName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } + if (customerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "customerName"); + } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -96,13 +103,15 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("customerName", customerName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByCustomer", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/billingSubscriptions").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -196,7 +205,7 @@ internal BillingSubscriptionsOperations(BillingManagementClient 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")) @@ -209,7 +218,7 @@ internal BillingSubscriptionsOperations(BillingManagementClient 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) { @@ -229,14 +238,17 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) } /// - /// Lists billing subscriptions by billing profile name. + /// Get a single billing subscription by id. /// /// /// /// billing Account Id. /// - /// - /// Billing Profile Id. + /// + /// Customer name. + /// + /// + /// Billing Subscription Id. /// /// /// Headers that will be added to request. @@ -259,15 +271,19 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, string billingSubscriptionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (billingAccountName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } - if (billingProfileName == null) + if (customerName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + throw new ValidationException(ValidationRules.CannotBeNull, "customerName"); + } + if (billingSubscriptionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingSubscriptionName"); } if (Client.ApiVersion == null) { @@ -281,15 +297,17 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); - tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("customerName", customerName); + tracingParameters.Add("billingSubscriptionName", billingSubscriptionName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetByCustomer", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingSubscriptions").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/billingSubscriptions/{billingSubscriptionName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); - _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); + _url = _url.Replace("{billingSubscriptionName}", System.Uri.EscapeDataString(billingSubscriptionName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -383,7 +401,7 @@ internal BillingSubscriptionsOperations(BillingManagementClient 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")) @@ -396,7 +414,7 @@ internal BillingSubscriptionsOperations(BillingManagementClient 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) { @@ -416,15 +434,12 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) } /// - /// Lists billing subscription by invoice section name. - /// + /// Lists billing subscriptions by billing account name. + /// /// /// /// billing Account Id. /// - /// - /// InvoiceSection Id. - /// /// /// Headers that will be added to request. /// @@ -446,16 +461,12 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (billingAccountName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } - if (invoiceSectionName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); - } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -468,15 +479,13 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); - tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSectionName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/billingSubscriptions").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); - _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -570,7 +579,7 @@ internal BillingSubscriptionsOperations(BillingManagementClient 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")) @@ -583,7 +592,7 @@ internal BillingSubscriptionsOperations(BillingManagementClient 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) { @@ -603,17 +612,14 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) } /// - /// Get a single billing subscription by name. - /// + /// Lists billing subscriptions by billing profile name. + /// /// /// /// billing Account Id. /// - /// - /// InvoiceSection Id. - /// - /// - /// Billing Subscription Id. + /// + /// Billing Profile Id. /// /// /// Headers that will be added to request. @@ -636,19 +642,15 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string billingSubscriptionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (billingAccountName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } - if (invoiceSectionName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); - } - if (billingSubscriptionName == null) + if (billingProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingSubscriptionName"); + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); } if (Client.ApiVersion == null) { @@ -662,17 +664,15 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); - tracingParameters.Add("invoiceSectionName", invoiceSectionName); - tracingParameters.Add("billingSubscriptionName", billingSubscriptionName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/billingSubscriptions/{billingSubscriptionName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingSubscriptions").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); - _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); - _url = _url.Replace("{billingSubscriptionName}", System.Uri.EscapeDataString(billingSubscriptionName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -766,7 +766,7 @@ internal BillingSubscriptionsOperations(BillingManagementClient 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")) @@ -779,7 +779,7 @@ internal BillingSubscriptionsOperations(BillingManagementClient 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) { @@ -799,50 +799,18 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) } /// - /// Transfers the subscription from one invoice section to another within a - /// billing account. + /// Lists billing subscription by invoice section name. + /// /// /// /// billing Account Id. /// - /// - /// InvoiceSection Id. - /// - /// - /// Billing Subscription Id. - /// - /// - /// Parameters supplied to the Transfer Billing Subscription operation. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> TransferWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginTransferWithHttpMessagesAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Transfers the subscription from one invoice section to another within a - /// billing account. - /// - /// - /// billing Account Id. + /// + /// Billing Profile Id. /// /// /// InvoiceSection Id. /// - /// - /// Billing Subscription Id. - /// - /// - /// Parameters supplied to the Transfer Billing Subscription operation. - /// /// /// Headers that will be added to request. /// @@ -864,23 +832,23 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginTransferWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (billingAccountName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } - if (invoiceSectionName == null) + if (billingProfileName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); } - if (billingSubscriptionName == null) + if (invoiceSectionName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "billingSubscriptionName"); + throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); } - if (parameters == null) + if (Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -890,19 +858,22 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); - tracingParameters.Add("billingSubscriptionName", billingSubscriptionName); - tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginTransfer", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSection", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/billingSubscriptions/{billingSubscriptionName}/transfer").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingSubscriptions").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); - _url = _url.Replace("{billingSubscriptionName}", System.Uri.EscapeDataString(billingSubscriptionName)); 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); @@ -910,7 +881,7 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -941,12 +912,6 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) // Serialize Request string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -967,7 +932,7 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202) + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -997,7 +962,7 @@ internal BillingSubscriptionsOperations(BillingManagementClient 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")) @@ -1010,7 +975,7 @@ internal BillingSubscriptionsOperations(BillingManagementClient 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) { @@ -1022,19 +987,6 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) 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); @@ -1043,8 +995,848 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) } /// - /// Lists billing subscriptions by billing account name. - /// + /// Get a single billing subscription by name. + /// + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// InvoiceSection Id. + /// + /// + /// Billing Subscription 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 billingAccountName, string billingProfileName, string invoiceSectionName, string billingSubscriptionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + if (invoiceSectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); + } + if (billingSubscriptionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingSubscriptionName"); + } + 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("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("invoiceSectionName", invoiceSectionName); + tracingParameters.Add("billingSubscriptionName", billingSubscriptionName); + 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/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingSubscriptions/{billingSubscriptionName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); + _url = _url.Replace("{billingSubscriptionName}", System.Uri.EscapeDataString(billingSubscriptionName)); + 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; + } + + /// + /// Transfers the subscription from one invoice section to another within a + /// billing account. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// InvoiceSection Id. + /// + /// + /// Billing Subscription Id. + /// + /// + /// Request parameters supplied to the Transfer Billing Subscription operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> TransferWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginTransferWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, billingSubscriptionName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Validates the transfer of billing subscriptions across invoice sections. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// InvoiceSection Id. + /// + /// + /// Billing Subscription Id. + /// + /// + /// Parameters supplied to the Transfer Billing Subscription 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> ValidateTransferWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + if (invoiceSectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); + } + if (billingSubscriptionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingSubscriptionName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("invoiceSectionName", invoiceSectionName); + tracingParameters.Add("billingSubscriptionName", billingSubscriptionName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ValidateTransfer", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingSubscriptions/{billingSubscriptionName}/validateTransferEligibility").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); + _url = _url.Replace("{billingSubscriptionName}", System.Uri.EscapeDataString(billingSubscriptionName)); + 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("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; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // 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; + } + + /// + /// Transfers the subscription from one invoice section to another within a + /// billing account. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// InvoiceSection Id. + /// + /// + /// Billing Subscription Id. + /// + /// + /// Request parameters supplied to the Transfer Billing Subscription 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> BeginTransferWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + if (invoiceSectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); + } + if (billingSubscriptionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingSubscriptionName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("invoiceSectionName", invoiceSectionName); + tracingParameters.Add("billingSubscriptionName", billingSubscriptionName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginTransfer", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingSubscriptions/{billingSubscriptionName}/transfer").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); + _url = _url.Replace("{billingSubscriptionName}", System.Uri.EscapeDataString(billingSubscriptionName)); + 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("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; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // 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 billing subscription by customer id. + /// + /// + /// + /// 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>> ListByCustomerNextWithHttpMessagesAsync(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, "ListByCustomerNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists billing subscriptions by billing account name. + /// /// /// /// The NextLink from the previous successful call to List operation. @@ -1070,7 +1862,7 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingAccountNameNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -1085,7 +1877,7 @@ internal BillingSubscriptionsOperations(BillingManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNameNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -1179,7 +1971,7 @@ internal BillingSubscriptionsOperations(BillingManagementClient 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")) @@ -1192,7 +1984,7 @@ internal BillingSubscriptionsOperations(BillingManagementClient 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/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingSubscriptionsOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingSubscriptionsOperationsExtensions.cs index b0c9011256f2f..e4cc2f127fb06 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingSubscriptionsOperationsExtensions.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/BillingSubscriptionsOperationsExtensions.cs @@ -22,7 +22,7 @@ namespace Microsoft.Azure.Management.Billing public static partial class BillingSubscriptionsOperationsExtensions { /// - /// Lists billing subscriptions by billing account name. + /// Lists billing subscription by customer id. /// /// /// @@ -31,13 +31,16 @@ public static partial class BillingSubscriptionsOperationsExtensions /// /// billing Account Id. /// - public static IPage ListByBillingAccountName(this IBillingSubscriptionsOperations operations, string billingAccountName) + /// + /// Customer name. + /// + public static IPage ListByCustomer(this IBillingSubscriptionsOperations operations, string billingAccountName, string customerName) { - return operations.ListByBillingAccountNameAsync(billingAccountName).GetAwaiter().GetResult(); + return operations.ListByCustomerAsync(billingAccountName, customerName).GetAwaiter().GetResult(); } /// - /// Lists billing subscriptions by billing account name. + /// Lists billing subscription by customer id. /// /// /// @@ -46,19 +49,43 @@ public static IPage ListByBillingAccountName(this IB /// /// billing Account Id. /// + /// + /// Customer name. + /// /// /// The cancellation token. /// - public static async Task> ListByBillingAccountNameAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByCustomerAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string customerName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByBillingAccountNameWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByCustomerWithHttpMessagesAsync(billingAccountName, customerName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Lists billing subscriptions by billing profile name. + /// Get a single billing subscription by id. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Customer name. + /// + /// + /// Billing Subscription Id. + /// + public static BillingSubscription GetByCustomer(this IBillingSubscriptionsOperations operations, string billingAccountName, string customerName, string billingSubscriptionName) + { + return operations.GetByCustomerAsync(billingAccountName, customerName, billingSubscriptionName).GetAwaiter().GetResult(); + } + + /// + /// Get a single billing subscription by id. /// /// /// @@ -67,17 +94,80 @@ public static IPage ListByBillingAccountName(this IB /// /// billing Account Id. /// + /// + /// Customer name. + /// + /// + /// Billing Subscription Id. + /// + /// + /// The cancellation token. + /// + public static async Task GetByCustomerAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string customerName, string billingSubscriptionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetByCustomerWithHttpMessagesAsync(billingAccountName, customerName, billingSubscriptionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists billing subscriptions by billing account name. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + public static IPage ListByBillingAccount(this IBillingSubscriptionsOperations operations, string billingAccountName) + { + return operations.ListByBillingAccountAsync(billingAccountName).GetAwaiter().GetResult(); + } + + /// + /// Lists billing subscriptions by billing account name. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingAccountAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists billing subscriptions by billing profile name. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// /// /// Billing Profile Id. /// - public static BillingSubscriptionsListResult ListByBillingProfileName(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName) + public static BillingSubscriptionsListResult ListByBillingProfile(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName) { - return operations.ListByBillingProfileNameAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + return operations.ListByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); } /// /// Lists billing subscriptions by billing profile name. - /// + /// /// /// /// The operations group for this extension method. @@ -91,9 +181,9 @@ public static BillingSubscriptionsListResult ListByBillingProfileName(this IBill /// /// The cancellation token. /// - public static async Task ListByBillingProfileNameAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListByBillingProfileAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByBillingProfileNameWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -101,7 +191,7 @@ public static BillingSubscriptionsListResult ListByBillingProfileName(this IBill /// /// Lists billing subscription by invoice section name. - /// + /// /// /// /// The operations group for this extension method. @@ -109,17 +199,20 @@ public static BillingSubscriptionsListResult ListByBillingProfileName(this IBill /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// - public static BillingSubscriptionsListResult ListByInvoiceSectionName(this IBillingSubscriptionsOperations operations, string billingAccountName, string invoiceSectionName) + public static BillingSubscriptionsListResult ListByInvoiceSection(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName) { - return operations.ListByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName).GetAwaiter().GetResult(); + return operations.ListByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName).GetAwaiter().GetResult(); } /// /// Lists billing subscription by invoice section name. - /// + /// /// /// /// The operations group for this extension method. @@ -127,15 +220,18 @@ public static BillingSubscriptionsListResult ListByInvoiceSectionName(this IBill /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// /// The cancellation token. /// - public static async Task ListByInvoiceSectionNameAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListByInvoiceSectionAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByInvoiceSectionNameWithHttpMessagesAsync(billingAccountName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -143,7 +239,7 @@ public static BillingSubscriptionsListResult ListByInvoiceSectionName(this IBill /// /// Get a single billing subscription by name. - /// + /// /// /// /// The operations group for this extension method. @@ -151,20 +247,23 @@ public static BillingSubscriptionsListResult ListByInvoiceSectionName(this IBill /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// /// Billing Subscription Id. /// - public static BillingSubscriptionSummary Get(this IBillingSubscriptionsOperations operations, string billingAccountName, string invoiceSectionName, string billingSubscriptionName) + public static BillingSubscription Get(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingSubscriptionName) { - return operations.GetAsync(billingAccountName, invoiceSectionName, billingSubscriptionName).GetAwaiter().GetResult(); + return operations.GetAsync(billingAccountName, billingProfileName, invoiceSectionName, billingSubscriptionName).GetAwaiter().GetResult(); } /// /// Get a single billing subscription by name. - /// + /// /// /// /// The operations group for this extension method. @@ -172,6 +271,9 @@ public static BillingSubscriptionSummary Get(this IBillingSubscriptionsOperation /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -181,9 +283,9 @@ public static BillingSubscriptionSummary Get(this IBillingSubscriptionsOperation /// /// The cancellation token. /// - public static async Task GetAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string invoiceSectionName, string billingSubscriptionName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingSubscriptionName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, billingSubscriptionName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -199,6 +301,9 @@ public static BillingSubscriptionSummary Get(this IBillingSubscriptionsOperation /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -206,11 +311,11 @@ public static BillingSubscriptionSummary Get(this IBillingSubscriptionsOperation /// Billing Subscription Id. /// /// - /// Parameters supplied to the Transfer Billing Subscription operation. + /// Request parameters supplied to the Transfer Billing Subscription operation. /// - public static TransferBillingSubscriptionResult Transfer(this IBillingSubscriptionsOperations operations, string billingAccountName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters) + public static TransferBillingSubscriptionResult Transfer(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters) { - return operations.TransferAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, parameters).GetAwaiter().GetResult(); + return operations.TransferAsync(billingAccountName, billingProfileName, invoiceSectionName, billingSubscriptionName, parameters).GetAwaiter().GetResult(); } /// @@ -223,6 +328,67 @@ public static TransferBillingSubscriptionResult Transfer(this IBillingSubscripti /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// + /// + /// InvoiceSection Id. + /// + /// + /// Billing Subscription Id. + /// + /// + /// Request parameters supplied to the Transfer Billing Subscription operation. + /// + /// + /// The cancellation token. + /// + public static async Task TransferAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.TransferWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, billingSubscriptionName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Validates the transfer of billing subscriptions across invoice sections. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// InvoiceSection Id. + /// + /// + /// Billing Subscription Id. + /// + /// + /// Parameters supplied to the Transfer Billing Subscription operation. + /// + public static ValidateSubscriptionTransferEligibilityResult ValidateTransfer(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters) + { + return operations.ValidateTransferAsync(billingAccountName, billingProfileName, invoiceSectionName, billingSubscriptionName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Validates the transfer of billing subscriptions across invoice sections. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -235,9 +401,9 @@ public static TransferBillingSubscriptionResult Transfer(this IBillingSubscripti /// /// The cancellation token. /// - public static async Task TransferAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ValidateTransferAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.TransferWithHttpMessagesAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ValidateTransferWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, billingSubscriptionName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -253,6 +419,9 @@ public static TransferBillingSubscriptionResult Transfer(this IBillingSubscripti /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -260,11 +429,11 @@ public static TransferBillingSubscriptionResult Transfer(this IBillingSubscripti /// Billing Subscription Id. /// /// - /// Parameters supplied to the Transfer Billing Subscription operation. + /// Request parameters supplied to the Transfer Billing Subscription operation. /// - public static TransferBillingSubscriptionResult BeginTransfer(this IBillingSubscriptionsOperations operations, string billingAccountName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters) + public static TransferBillingSubscriptionResult BeginTransfer(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters) { - return operations.BeginTransferAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, parameters).GetAwaiter().GetResult(); + return operations.BeginTransferAsync(billingAccountName, billingProfileName, invoiceSectionName, billingSubscriptionName, parameters).GetAwaiter().GetResult(); } /// @@ -277,6 +446,9 @@ public static TransferBillingSubscriptionResult BeginTransfer(this IBillingSubsc /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -284,21 +456,21 @@ public static TransferBillingSubscriptionResult BeginTransfer(this IBillingSubsc /// Billing Subscription Id. /// /// - /// Parameters supplied to the Transfer Billing Subscription operation. + /// Request parameters supplied to the Transfer Billing Subscription operation. /// /// /// The cancellation token. /// - public static async Task BeginTransferAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginTransferAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.BeginTransferWithHttpMessagesAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginTransferWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, billingSubscriptionName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Lists billing subscriptions by billing account name. + /// Lists billing subscription by customer id. /// /// /// @@ -307,13 +479,13 @@ public static TransferBillingSubscriptionResult BeginTransfer(this IBillingSubsc /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListByBillingAccountNameNext(this IBillingSubscriptionsOperations operations, string nextPageLink) + public static IPage ListByCustomerNext(this IBillingSubscriptionsOperations operations, string nextPageLink) { - return operations.ListByBillingAccountNameNextAsync(nextPageLink).GetAwaiter().GetResult(); + return operations.ListByCustomerNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// - /// Lists billing subscriptions by billing account name. + /// Lists billing subscription by customer id. /// /// /// @@ -325,9 +497,45 @@ public static IPage ListByBillingAccountNameNext(thi /// /// The cancellation token. /// - public static async Task> ListByBillingAccountNameNextAsync(this IBillingSubscriptionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByCustomerNextAsync(this IBillingSubscriptionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByCustomerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists billing subscriptions by billing account name. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByBillingAccountNext(this IBillingSubscriptionsOperations operations, string nextPageLink) + { + return operations.ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists billing subscriptions by billing account name. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingAccountNextAsync(this IBillingSubscriptionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByBillingAccountNameNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/CustomersOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/CustomersOperations.cs new file mode 100644 index 0000000000000..828e3e65281b5 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/CustomersOperations.cs @@ -0,0 +1,989 @@ +// +// 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.Billing +{ + 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; + + /// + /// CustomersOperations operations. + /// + internal partial class CustomersOperations : IServiceOperations, ICustomersOperations + { + /// + /// Initializes a new instance of the CustomersOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CustomersOperations(BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// Lists customers by billing profile which the current user can work with + /// on-behalf of a partner. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// May be used to filter the list of customers. + /// + /// + /// Skiptoken is only used if a previous operation returned a partial result. + /// If a previous response contains a nextLink element, the value of the + /// nextLink element will include a skiptoken parameter that specifies a + /// starting point to use for subsequent calls. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string filter = default(string), string skiptoken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("filter", filter); + tracingParameters.Add("skiptoken", skiptoken); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (skiptoken != null) + { + _queryParameters.Add(string.Format("$skiptoken={0}", System.Uri.EscapeDataString(skiptoken))); + } + 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 customers which the current user can work with on-behalf of a + /// partner. + /// + /// + /// billing Account Id. + /// + /// + /// May be used to filter the list of customers. + /// + /// + /// Skiptoken is only used if a previous operation returned a partial result. + /// If a previous response contains a nextLink element, the value of the + /// nextLink element will include a skiptoken parameter that specifies a + /// starting point to use for subsequent calls. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string filter = default(string), string skiptoken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("filter", filter); + tracingParameters.Add("skiptoken", skiptoken); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (skiptoken != null) + { + _queryParameters.Add(string.Format("$skiptoken={0}", System.Uri.EscapeDataString(skiptoken))); + } + 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; + } + + /// + /// Gets a customer by its id. + /// + /// + /// billing Account Id. + /// + /// + /// Customer name. + /// + /// + /// May be used to expand enabledAzurePlans, resellers. + /// + /// + /// 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 billingAccountName, string customerName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (customerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "customerName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("customerName", customerName); + tracingParameters.Add("expand", expand); + 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/{billingAccountName}/customers/{customerName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + 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 customers by billing profile which the current user can work with + /// on-behalf of a partner. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists customers which the current user can work with on-behalf of a + /// partner. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/CustomersOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/CustomersOperationsExtensions.cs new file mode 100644 index 0000000000000..e047020c08119 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/CustomersOperationsExtensions.cs @@ -0,0 +1,257 @@ +// +// 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.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for CustomersOperations. + /// + public static partial class CustomersOperationsExtensions + { + /// + /// Lists customers by billing profile which the current user can work with + /// on-behalf of a partner. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// May be used to filter the list of customers. + /// + /// + /// Skiptoken is only used if a previous operation returned a partial result. + /// If a previous response contains a nextLink element, the value of the + /// nextLink element will include a skiptoken parameter that specifies a + /// starting point to use for subsequent calls. + /// + public static IPage ListByBillingProfile(this ICustomersOperations operations, string billingAccountName, string billingProfileName, string filter = default(string), string skiptoken = default(string)) + { + return operations.ListByBillingProfileAsync(billingAccountName, billingProfileName, filter, skiptoken).GetAwaiter().GetResult(); + } + + /// + /// Lists customers by billing profile which the current user can work with + /// on-behalf of a partner. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// May be used to filter the list of customers. + /// + /// + /// Skiptoken is only used if a previous operation returned a partial result. + /// If a previous response contains a nextLink element, the value of the + /// nextLink element will include a skiptoken parameter that specifies a + /// starting point to use for subsequent calls. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingProfileAsync(this ICustomersOperations operations, string billingAccountName, string billingProfileName, string filter = default(string), string skiptoken = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, filter, skiptoken, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists customers which the current user can work with on-behalf of a + /// partner. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// May be used to filter the list of customers. + /// + /// + /// Skiptoken is only used if a previous operation returned a partial result. + /// If a previous response contains a nextLink element, the value of the + /// nextLink element will include a skiptoken parameter that specifies a + /// starting point to use for subsequent calls. + /// + public static IPage ListByBillingAccount(this ICustomersOperations operations, string billingAccountName, string filter = default(string), string skiptoken = default(string)) + { + return operations.ListByBillingAccountAsync(billingAccountName, filter, skiptoken).GetAwaiter().GetResult(); + } + + /// + /// Lists customers which the current user can work with on-behalf of a + /// partner. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// May be used to filter the list of customers. + /// + /// + /// Skiptoken is only used if a previous operation returned a partial result. + /// If a previous response contains a nextLink element, the value of the + /// nextLink element will include a skiptoken parameter that specifies a + /// starting point to use for subsequent calls. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingAccountAsync(this ICustomersOperations operations, string billingAccountName, string filter = default(string), string skiptoken = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, filter, skiptoken, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a customer by its id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Customer name. + /// + /// + /// May be used to expand enabledAzurePlans, resellers. + /// + public static Customer Get(this ICustomersOperations operations, string billingAccountName, string customerName, string expand = default(string)) + { + return operations.GetAsync(billingAccountName, customerName, expand).GetAwaiter().GetResult(); + } + + /// + /// Gets a customer by its id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Customer name. + /// + /// + /// May be used to expand enabledAzurePlans, resellers. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ICustomersOperations operations, string billingAccountName, string customerName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, customerName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists customers by billing profile which the current user can work with + /// on-behalf of a partner. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByBillingProfileNext(this ICustomersOperations operations, string nextPageLink) + { + return operations.ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists customers by billing profile which the current user can work with + /// on-behalf of a partner. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingProfileNextAsync(this ICustomersOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists customers which the current user can work with on-behalf of a + /// partner. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByBillingAccountNext(this ICustomersOperations operations, string nextPageLink) + { + return operations.ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists customers which the current user can work with on-behalf of a + /// partner. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBillingAccountNextAsync(this ICustomersOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IAddressOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IAddressOperations.cs new file mode 100644 index 0000000000000..0497e1cfd7e94 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IAddressOperations.cs @@ -0,0 +1,48 @@ +// +// 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.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// AddressOperations operations. + /// + public partial interface IAddressOperations + { + /// + /// Validates the address. + /// + /// + /// + /// + /// 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> ValidateWithHttpMessagesAsync(AddressDetails address, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IAgreementsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IAgreementsOperations.cs index ad1ad24644a8a..8857e689506ba 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IAgreementsOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IAgreementsOperations.cs @@ -47,7 +47,7 @@ public partial interface IAgreementsOperations /// /// Thrown when a required parameter is null /// - Task> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get the agreement by name. /// diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingAccountsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingAccountsOperations.cs index b35c31c7891e8..29bb611aa91e5 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingAccountsOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingAccountsOperations.cs @@ -27,7 +27,8 @@ public partial interface IBillingAccountsOperations /// Lists all billing accounts for a user which he has access to. /// /// - /// May be used to expand the invoiceSections and billingProfiles. + /// May be used to expand the address, invoiceSections and + /// billingProfiles. /// /// /// The headers that will be added to request. @@ -52,7 +53,8 @@ public partial interface IBillingAccountsOperations /// billing Account Id. /// /// - /// May be used to expand the invoiceSections and billingProfiles. + /// May be used to expand the address, invoiceSections and + /// billingProfiles. /// /// /// The headers that will be added to request. @@ -70,5 +72,57 @@ public partial interface IBillingAccountsOperations /// Thrown when a required parameter is null /// Task> GetWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to update a billing account. + /// + /// + /// billing Account Id. + /// + /// + /// Request parameters supplied to the update billing account + /// 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> UpdateWithHttpMessagesAsync(string billingAccountName, BillingAccountUpdateRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The operation to update a billing account. + /// + /// + /// billing Account Id. + /// + /// + /// Request parameters supplied to the update billing account + /// 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> BeginUpdateWithHttpMessagesAsync(string billingAccountName, BillingAccountUpdateRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingManagementClient.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingManagementClient.cs index 1a737016940c9..171f2c18de7a1 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingManagementClient.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingManagementClient.cs @@ -43,7 +43,7 @@ public partial interface IBillingManagementClient : System.IDisposable /// /// Version of the API to be used with the client request. The current - /// version is 2018-11-01-preview. + /// version is 2019-10-01-preview. /// string ApiVersion { get; } @@ -81,6 +81,11 @@ public partial interface IBillingManagementClient : System.IDisposable /// IPaymentMethodsOperations PaymentMethods { get; } + /// + /// Gets the IAddressOperations. + /// + IAddressOperations Address { get; } + /// /// Gets the IAvailableBalancesOperations. /// @@ -91,45 +96,55 @@ public partial interface IBillingManagementClient : System.IDisposable /// IBillingProfilesOperations BillingProfiles { get; } + /// + /// Gets the ICustomersOperations. + /// + ICustomersOperations Customers { get; } + /// /// Gets the IInvoiceSectionsOperations. /// IInvoiceSectionsOperations InvoiceSections { get; } /// - /// Gets the IDepartmentsOperations. + /// Gets the IBillingPermissionsOperations. /// - IDepartmentsOperations Departments { get; } + IBillingPermissionsOperations BillingPermissions { get; } /// - /// Gets the IEnrollmentAccountsOperations. + /// Gets the IBillingSubscriptionsOperations. /// - IEnrollmentAccountsOperations EnrollmentAccounts { get; } + IBillingSubscriptionsOperations BillingSubscriptions { get; } /// - /// Gets the IInvoicesOperations. + /// Gets the IProductsOperations. /// - IInvoicesOperations Invoices { get; } + IProductsOperations Products { get; } /// - /// Gets the IPriceSheetOperations. + /// Gets the ITransactionsOperations. /// - IPriceSheetOperations PriceSheet { get; } + ITransactionsOperations Transactions { get; } /// - /// Gets the IBillingSubscriptionsOperations. + /// Gets the IDepartmentsOperations. /// - IBillingSubscriptionsOperations BillingSubscriptions { get; } + IDepartmentsOperations Departments { get; } /// - /// Gets the IProductsOperations. + /// Gets the IEnrollmentAccountsOperations. /// - IProductsOperations Products { get; } + IEnrollmentAccountsOperations EnrollmentAccounts { get; } /// - /// Gets the ITransactionsOperations. + /// Gets the IInvoicesOperations. /// - ITransactionsOperations Transactions { get; } + IInvoicesOperations Invoices { get; } + + /// + /// Gets the IPriceSheetOperations. + /// + IPriceSheetOperations PriceSheet { get; } /// /// Gets the IPoliciesOperations. @@ -146,6 +161,16 @@ public partial interface IBillingManagementClient : System.IDisposable /// ITransfersOperations Transfers { get; } + /// + /// Gets the IPartnerTransfersOperations. + /// + IPartnerTransfersOperations PartnerTransfers { get; } + + /// + /// Gets the IPartnerTransfersTransfersOperations. + /// + IPartnerTransfersTransfersOperations PartnerTransfersTransfers { get; } + /// /// Gets the IRecipientTransfersOperations. /// @@ -156,11 +181,6 @@ public partial interface IBillingManagementClient : System.IDisposable /// IOperations Operations { get; } - /// - /// Gets the IBillingPermissionsOperations. - /// - IBillingPermissionsOperations BillingPermissions { get; } - /// /// Gets the IBillingRoleDefinitionsOperations. /// @@ -176,5 +196,10 @@ public partial interface IBillingManagementClient : System.IDisposable /// IAgreementsOperations Agreements { get; } + /// + /// Gets the ILineOfCreditsOperations. + /// + ILineOfCreditsOperations LineOfCredits { get; } + } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingPermissionsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingPermissionsOperations.cs index e0157246a9664..13d471c026ea7 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingPermissionsOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingPermissionsOperations.cs @@ -23,6 +23,31 @@ namespace Microsoft.Azure.Management.Billing /// public partial interface IBillingPermissionsOperations { + /// + /// Lists all billing permissions the caller has for a customer. + /// + /// + /// billing Account Id. + /// + /// + /// Customer name. + /// + /// + /// 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> ListByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists all billing permissions for the caller under a billing /// account. @@ -52,6 +77,9 @@ public partial interface IBillingPermissionsOperations /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -70,10 +98,9 @@ public partial interface IBillingPermissionsOperations /// /// Thrown when a required parameter is null /// - Task> ListByInvoiceSectionsWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListByInvoiceSectionsWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Lists all billingPermissions for the caller has for a billing - /// account. + /// Lists all billing permissions the caller has for a billing account. /// /// /// billing Account Id. diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingProfilesOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingProfilesOperations.cs index 6ea9e0f19913e..370ead8780388 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingProfilesOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingProfilesOperations.cs @@ -48,7 +48,7 @@ public partial interface IBillingProfilesOperations /// /// Thrown when a required parameter is null /// - Task> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get the billing profile by id. /// @@ -78,6 +78,34 @@ public partial interface IBillingProfilesOperations /// Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// The operation to create a BillingProfile. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Request parameters supplied to the Create BillingProfile 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> CreateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, BillingProfileCreationRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// The operation to update a billing profile. /// /// @@ -87,7 +115,8 @@ public partial interface IBillingProfilesOperations /// Billing Profile Id. /// /// - /// Parameters supplied to the update billing profile operation. + /// Request parameters supplied to the update billing profile + /// operation. /// /// /// The headers that will be added to request. @@ -106,6 +135,34 @@ public partial interface IBillingProfilesOperations /// Task> UpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, BillingProfile parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// The operation to create a BillingProfile. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Request parameters supplied to the Create BillingProfile 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> BeginCreateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, BillingProfileCreationRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// The operation to update a billing profile. /// /// @@ -115,7 +172,8 @@ public partial interface IBillingProfilesOperations /// Billing Profile Id. /// /// - /// Parameters supplied to the update billing profile operation. + /// Request parameters supplied to the update billing profile + /// operation. /// /// /// The headers that will be added to request. diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingPropertyOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingPropertyOperations.cs index 0c8a4329431bf..71374d3abd1bb 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingPropertyOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingPropertyOperations.cs @@ -25,7 +25,7 @@ public partial interface IBillingPropertyOperations { /// /// Get billing property by subscription Id. - /// + /// /// /// /// The headers that will be added to request. diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingRoleAssignmentsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingRoleAssignmentsOperations.cs index e8dd336ace8a0..dfd967c254184 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingRoleAssignmentsOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingRoleAssignmentsOperations.cs @@ -72,13 +72,16 @@ public partial interface IBillingRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task> DeleteByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> DeleteByBillingAccountWithHttpMessagesAsync(string billingAccountName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get the role assignment for the caller on the invoice Section /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -100,13 +103,16 @@ public partial interface IBillingRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task> GetByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete the role assignment on the invoice Section /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -128,7 +134,7 @@ public partial interface IBillingRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task> DeleteByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> DeleteByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get the role assignment for the caller on the Billing Profile /// @@ -156,7 +162,7 @@ public partial interface IBillingRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task> GetByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete the role assignment on this Billing Profile /// @@ -184,7 +190,7 @@ public partial interface IBillingRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task> DeleteByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> DeleteByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get the role assignments on the Billing Account /// @@ -206,13 +212,16 @@ public partial interface IBillingRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// The operation to add a role assignment to a billing account. /// /// /// billing Account Id. /// + /// + /// Parameters supplied to add a role assignment. + /// /// /// The headers that will be added to request. /// @@ -228,13 +237,16 @@ public partial interface IBillingRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task> AddByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> AddByBillingAccountWithHttpMessagesAsync(string billingAccountName, BillingRoleAssignmentPayload parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get the role assignments on the invoice Section /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -253,16 +265,22 @@ public partial interface IBillingRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task> ListByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// The operation to add a role assignment to a invoice Section. /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// + /// + /// Parameters supplied to add a role assignment. + /// /// /// The headers that will be added to request. /// @@ -278,7 +296,7 @@ public partial interface IBillingRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task> AddByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> AddByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, BillingRoleAssignmentPayload parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get the role assignments on the Billing Profile /// @@ -303,7 +321,7 @@ public partial interface IBillingRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task> ListByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// The operation to add a role assignment to a billing profile. /// @@ -313,6 +331,9 @@ public partial interface IBillingRoleAssignmentsOperations /// /// Billing Profile Id. /// + /// + /// Parameters supplied to add a role assignment. + /// /// /// The headers that will be added to request. /// @@ -328,6 +349,6 @@ public partial interface IBillingRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task> AddByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> AddByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, BillingRoleAssignmentPayload parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingRoleDefinitionsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingRoleDefinitionsOperations.cs index 332b767d96dd8..6de9603a2bcbb 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingRoleDefinitionsOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingRoleDefinitionsOperations.cs @@ -47,13 +47,16 @@ public partial interface IBillingRoleDefinitionsOperations /// /// Thrown when a required parameter is null /// - Task> GetByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, string billingRoleDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetByBillingAccountWithHttpMessagesAsync(string billingAccountName, string billingRoleDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the role definition for a role /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -75,7 +78,7 @@ public partial interface IBillingRoleDefinitionsOperations /// /// Thrown when a required parameter is null /// - Task> GetByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string billingRoleDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the role definition for a role /// @@ -103,7 +106,7 @@ public partial interface IBillingRoleDefinitionsOperations /// /// Thrown when a required parameter is null /// - Task> GetByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists the role definition for a billing account /// @@ -125,13 +128,16 @@ public partial interface IBillingRoleDefinitionsOperations /// /// Thrown when a required parameter is null /// - Task> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists the role definition for an invoice Section /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -150,7 +156,7 @@ public partial interface IBillingRoleDefinitionsOperations /// /// Thrown when a required parameter is null /// - Task> ListByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists the role definition for a Billing Profile /// @@ -175,6 +181,6 @@ public partial interface IBillingRoleDefinitionsOperations /// /// Thrown when a required parameter is null /// - Task> ListByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingSubscriptionsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingSubscriptionsOperations.cs index ca05ab3286cab..6f0f5e80e8aca 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingSubscriptionsOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IBillingSubscriptionsOperations.cs @@ -24,12 +24,15 @@ namespace Microsoft.Azure.Management.Billing public partial interface IBillingSubscriptionsOperations { /// - /// Lists billing subscriptions by billing account name. + /// Lists billing subscription by customer id. /// /// /// /// billing Account Id. /// + /// + /// Customer name. + /// /// /// The headers that will be added to request. /// @@ -45,14 +48,66 @@ public partial interface IBillingSubscriptionsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Lists billing subscriptions by billing profile name. + /// Get a single billing subscription by id. /// /// /// /// billing Account Id. /// + /// + /// Customer name. + /// + /// + /// Billing Subscription 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> GetByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, string billingSubscriptionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists billing subscriptions by billing account name. + /// + /// + /// + /// billing Account 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>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists billing subscriptions by billing profile name. + /// + /// + /// + /// billing Account Id. + /// /// /// Billing Profile Id. /// @@ -71,14 +126,17 @@ public partial interface IBillingSubscriptionsOperations /// /// Thrown when a required parameter is null /// - Task> ListByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists billing subscription by invoice section name. - /// + /// /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -97,14 +155,17 @@ public partial interface IBillingSubscriptionsOperations /// /// Thrown when a required parameter is null /// - Task> ListByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get a single billing subscription by name. - /// + /// /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -126,7 +187,7 @@ public partial interface IBillingSubscriptionsOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string billingSubscriptionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingSubscriptionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Transfers the subscription from one invoice section to another /// within a billing account. @@ -134,6 +195,45 @@ public partial interface IBillingSubscriptionsOperations /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// + /// + /// InvoiceSection Id. + /// + /// + /// Billing Subscription Id. + /// + /// + /// Request parameters supplied to the Transfer Billing Subscription + /// 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> TransferWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Validates the transfer of billing subscriptions across invoice + /// sections. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -158,7 +258,7 @@ public partial interface IBillingSubscriptionsOperations /// /// Thrown when a required parameter is null /// - Task> TransferWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ValidateTransferWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Transfers the subscription from one invoice section to another /// within a billing account. @@ -166,6 +266,9 @@ public partial interface IBillingSubscriptionsOperations /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -173,7 +276,8 @@ public partial interface IBillingSubscriptionsOperations /// Billing Subscription Id. /// /// - /// Parameters supplied to the Transfer Billing Subscription operation. + /// Request parameters supplied to the Transfer Billing Subscription + /// operation. /// /// /// The headers that will be added to request. @@ -190,9 +294,9 @@ public partial interface IBillingSubscriptionsOperations /// /// Thrown when a required parameter is null /// - Task> BeginTransferWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginTransferWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Lists billing subscriptions by billing account name. + /// Lists billing subscription by customer id. /// /// /// @@ -213,6 +317,29 @@ public partial interface IBillingSubscriptionsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByBillingAccountNameNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByCustomerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists billing subscriptions by billing account name. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ICustomersOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ICustomersOperations.cs new file mode 100644 index 0000000000000..127391a153932 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ICustomersOperations.cs @@ -0,0 +1,168 @@ +// +// 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.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CustomersOperations operations. + /// + public partial interface ICustomersOperations + { + /// + /// Lists customers by billing profile which the current user can work + /// with on-behalf of a partner. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// May be used to filter the list of customers. + /// + /// + /// Skiptoken is only used if a previous operation returned a partial + /// result. If a previous response contains a nextLink element, the + /// value of the nextLink element will include a skiptoken parameter + /// that specifies a starting point to use for subsequent calls. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string filter = default(string), string skiptoken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists customers which the current user can work with on-behalf of a + /// partner. + /// + /// + /// billing Account Id. + /// + /// + /// May be used to filter the list of customers. + /// + /// + /// Skiptoken is only used if a previous operation returned a partial + /// result. If a previous response contains a nextLink element, the + /// value of the nextLink element will include a skiptoken parameter + /// that specifies a starting point to use for subsequent calls. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string filter = default(string), string skiptoken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a customer by its id. + /// + /// + /// billing Account Id. + /// + /// + /// Customer name. + /// + /// + /// May be used to expand enabledAzurePlans, resellers. + /// + /// + /// 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 billingAccountName, string customerName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists customers by billing profile which the current user can work + /// with on-behalf of a partner. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists customers which the current user can work with on-behalf of a + /// partner. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IInvoiceSectionsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IInvoiceSectionsOperations.cs index bd865c95b0067..6fe7878c3644f 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IInvoiceSectionsOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IInvoiceSectionsOperations.cs @@ -29,33 +29,8 @@ public partial interface IInvoiceSectionsOperations /// /// billing Account Id. /// - /// - /// May be used to expand the billingProfiles. - /// - /// - /// 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> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// The operation to create a InvoiceSection. - /// - /// - /// billing Account Id. - /// - /// - /// Parameters supplied to the Create InvoiceSection operation. + /// + /// Billing Profile Id. /// /// /// The headers that will be added to request. @@ -72,10 +47,9 @@ public partial interface IInvoiceSectionsOperations /// /// Thrown when a required parameter is null /// - Task> CreateWithHttpMessagesAsync(string billingAccountName, InvoiceSectionProperties parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Lists all invoice sections under a billing profile for a user which - /// he has access to. + /// Get the InvoiceSection by id. /// /// /// billing Account Id. @@ -83,31 +57,8 @@ public partial interface IInvoiceSectionsOperations /// /// 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> ListByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Lists all invoiceSections with create subscription permission for a - /// user. - /// - /// - /// billing Account Id. - /// - /// - /// May be used to expand the billingProfiles. + /// + /// InvoiceSection Id. /// /// /// The headers that will be added to request. @@ -124,18 +75,21 @@ public partial interface IInvoiceSectionsOperations /// /// Thrown when a required parameter is null /// - Task> ListByCreateSubscriptionPermissionWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Get the InvoiceSection by id. + /// The operation to create an invoice section. /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// - /// - /// May be used to expand the billingProfiles. + /// + /// Request parameters supplied to the Create InvoiceSection operation. /// /// /// The headers that will be added to request. @@ -152,18 +106,21 @@ public partial interface IInvoiceSectionsOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSectionCreationRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// The operation to update a InvoiceSection. /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// - /// Parameters supplied to the Create InvoiceSection operation. + /// Request parameters supplied to the Create InvoiceSection operation. /// /// /// The headers that will be added to request. @@ -180,13 +137,16 @@ public partial interface IInvoiceSectionsOperations /// /// Thrown when a required parameter is null /// - Task> UpdateWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, InvoiceSection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Elevates the caller's access to match their billing profile access. /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -202,15 +162,21 @@ public partial interface IInvoiceSectionsOperations /// /// Thrown when a required parameter is null /// - Task ElevateToBillingProfileWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task ElevateToBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// The operation to create a InvoiceSection. + /// The operation to create an invoice section. /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// + /// + /// InvoiceSection Id. + /// /// - /// Parameters supplied to the Create InvoiceSection operation. + /// Request parameters supplied to the Create InvoiceSection operation. /// /// /// The headers that will be added to request. @@ -227,18 +193,21 @@ public partial interface IInvoiceSectionsOperations /// /// Thrown when a required parameter is null /// - Task> BeginCreateWithHttpMessagesAsync(string billingAccountName, InvoiceSectionProperties parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginCreateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSectionCreationRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// The operation to update a InvoiceSection. /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// - /// Parameters supplied to the Create InvoiceSection operation. + /// Request parameters supplied to the Create InvoiceSection operation. /// /// /// The headers that will be added to request. @@ -255,6 +224,6 @@ public partial interface IInvoiceSectionsOperations /// /// Thrown when a required parameter is null /// - Task> BeginUpdateWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, InvoiceSection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IInvoicesOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IInvoicesOperations.cs index 20a9710d6e67f..92881627e14ed 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IInvoicesOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IInvoicesOperations.cs @@ -50,7 +50,7 @@ public partial interface IInvoicesOperations /// /// Thrown when a required parameter is null /// - Task> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, string periodStartDate, string periodEndDate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string periodStartDate, string periodEndDate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// List of invoices for a billing profile. /// @@ -109,6 +109,6 @@ public partial interface IInvoicesOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ILineOfCreditsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ILineOfCreditsOperations.cs new file mode 100644 index 0000000000000..ba1c6ac5edbfd --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ILineOfCreditsOperations.cs @@ -0,0 +1,90 @@ +// +// 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.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// LineOfCreditsOperations operations. + /// + public partial interface ILineOfCreditsOperations + { + /// + /// Get the current line of credit. + /// + /// + /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Increase the current line of credit. + /// + /// + /// Parameters supplied to the increase line of credit 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> UpdateWithHttpMessagesAsync(LineOfCredit parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Increase the current line of credit. + /// + /// + /// Parameters supplied to the increase line of credit 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> BeginUpdateWithHttpMessagesAsync(LineOfCredit parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IPartnerTransfersOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IPartnerTransfersOperations.cs new file mode 100644 index 0000000000000..12424f279f60e --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IPartnerTransfersOperations.cs @@ -0,0 +1,120 @@ +// +// 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.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PartnerTransfersOperations operations. + /// + public partial interface IPartnerTransfersOperations + { + /// + /// Initiates the request to transfer the legacy subscriptions or RIs. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Customer name. + /// + /// + /// Parameters supplied to initiate the transfer. + /// + /// + /// 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> InitiateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string customerName, InitiateTransferRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the transfer details for given transfer Id. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Customer name. + /// + /// + /// Transfer Name. + /// + /// + /// 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 billingAccountName, string billingProfileName, string customerName, string transferName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Cancels the transfer for given transfer Id. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Customer name. + /// + /// + /// Transfer Name. + /// + /// + /// 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> CancelWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string customerName, string transferName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IPartnerTransfersTransfersOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IPartnerTransfersTransfersOperations.cs new file mode 100644 index 0000000000000..257b82644cfd1 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IPartnerTransfersTransfersOperations.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PartnerTransfersTransfersOperations operations. + /// + public partial interface IPartnerTransfersTransfersOperations + { + /// + /// Lists all transfer's details initiated from given invoice section. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Customer name. + /// + /// + /// 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 billingAccountName, string billingProfileName, string customerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all transfer's details initiated from given invoice section. + /// + /// + /// 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/billing/Microsoft.Azure.Management.Billing/src/Generated/IPaymentMethodsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IPaymentMethodsOperations.cs index 3436d0cc3003f..ed7a123da510d 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IPaymentMethodsOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IPaymentMethodsOperations.cs @@ -25,7 +25,7 @@ public partial interface IPaymentMethodsOperations { /// /// Lists the Payment Methods by billing account Id. - /// + /// /// /// /// billing Account Id. @@ -45,10 +45,10 @@ public partial interface IPaymentMethodsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists the Payment Methods by billing profile Id. - /// + /// /// /// /// billing Account Id. @@ -71,10 +71,10 @@ public partial interface IPaymentMethodsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists the Payment Methods by billing account Id. - /// + /// /// /// /// The NextLink from the previous successful call to List operation. @@ -94,10 +94,10 @@ public partial interface IPaymentMethodsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByBillingAccountNameNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists the Payment Methods by billing profile Id. - /// + /// /// /// /// The NextLink from the previous successful call to List operation. @@ -117,6 +117,6 @@ public partial interface IPaymentMethodsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByBillingProfileNameNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IPoliciesOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IPoliciesOperations.cs index 093508b3467a9..ce73bd4c9303d 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IPoliciesOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IPoliciesOperations.cs @@ -26,7 +26,7 @@ public partial interface IPoliciesOperations /// /// The policy for a given billing account name and billing profile /// name. - /// + /// /// /// /// billing Account Id. @@ -49,7 +49,7 @@ public partial interface IPoliciesOperations /// /// Thrown when a required parameter is null /// - Task> GetByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// The operation to update a policy. /// diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IPriceSheetOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IPriceSheetOperations.cs index 4dbbea4a1d6ff..d86f105889807 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IPriceSheetOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IPriceSheetOperations.cs @@ -27,10 +27,38 @@ public partial interface IPriceSheetOperations /// Download price sheet for an invoice. /// /// - /// Azure Billing Account ID. + /// billing Account Id. + /// + /// + /// Billing Profile Id. /// /// - /// The name of an invoice resource. + /// Invoice 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> DownloadWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Download price sheet for a billing profile. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. /// /// /// The headers that will be added to request. @@ -47,15 +75,43 @@ public partial interface IPriceSheetOperations /// /// Thrown when a required parameter is null /// - Task> DownloadWithHttpMessagesAsync(string billingAccountName, string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> DownloadByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Download price sheet for an invoice. /// /// - /// Azure Billing Account ID. + /// billing Account Id. + /// + /// + /// Billing Profile Id. /// /// - /// The name of an invoice resource. + /// Invoice 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> BeginDownloadWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Download price sheet for a billing profile. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. /// /// /// The headers that will be added to request. @@ -72,6 +128,6 @@ public partial interface IPriceSheetOperations /// /// Thrown when a required parameter is null /// - Task> BeginDownloadWithHttpMessagesAsync(string billingAccountName, string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginDownloadByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IProductsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IProductsOperations.cs index 772e45896feac..02c1a7764872f 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IProductsOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IProductsOperations.cs @@ -23,9 +23,70 @@ namespace Microsoft.Azure.Management.Billing /// public partial interface IProductsOperations { + /// + /// Lists products by customer id. + /// + /// + /// + /// billing Account Id. + /// + /// + /// Customer name. + /// + /// + /// May be used to filter by product type. The filter supports 'eq', + /// 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support + /// 'ne', 'or', or 'not'. Tag filter is a key value pair string where + /// key and value is separated by a colon (:). + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ListByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get a customer's product by name. + /// + /// + /// + /// billing Account Id. + /// + /// + /// Customer name. + /// + /// + /// Invoice 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> GetByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, string productName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists products by billing account name. - /// + /// /// /// /// billing Account Id. @@ -51,14 +112,17 @@ public partial interface IProductsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists products by invoice section name. - /// + /// /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -83,14 +147,17 @@ public partial interface IProductsOperations /// /// Thrown when a required parameter is null /// - Task> ListByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get a single product by name. - /// + /// /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -112,13 +179,16 @@ public partial interface IProductsOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string productName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string productName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// The operation to transfer a Product to another invoice section. /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -143,7 +213,41 @@ public partial interface IProductsOperations /// /// Thrown when a required parameter is null /// - Task> TransferWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string productName, TransferProductRequestProperties parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> TransferWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string productName, TransferProductRequestProperties parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Validates the transfer of products across invoice sections. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// InvoiceSection Id. + /// + /// + /// Invoice Id. + /// + /// + /// Parameters supplied to the Transfer Products 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> ValidateTransferWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string productName, TransferProductRequestProperties parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Cancel auto renew for product by product id and billing account /// name @@ -172,7 +276,7 @@ public partial interface IProductsOperations /// /// Thrown when a required parameter is null /// - Task> UpdateAutoRenewByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, string productName, UpdateAutoRenewRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateAutoRenewByBillingAccountWithHttpMessagesAsync(string billingAccountName, string productName, UpdateAutoRenewRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Cancel auto renew for product by product id and invoice section /// name @@ -180,6 +284,9 @@ public partial interface IProductsOperations /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -204,10 +311,10 @@ public partial interface IProductsOperations /// /// Thrown when a required parameter is null /// - Task> UpdateAutoRenewByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string productName, UpdateAutoRenewRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateAutoRenewByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string productName, UpdateAutoRenewRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists products by billing account name. - /// + /// /// /// /// The NextLink from the previous successful call to List operation. @@ -227,6 +334,6 @@ public partial interface IProductsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByBillingAccountNameNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IRecipientTransfersOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IRecipientTransfersOperations.cs index bf6c68b38fd29..328776c1947b5 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IRecipientTransfersOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/IRecipientTransfersOperations.cs @@ -29,8 +29,8 @@ public partial interface IRecipientTransfersOperations /// /// Transfer Name. /// - /// - /// Accept transfer parameters. + /// + /// Parameters supplied to accept the transfer. /// /// /// The headers that will be added to request. @@ -47,7 +47,7 @@ public partial interface IRecipientTransfersOperations /// /// Thrown when a required parameter is null /// - Task> AcceptWithHttpMessagesAsync(string transferName, AcceptTransferRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> AcceptWithHttpMessagesAsync(string transferName, AcceptTransferRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Declines the transfer with given transfer Id. /// diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ITransactionsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ITransactionsOperations.cs index c4c94779273cd..6d4fe16f13328 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ITransactionsOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ITransactionsOperations.cs @@ -23,10 +23,49 @@ namespace Microsoft.Azure.Management.Billing /// public partial interface ITransactionsOperations { + /// + /// Lists the transactions by customer id for given start date and end + /// date. + /// + /// + /// + /// billing Account Id. + /// + /// + /// Customer name. + /// + /// + /// Start date + /// + /// + /// End date + /// + /// + /// May be used to filter by transaction kind. The filter supports + /// 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently + /// support 'ne', 'or', or 'not'. Tag filter is a key value pair string + /// where key and value is separated by a colon (:). + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, string startDate, string endDate, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists the transactions by billing account name for given start and /// end date. - /// + /// /// /// /// billing Account Id. @@ -58,11 +97,11 @@ public partial interface ITransactionsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, string startDate, string endDate, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string startDate, string endDate, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists the transactions by billing profile name for given start date /// and end date. - /// + /// /// /// /// billing Account Id. @@ -97,15 +136,18 @@ public partial interface ITransactionsOperations /// /// Thrown when a required parameter is null /// - Task> ListByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string startDate, string endDate, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string startDate, string endDate, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists the transactions by invoice section name for given start date /// and end date. - /// + /// /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -136,11 +178,70 @@ public partial interface ITransactionsOperations /// /// Thrown when a required parameter is null /// - Task> ListByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string startDate, string endDate, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string startDate, string endDate, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get the transaction. + /// + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Transaction name. + /// + /// + /// 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> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string transactionName, string startDate, string endDate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the transactions by customer id for given start date 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>> ListByCustomerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists the transactions by billing account name for given start and /// end date. - /// + /// /// /// /// The NextLink from the previous successful call to List operation. @@ -160,6 +261,6 @@ public partial interface ITransactionsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByBillingAccountNameNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ITransfersOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ITransfersOperations.cs index 32cf8b3bff6b7..181fdf9757efd 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ITransfersOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ITransfersOperations.cs @@ -29,11 +29,14 @@ public partial interface ITransfersOperations /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// - /// - /// Initiate transfer parameters. + /// + /// Parameters supplied to initiate the transfer. /// /// /// The headers that will be added to request. @@ -50,13 +53,16 @@ public partial interface ITransfersOperations /// /// Thrown when a required parameter is null /// - Task> InitiateWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, InitiateTransferRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> InitiateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, InitiateTransferRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the transfer details for given transfer Id. /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -78,13 +84,16 @@ public partial interface ITransfersOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string transferName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string transferName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Cancels the transfer for given transfer Id. /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -106,13 +115,16 @@ public partial interface ITransfersOperations /// /// Thrown when a required parameter is null /// - Task> CancelWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string transferName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CancelWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string transferName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists all transfer's details initiated from given invoice section. /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -131,7 +143,7 @@ public partial interface ITransfersOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists all transfer's details initiated from given invoice section. /// diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/InvoiceSectionsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/InvoiceSectionsOperations.cs index 578c38188985c..4812e4c4443dd 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/InvoiceSectionsOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/InvoiceSectionsOperations.cs @@ -56,214 +56,6 @@ internal InvoiceSectionsOperations(BillingManagementClient client) /// /// billing Account Id. /// - /// - /// May be used to expand the billingProfiles. - /// - /// - /// 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> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - if (billingAccountName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("billingAccountName", billingAccountName); - tracingParameters.Add("expand", expand); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountName", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections").ToString(); - _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); - } - if (expand != null) - { - _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); - } - 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; - } - - /// - /// The operation to create a InvoiceSection. - /// - /// - /// billing Account Id. - /// - /// - /// Parameters supplied to the Create InvoiceSection operation. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> CreateWithHttpMessagesAsync(string billingAccountName, InvoiceSectionProperties parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(billingAccountName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Lists all invoice sections under a billing profile for a user which he has - /// access to. - /// - /// - /// billing Account Id. - /// /// /// Billing Profile Id. /// @@ -288,7 +80,7 @@ internal InvoiceSectionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -312,7 +104,7 @@ internal InvoiceSectionsOperations(BillingManagementClient client) tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -445,13 +237,16 @@ internal InvoiceSectionsOperations(BillingManagementClient client) } /// - /// Lists all invoiceSections with create subscription permission for a user. + /// Get the InvoiceSection by id. /// /// /// billing Account Id. /// - /// - /// May be used to expand the billingProfiles. + /// + /// Billing Profile Id. + /// + /// + /// InvoiceSection Id. /// /// /// Headers that will be added to request. @@ -474,7 +269,7 @@ internal InvoiceSectionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListByCreateSubscriptionPermissionWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -484,6 +279,14 @@ internal InvoiceSectionsOperations(BillingManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + if (invoiceSectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -492,23 +295,22 @@ internal InvoiceSectionsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); - tracingParameters.Add("expand", expand); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByCreateSubscriptionPermission", tracingParameters); + 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/{billingAccountName}/listInvoiceSectionsWithCreateSubscriptionPermission").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } - if (expand != null) - { - _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); - } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -597,7 +399,7 @@ internal InvoiceSectionsOperations(BillingManagementClient 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")) @@ -610,7 +412,7 @@ internal InvoiceSectionsOperations(BillingManagementClient 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) { @@ -630,197 +432,31 @@ internal InvoiceSectionsOperations(BillingManagementClient client) } /// - /// Get the InvoiceSection by id. + /// The operation to create an invoice section. /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// - /// - /// May be used to expand the billingProfiles. + /// + /// Request parameters supplied to the Create InvoiceSection operation. /// /// - /// Headers that will be added to request. + /// 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 - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSectionCreationRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - if (billingAccountName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); - } - if (invoiceSectionName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("billingAccountName", billingAccountName); - tracingParameters.Add("invoiceSectionName", invoiceSectionName); - tracingParameters.Add("expand", expand); - 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/{billingAccountName}/invoiceSections/{invoiceSectionName}").ToString(); - _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); - _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); - } - if (expand != null) - { - _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); - } - 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; + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -829,11 +465,14 @@ internal InvoiceSectionsOperations(BillingManagementClient client) /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// - /// Parameters supplied to the Create InvoiceSection operation. + /// Request parameters supplied to the Create InvoiceSection operation. /// /// /// The headers that will be added to request. @@ -841,10 +480,10 @@ internal InvoiceSectionsOperations(BillingManagementClient client) /// /// The cancellation token. /// - public async Task> UpdateWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, InvoiceSection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send Request - AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(billingAccountName, invoiceSectionName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } @@ -854,6 +493,9 @@ internal InvoiceSectionsOperations(BillingManagementClient client) /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -875,12 +517,16 @@ internal InvoiceSectionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task ElevateToBillingProfileWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task ElevateToBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (billingAccountName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } if (invoiceSectionName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); @@ -893,14 +539,16 @@ internal InvoiceSectionsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ElevateToBillingProfile", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/elevate").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/elevate").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); List _queryParameters = new List(); if (_queryParameters.Count > 0) @@ -1006,13 +654,19 @@ internal InvoiceSectionsOperations(BillingManagementClient client) } /// - /// The operation to create a InvoiceSection. + /// The operation to create an invoice section. /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// + /// + /// InvoiceSection Id. + /// /// - /// Parameters supplied to the Create InvoiceSection operation. + /// Request parameters supplied to the Create InvoiceSection operation. /// /// /// Headers that will be added to request. @@ -1035,7 +689,7 @@ internal InvoiceSectionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateWithHttpMessagesAsync(string billingAccountName, InvoiceSectionProperties parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginCreateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSectionCreationRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -1045,6 +699,14 @@ internal InvoiceSectionsOperations(BillingManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + if (invoiceSectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); + } if (parameters == null) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); @@ -1057,14 +719,18 @@ internal InvoiceSectionsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -1077,7 +743,7 @@ internal InvoiceSectionsOperations(BillingManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1215,11 +881,14 @@ internal InvoiceSectionsOperations(BillingManagementClient client) /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// - /// Parameters supplied to the Create InvoiceSection operation. + /// Request parameters supplied to the Create InvoiceSection operation. /// /// /// Headers that will be added to request. @@ -1242,7 +911,7 @@ internal InvoiceSectionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginUpdateWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, InvoiceSection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -1252,6 +921,10 @@ internal InvoiceSectionsOperations(BillingManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } if (invoiceSectionName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); @@ -1268,6 +941,7 @@ internal InvoiceSectionsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); @@ -1275,8 +949,9 @@ internal InvoiceSectionsOperations(BillingManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -1290,7 +965,7 @@ internal InvoiceSectionsOperations(BillingManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("PATCH"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/InvoiceSectionsOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/InvoiceSectionsOperationsExtensions.cs index 1de0c2211554e..4052f5850ba40 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/InvoiceSectionsOperationsExtensions.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/InvoiceSectionsOperationsExtensions.cs @@ -30,12 +30,12 @@ public static partial class InvoiceSectionsOperationsExtensions /// /// billing Account Id. /// - /// - /// May be used to expand the billingProfiles. + /// + /// Billing Profile Id. /// - public static InvoiceSectionListResult ListByBillingAccountName(this IInvoiceSectionsOperations operations, string billingAccountName, string expand = default(string)) + public static InvoiceSectionListResult ListByBillingProfile(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName) { - return operations.ListByBillingAccountNameAsync(billingAccountName, expand).GetAwaiter().GetResult(); + return operations.ListByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); } /// @@ -47,63 +47,22 @@ public static partial class InvoiceSectionsOperationsExtensions /// /// billing Account Id. /// - /// - /// May be used to expand the billingProfiles. - /// - /// - /// The cancellation token. - /// - public static async Task ListByBillingAccountNameAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByBillingAccountNameWithHttpMessagesAsync(billingAccountName, expand, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// The operation to create a InvoiceSection. - /// - /// - /// The operations group for this extension method. - /// - /// - /// billing Account Id. - /// - /// - /// Parameters supplied to the Create InvoiceSection operation. - /// - public static InvoiceSection Create(this IInvoiceSectionsOperations operations, string billingAccountName, InvoiceSectionProperties parameters) - { - return operations.CreateAsync(billingAccountName, parameters).GetAwaiter().GetResult(); - } - - /// - /// The operation to create a InvoiceSection. - /// - /// - /// The operations group for this extension method. - /// - /// - /// billing Account Id. - /// - /// - /// Parameters supplied to the Create InvoiceSection operation. + /// + /// Billing Profile Id. /// /// /// The cancellation token. /// - public static async Task CreateAsync(this IInvoiceSectionsOperations operations, string billingAccountName, InvoiceSectionProperties parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListByBillingProfileAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateWithHttpMessagesAsync(billingAccountName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Lists all invoice sections under a billing profile for a user which he has - /// access to. + /// Get the InvoiceSection by id. /// /// /// The operations group for this extension method. @@ -114,14 +73,16 @@ public static InvoiceSection Create(this IInvoiceSectionsOperations operations, /// /// Billing Profile Id. /// - public static InvoiceSectionListResult ListByBillingProfileName(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName) + /// + /// InvoiceSection Id. + /// + public static InvoiceSection Get(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName) { - return operations.ListByBillingProfileNameAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + return operations.GetAsync(billingAccountName, billingProfileName, invoiceSectionName).GetAwaiter().GetResult(); } /// - /// Lists all invoice sections under a billing profile for a user which he has - /// access to. + /// Get the InvoiceSection by id. /// /// /// The operations group for this extension method. @@ -132,59 +93,22 @@ public static InvoiceSectionListResult ListByBillingProfileName(this IInvoiceSec /// /// Billing Profile Id. /// - /// - /// The cancellation token. - /// - public static async Task ListByBillingProfileNameAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByBillingProfileNameWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Lists all invoiceSections with create subscription permission for a user. - /// - /// - /// The operations group for this extension method. - /// - /// - /// billing Account Id. - /// - /// - /// May be used to expand the billingProfiles. - /// - public static InvoiceSectionListResult ListByCreateSubscriptionPermission(this IInvoiceSectionsOperations operations, string billingAccountName, string expand = default(string)) - { - return operations.ListByCreateSubscriptionPermissionAsync(billingAccountName, expand).GetAwaiter().GetResult(); - } - - /// - /// Lists all invoiceSections with create subscription permission for a user. - /// - /// - /// The operations group for this extension method. - /// - /// - /// billing Account Id. - /// - /// - /// May be used to expand the billingProfiles. + /// + /// InvoiceSection Id. /// /// /// The cancellation token. /// - public static async Task ListByCreateSubscriptionPermissionAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByCreateSubscriptionPermissionWithHttpMessagesAsync(billingAccountName, expand, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Get the InvoiceSection by id. + /// The operation to create an invoice section. /// /// /// The operations group for this extension method. @@ -192,19 +116,22 @@ public static InvoiceSectionListResult ListByBillingProfileName(this IInvoiceSec /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// - /// - /// May be used to expand the billingProfiles. + /// + /// Request parameters supplied to the Create InvoiceSection operation. /// - public static InvoiceSection Get(this IInvoiceSectionsOperations operations, string billingAccountName, string invoiceSectionName, string expand = default(string)) + public static InvoiceSection Create(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSectionCreationRequest parameters) { - return operations.GetAsync(billingAccountName, invoiceSectionName, expand).GetAwaiter().GetResult(); + return operations.CreateAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters).GetAwaiter().GetResult(); } /// - /// Get the InvoiceSection by id. + /// The operation to create an invoice section. /// /// /// The operations group for this extension method. @@ -212,18 +139,21 @@ public static InvoiceSectionListResult ListByBillingProfileName(this IInvoiceSec /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// - /// - /// May be used to expand the billingProfiles. + /// + /// Request parameters supplied to the Create InvoiceSection operation. /// /// /// The cancellation token. /// - public static async Task GetAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string invoiceSectionName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSectionCreationRequest parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, invoiceSectionName, expand, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -238,15 +168,18 @@ public static InvoiceSectionListResult ListByBillingProfileName(this IInvoiceSec /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// - /// Parameters supplied to the Create InvoiceSection operation. + /// Request parameters supplied to the Create InvoiceSection operation. /// - public static InvoiceSection Update(this IInvoiceSectionsOperations operations, string billingAccountName, string invoiceSectionName, InvoiceSection parameters) + public static InvoiceSection Update(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSection parameters) { - return operations.UpdateAsync(billingAccountName, invoiceSectionName, parameters).GetAwaiter().GetResult(); + return operations.UpdateAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters).GetAwaiter().GetResult(); } /// @@ -258,18 +191,21 @@ public static InvoiceSection Update(this IInvoiceSectionsOperations operations, /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// - /// Parameters supplied to the Create InvoiceSection operation. + /// Request parameters supplied to the Create InvoiceSection operation. /// /// /// The cancellation token. /// - public static async Task UpdateAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string invoiceSectionName, InvoiceSection parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSection parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.UpdateWithHttpMessagesAsync(billingAccountName, invoiceSectionName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.UpdateWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -284,12 +220,15 @@ public static InvoiceSection Update(this IInvoiceSectionsOperations operations, /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// - public static void ElevateToBillingProfile(this IInvoiceSectionsOperations operations, string billingAccountName, string invoiceSectionName) + public static void ElevateToBillingProfile(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName) { - operations.ElevateToBillingProfileAsync(billingAccountName, invoiceSectionName).GetAwaiter().GetResult(); + operations.ElevateToBillingProfileAsync(billingAccountName, billingProfileName, invoiceSectionName).GetAwaiter().GetResult(); } /// @@ -301,19 +240,22 @@ public static void ElevateToBillingProfile(this IInvoiceSectionsOperations opera /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// /// The cancellation token. /// - public static async Task ElevateToBillingProfileAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ElevateToBillingProfileAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.ElevateToBillingProfileWithHttpMessagesAsync(billingAccountName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.ElevateToBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// - /// The operation to create a InvoiceSection. + /// The operation to create an invoice section. /// /// /// The operations group for this extension method. @@ -321,16 +263,22 @@ public static void ElevateToBillingProfile(this IInvoiceSectionsOperations opera /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// + /// + /// InvoiceSection Id. + /// /// - /// Parameters supplied to the Create InvoiceSection operation. + /// Request parameters supplied to the Create InvoiceSection operation. /// - public static InvoiceSection BeginCreate(this IInvoiceSectionsOperations operations, string billingAccountName, InvoiceSectionProperties parameters) + public static InvoiceSection BeginCreate(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSectionCreationRequest parameters) { - return operations.BeginCreateAsync(billingAccountName, parameters).GetAwaiter().GetResult(); + return operations.BeginCreateAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters).GetAwaiter().GetResult(); } /// - /// The operation to create a InvoiceSection. + /// The operation to create an invoice section. /// /// /// The operations group for this extension method. @@ -338,15 +286,21 @@ public static InvoiceSection BeginCreate(this IInvoiceSectionsOperations operati /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// + /// + /// InvoiceSection Id. + /// /// - /// Parameters supplied to the Create InvoiceSection operation. + /// Request parameters supplied to the Create InvoiceSection operation. /// /// /// The cancellation token. /// - public static async Task BeginCreateAsync(this IInvoiceSectionsOperations operations, string billingAccountName, InvoiceSectionProperties parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginCreateAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSectionCreationRequest parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.BeginCreateWithHttpMessagesAsync(billingAccountName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -361,15 +315,18 @@ public static InvoiceSection BeginCreate(this IInvoiceSectionsOperations operati /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// - /// Parameters supplied to the Create InvoiceSection operation. + /// Request parameters supplied to the Create InvoiceSection operation. /// - public static InvoiceSection BeginUpdate(this IInvoiceSectionsOperations operations, string billingAccountName, string invoiceSectionName, InvoiceSection parameters) + public static InvoiceSection BeginUpdate(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSection parameters) { - return operations.BeginUpdateAsync(billingAccountName, invoiceSectionName, parameters).GetAwaiter().GetResult(); + return operations.BeginUpdateAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters).GetAwaiter().GetResult(); } /// @@ -381,18 +338,21 @@ public static InvoiceSection BeginUpdate(this IInvoiceSectionsOperations operati /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// - /// Parameters supplied to the Create InvoiceSection operation. + /// Request parameters supplied to the Create InvoiceSection operation. /// /// /// The cancellation token. /// - public static async Task BeginUpdateAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string invoiceSectionName, InvoiceSection parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginUpdateAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSection parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(billingAccountName, invoiceSectionName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/InvoicesOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/InvoicesOperations.cs index 67850201bfbfc..4dd00b21b1b98 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/InvoicesOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/InvoicesOperations.cs @@ -83,7 +83,7 @@ internal InvoicesOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, string periodStartDate, string periodEndDate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string periodStartDate, string periodEndDate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -112,7 +112,7 @@ internal InvoicesOperations(BillingManagementClient client) tracingParameters.Add("periodStartDate", periodStartDate); tracingParameters.Add("periodEndDate", periodEndDate); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -494,7 +494,7 @@ internal InvoicesOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -624,7 +624,7 @@ internal InvoicesOperations(BillingManagementClient 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")) @@ -637,7 +637,7 @@ internal InvoicesOperations(BillingManagementClient 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/billing/Microsoft.Azure.Management.Billing/src/Generated/InvoicesOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/InvoicesOperationsExtensions.cs index 78ac2e59664bb..550178ea1e1ad 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/InvoicesOperationsExtensions.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/InvoicesOperationsExtensions.cs @@ -36,9 +36,9 @@ public static partial class InvoicesOperationsExtensions /// /// Invoice period end date. /// - public static InvoiceListResult ListByBillingAccountName(this IInvoicesOperations operations, string billingAccountName, string periodStartDate, string periodEndDate) + public static InvoiceListResult ListByBillingAccount(this IInvoicesOperations operations, string billingAccountName, string periodStartDate, string periodEndDate) { - return operations.ListByBillingAccountNameAsync(billingAccountName, periodStartDate, periodEndDate).GetAwaiter().GetResult(); + return operations.ListByBillingAccountAsync(billingAccountName, periodStartDate, periodEndDate).GetAwaiter().GetResult(); } /// @@ -59,9 +59,9 @@ public static InvoiceListResult ListByBillingAccountName(this IInvoicesOperation /// /// The cancellation token. /// - public static async Task ListByBillingAccountNameAsync(this IInvoicesOperations operations, string billingAccountName, string periodStartDate, string periodEndDate, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListByBillingAccountAsync(this IInvoicesOperations operations, string billingAccountName, string periodStartDate, string periodEndDate, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByBillingAccountNameWithHttpMessagesAsync(billingAccountName, periodStartDate, periodEndDate, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, periodStartDate, periodEndDate, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -134,7 +134,7 @@ public static InvoiceListResult ListByBillingProfile(this IInvoicesOperations op /// /// Invoice Id. /// - public static InvoiceSummary Get(this IInvoicesOperations operations, string billingAccountName, string billingProfileName, string invoiceName) + public static Invoice Get(this IInvoicesOperations operations, string billingAccountName, string billingProfileName, string invoiceName) { return operations.GetAsync(billingAccountName, billingProfileName, invoiceName).GetAwaiter().GetResult(); } @@ -157,7 +157,7 @@ public static InvoiceSummary Get(this IInvoicesOperations operations, string bil /// /// The cancellation token. /// - public static async Task GetAsync(this IInvoicesOperations operations, string billingAccountName, string billingProfileName, string invoiceName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IInvoicesOperations operations, string billingAccountName, string billingProfileName, string invoiceName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceName, null, cancellationToken).ConfigureAwait(false)) { diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/LineOfCreditsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/LineOfCreditsOperations.cs new file mode 100644 index 0000000000000..68d32a7ccb160 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/LineOfCreditsOperations.cs @@ -0,0 +1,446 @@ +// +// 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.Billing +{ + 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; + + /// + /// LineOfCreditsOperations operations. + /// + internal partial class LineOfCreditsOperations : IServiceOperations, ILineOfCreditsOperations + { + /// + /// Initializes a new instance of the LineOfCreditsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal LineOfCreditsOperations(BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// Get the current line of credit. + /// + /// + /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + 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("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingAccounts/default/lineOfCredit/default").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + 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; + } + + /// + /// Increase the current line of credit. + /// + /// + /// Parameters supplied to the increase line of credit operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(LineOfCredit parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Increase the current line of credit. + /// + /// + /// Parameters supplied to the increase line of credit 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> BeginUpdateWithHttpMessagesAsync(LineOfCredit parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingAccounts/default/lineOfCredit/default").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + 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("PUT"); + _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; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // 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; + } + + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/LineOfCreditsOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/LineOfCreditsOperationsExtensions.cs new file mode 100644 index 0000000000000..748cf35fc8fa0 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/LineOfCreditsOperationsExtensions.cs @@ -0,0 +1,121 @@ +// +// 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.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for LineOfCreditsOperations. + /// + public static partial class LineOfCreditsOperationsExtensions + { + /// + /// Get the current line of credit. + /// + /// + /// The operations group for this extension method. + /// + public static LineOfCredit Get(this ILineOfCreditsOperations operations) + { + return operations.GetAsync().GetAwaiter().GetResult(); + } + + /// + /// Get the current line of credit. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ILineOfCreditsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Increase the current line of credit. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Parameters supplied to the increase line of credit operation. + /// + public static LineOfCredit Update(this ILineOfCreditsOperations operations, LineOfCredit parameters) + { + return operations.UpdateAsync(parameters).GetAwaiter().GetResult(); + } + + /// + /// Increase the current line of credit. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Parameters supplied to the increase line of credit operation. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this ILineOfCreditsOperations operations, LineOfCredit parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Increase the current line of credit. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Parameters supplied to the increase line of credit operation. + /// + public static LineOfCredit BeginUpdate(this ILineOfCreditsOperations operations, LineOfCredit parameters) + { + return operations.BeginUpdateAsync(parameters).GetAwaiter().GetResult(); + } + + /// + /// Increase the current line of credit. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Parameters supplied to the increase line of credit operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this ILineOfCreditsOperations operations, LineOfCredit parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Address.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/AddressDetails.cs similarity index 86% rename from sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Address.cs rename to sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/AddressDetails.cs index 1dc77e0f9a1a0..82031e2a89f46 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Address.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/AddressDetails.cs @@ -16,18 +16,18 @@ namespace Microsoft.Azure.Management.Billing.Models /// /// Address details. /// - public partial class Address + public partial class AddressDetails { /// - /// Initializes a new instance of the Address class. + /// Initializes a new instance of the AddressDetails class. /// - public Address() + public AddressDetails() { CustomInit(); } /// - /// Initializes a new instance of the Address class. + /// Initializes a new instance of the AddressDetails class. /// /// First Name. /// Last Name. @@ -40,7 +40,7 @@ public Address() /// Country code uses ISO2, 2-digit /// format. /// Address Postal Code. - public Address(string firstName = default(string), string lastName = default(string), string companyName = default(string), string addressLine1 = default(string), string addressLine2 = default(string), string addressLine3 = default(string), string city = default(string), string region = default(string), string country = default(string), string postalCode = default(string)) + public AddressDetails(string firstName = default(string), string lastName = default(string), string companyName = default(string), string addressLine1 = default(string), string addressLine2 = default(string), string addressLine3 = default(string), string city = default(string), string region = default(string), string country = default(string), string postalCode = default(string)) { FirstName = firstName; LastName = lastName; diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/AddressValidationStatus.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/AddressValidationStatus.cs new file mode 100644 index 0000000000000..41d215933e7ea --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/AddressValidationStatus.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.Billing.Models +{ + + /// + /// Defines values for AddressValidationStatus. + /// + public static class AddressValidationStatus + { + public const string Valid = "Valid"; + public const string Invalid = "Invalid"; + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/AgreementType.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/AgreementType.cs new file mode 100644 index 0000000000000..69fd15d0737aa --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/AgreementType.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for AgreementType. + /// + public static class AgreementType + { + public const string MicrosoftCustomerAgreement = "MicrosoftCustomerAgreement"; + public const string EnterpriseAgreement = "EnterpriseAgreement"; + public const string MicrosoftOnlineServicesProgram = "MicrosoftOnlineServicesProgram"; + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Amount.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Amount.cs index 49d2c7a5582be..c82d4c302b306 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Amount.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Amount.cs @@ -50,10 +50,10 @@ public Amount() public string Currency { get; private set; } /// - /// Gets amount value. + /// Gets or sets amount value. /// [JsonProperty(PropertyName = "value")] - public double? Value { get; private set; } + public double? Value { get; set; } } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/EnabledAzureSKUs.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/AzurePlan.cs similarity index 75% rename from sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/EnabledAzureSKUs.cs rename to sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/AzurePlan.cs index fae4b953ef60b..0c6c4ae3a058b 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/EnabledAzureSKUs.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/AzurePlan.cs @@ -14,24 +14,24 @@ namespace Microsoft.Azure.Management.Billing.Models using System.Linq; /// - /// Details about the enabled azure sku. + /// Details about the azure plan. /// - public partial class EnabledAzureSKUs + public partial class AzurePlan { /// - /// Initializes a new instance of the EnabledAzureSKUs class. + /// Initializes a new instance of the AzurePlan class. /// - public EnabledAzureSKUs() + public AzurePlan() { CustomInit(); } /// - /// Initializes a new instance of the EnabledAzureSKUs class. + /// Initializes a new instance of the AzurePlan class. /// /// The sku id. /// The sku description. - public EnabledAzureSKUs(string skuId = default(string), string skuDescription = default(string)) + public AzurePlan(string skuId = default(string), string skuDescription = default(string)) { SkuId = skuId; SkuDescription = skuDescription; @@ -44,10 +44,10 @@ public EnabledAzureSKUs() partial void CustomInit(); /// - /// Gets the sku id. + /// Gets or sets the sku id. /// [JsonProperty(PropertyName = "skuId")] - public string SkuId { get; private set; } + public string SkuId { get; set; } /// /// Gets the sku description. diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingAccount.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingAccount.cs index 8a12514385a05..b45f714a6d008 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingAccount.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingAccount.cs @@ -38,15 +38,13 @@ public BillingAccount() /// Resource name. /// Resource type. /// The billing account name. - /// The billing account Type. Possible values - /// include: 'Organization', 'Enrollment' /// The address associated with billing /// account. - /// Company Name. - /// Country Name. - /// The invoice sections associated to - /// the billing account. By default this is not populated, unless it's - /// specified in $expand. + /// The type of agreement. Possible values + /// include: 'MicrosoftCustomerAgreement', 'EnterpriseAgreement', + /// 'MicrosoftOnlineServicesProgram' + /// The type of customer. Possible values + /// include: 'Enterprise', 'Individual', 'Partner' /// The billing profiles associated to /// the billing account. By default this is not populated, unless it's /// specified in $expand. @@ -57,22 +55,19 @@ public BillingAccount() /// enrollment. /// The accounts associated to the /// enrollment. - /// Specifies whether the user has read - /// access on billing account. - public BillingAccount(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), string accountType = default(string), Address address = default(Address), string company = default(string), string country = default(string), IList invoiceSections = default(IList), IList billingProfiles = default(IList), Enrollment enrollmentDetails = default(Enrollment), IList departments = default(IList), IList enrollmentAccounts = default(IList), bool? hasReadAccess = default(bool?)) + /// Organization id. + public BillingAccount(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), AddressDetails address = default(AddressDetails), string agreementType = default(string), string customerType = default(string), IList billingProfiles = default(IList), Enrollment enrollmentDetails = default(Enrollment), IList departments = default(IList), IList enrollmentAccounts = default(IList), string organizationId = default(string)) : base(id, name, type) { DisplayName = displayName; - AccountType = accountType; Address = address; - Company = company; - Country = country; - InvoiceSections = invoiceSections; + AgreementType = agreementType; + CustomerType = customerType; BillingProfiles = billingProfiles; EnrollmentDetails = enrollmentDetails; Departments = departments; EnrollmentAccounts = enrollmentAccounts; - HasReadAccess = hasReadAccess; + OrganizationId = organizationId; CustomInit(); } @@ -87,38 +82,26 @@ public BillingAccount() [JsonProperty(PropertyName = "properties.displayName")] public string DisplayName { get; private set; } - /// - /// Gets the billing account Type. Possible values include: - /// 'Organization', 'Enrollment' - /// - [JsonProperty(PropertyName = "properties.accountType")] - public string AccountType { get; private set; } - /// /// Gets or sets the address associated with billing account. /// [JsonProperty(PropertyName = "properties.address")] - public Address Address { get; set; } + public AddressDetails Address { get; set; } /// - /// Gets company Name. + /// Gets the type of agreement. Possible values include: + /// 'MicrosoftCustomerAgreement', 'EnterpriseAgreement', + /// 'MicrosoftOnlineServicesProgram' /// - [JsonProperty(PropertyName = "properties.company")] - public string Company { get; private set; } + [JsonProperty(PropertyName = "properties.agreementType")] + public string AgreementType { get; private set; } /// - /// Gets country Name. - /// - [JsonProperty(PropertyName = "properties.country")] - public string Country { get; private set; } - - /// - /// Gets or sets the invoice sections associated to the billing - /// account. By default this is not populated, unless it's specified in - /// $expand. + /// Gets the type of customer. Possible values include: 'Enterprise', + /// 'Individual', 'Partner' /// - [JsonProperty(PropertyName = "properties.invoiceSections")] - public IList InvoiceSections { get; set; } + [JsonProperty(PropertyName = "properties.customerType")] + public string CustomerType { get; private set; } /// /// Gets or sets the billing profiles associated to the billing @@ -148,10 +131,10 @@ public BillingAccount() public IList EnrollmentAccounts { get; set; } /// - /// Gets specifies whether the user has read access on billing account. + /// Gets organization id. /// - [JsonProperty(PropertyName = "properties.hasReadAccess")] - public bool? HasReadAccess { get; private set; } + [JsonProperty(PropertyName = "properties.organizationId")] + public string OrganizationId { get; private set; } } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingAccountUpdateRequest.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingAccountUpdateRequest.cs new file mode 100644 index 0000000000000..5caf62f1da027 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingAccountUpdateRequest.cs @@ -0,0 +1,138 @@ +// +// 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.Billing.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The request properties of the billing account that can be updated. + /// + [Rest.Serialization.JsonTransformation] + public partial class BillingAccountUpdateRequest + { + /// + /// Initializes a new instance of the BillingAccountUpdateRequest + /// class. + /// + public BillingAccountUpdateRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingAccountUpdateRequest + /// class. + /// + /// The billing account name. + /// The address associated with billing + /// account. + /// The type of agreement. Possible values + /// include: 'MicrosoftCustomerAgreement', 'EnterpriseAgreement', + /// 'MicrosoftOnlineServicesProgram' + /// The type of customer. Possible values + /// include: 'Enterprise', 'Individual', 'Partner' + /// The billing profiles associated to + /// the billing account. By default this is not populated, unless it's + /// specified in $expand. + /// The details about the associated + /// legacy enrollment. By default this is not populated, unless it's + /// specified in $expand. + /// The departments associated to the + /// enrollment. + /// The accounts associated to the + /// enrollment. + /// Organization id. + public BillingAccountUpdateRequest(string displayName = default(string), AddressDetails address = default(AddressDetails), string agreementType = default(string), string customerType = default(string), IList billingProfiles = default(IList), Enrollment enrollmentDetails = default(Enrollment), IList departments = default(IList), IList enrollmentAccounts = default(IList), string organizationId = default(string)) + { + DisplayName = displayName; + Address = address; + AgreementType = agreementType; + CustomerType = customerType; + BillingProfiles = billingProfiles; + EnrollmentDetails = enrollmentDetails; + Departments = departments; + EnrollmentAccounts = enrollmentAccounts; + OrganizationId = organizationId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the billing account name. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; private set; } + + /// + /// Gets or sets the address associated with billing account. + /// + [JsonProperty(PropertyName = "properties.address")] + public AddressDetails Address { get; set; } + + /// + /// Gets the type of agreement. Possible values include: + /// 'MicrosoftCustomerAgreement', 'EnterpriseAgreement', + /// 'MicrosoftOnlineServicesProgram' + /// + [JsonProperty(PropertyName = "properties.agreementType")] + public string AgreementType { get; private set; } + + /// + /// Gets the type of customer. Possible values include: 'Enterprise', + /// 'Individual', 'Partner' + /// + [JsonProperty(PropertyName = "properties.customerType")] + public string CustomerType { get; private set; } + + /// + /// Gets or sets the billing profiles associated to the billing + /// account. By default this is not populated, unless it's specified in + /// $expand. + /// + [JsonProperty(PropertyName = "properties.billingProfiles")] + public IList BillingProfiles { get; set; } + + /// + /// Gets the details about the associated legacy enrollment. By default + /// this is not populated, unless it's specified in $expand. + /// + [JsonProperty(PropertyName = "properties.enrollmentDetails")] + public Enrollment EnrollmentDetails { get; private set; } + + /// + /// Gets or sets the departments associated to the enrollment. + /// + [JsonProperty(PropertyName = "properties.departments")] + public IList Departments { get; set; } + + /// + /// Gets or sets the accounts associated to the enrollment. + /// + [JsonProperty(PropertyName = "properties.enrollmentAccounts")] + public IList EnrollmentAccounts { get; set; } + + /// + /// Gets organization id. + /// + [JsonProperty(PropertyName = "properties.organizationId")] + public string OrganizationId { get; private set; } + + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingPermissionsListResult.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingPermissionsListResult.cs index 38424b54e0023..a1408e2c73730 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingPermissionsListResult.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingPermissionsListResult.cs @@ -33,7 +33,7 @@ public BillingPermissionsListResult() /// Initializes a new instance of the BillingPermissionsListResult /// class. /// - /// The list OF billingPermissions a caller has on + /// The list of billingPermissions a caller has on /// a billing account. public BillingPermissionsListResult(IList value = default(IList)) { @@ -47,7 +47,7 @@ public BillingPermissionsListResult() partial void CustomInit(); /// - /// Gets the list OF billingPermissions a caller has on a billing + /// Gets the list of billingPermissions a caller has on a billing /// account. /// [JsonProperty(PropertyName = "value")] diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingProfile.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingProfile.cs index 04f9ea67f8c23..2dc671dc0b306 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingProfile.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingProfile.cs @@ -42,26 +42,23 @@ public BillingProfile() /// Billing address. /// If the billing profile is opted in /// to receive invoices via email. - /// Is OMS bootstrapped billing - /// profile. /// Invoice day. /// The currency associated with the billing /// profile. - /// Information about the - /// product. + /// Information about the enabled azure + /// plans. /// The invoice sections associated to /// the billing profile. - public BillingProfile(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), string poNumber = default(string), Address address = default(Address), bool? invoiceEmailOptIn = default(bool?), bool? isClassic = default(bool?), int? invoiceDay = default(int?), string currency = default(string), IList enabledAzureSKUs = default(IList), IList invoiceSections = default(IList)) + public BillingProfile(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), string poNumber = default(string), AddressDetails address = default(AddressDetails), bool? invoiceEmailOptIn = default(bool?), int? invoiceDay = default(int?), string currency = default(string), IList enabledAzurePlans = default(IList), IList invoiceSections = default(IList)) : base(id, name, type) { DisplayName = displayName; PoNumber = poNumber; Address = address; InvoiceEmailOptIn = invoiceEmailOptIn; - IsClassic = isClassic; InvoiceDay = invoiceDay; Currency = currency; - EnabledAzureSKUs = enabledAzureSKUs; + EnabledAzurePlans = enabledAzurePlans; InvoiceSections = invoiceSections; CustomInit(); } @@ -87,7 +84,7 @@ public BillingProfile() /// Gets or sets billing address. /// [JsonProperty(PropertyName = "properties.address")] - public Address Address { get; set; } + public AddressDetails Address { get; set; } /// /// Gets if the billing profile is opted in to receive invoices via @@ -96,12 +93,6 @@ public BillingProfile() [JsonProperty(PropertyName = "properties.invoiceEmailOptIn")] public bool? InvoiceEmailOptIn { get; private set; } - /// - /// Gets is OMS bootstrapped billing profile. - /// - [JsonProperty(PropertyName = "properties.isClassic")] - public bool? IsClassic { get; private set; } - /// /// Gets invoice day. /// @@ -115,10 +106,10 @@ public BillingProfile() public string Currency { get; private set; } /// - /// Gets or sets information about the product. + /// Gets or sets information about the enabled azure plans. /// - [JsonProperty(PropertyName = "properties.enabledAzureSKUs")] - public IList EnabledAzureSKUs { get; set; } + [JsonProperty(PropertyName = "properties.enabledAzurePlans")] + public IList EnabledAzurePlans { get; set; } /// /// Gets or sets the invoice sections associated to the billing diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingProfileCreationRequest.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingProfileCreationRequest.cs new file mode 100644 index 0000000000000..3286aade23363 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingProfileCreationRequest.cs @@ -0,0 +1,90 @@ +// +// 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.Billing.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The request parameters for creating a new billing profile. + /// + public partial class BillingProfileCreationRequest + { + /// + /// Initializes a new instance of the BillingProfileCreationRequest + /// class. + /// + public BillingProfileCreationRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingProfileCreationRequest + /// class. + /// + /// The billing profile name. + /// Purchase order number. + /// Billing address. + /// If the billing profile is opted in + /// to receive invoices via email. + /// Enabled azure plans for this + /// billing profile. + public BillingProfileCreationRequest(string displayName = default(string), string poNumber = default(string), AddressDetails address = default(AddressDetails), bool? invoiceEmailOptIn = default(bool?), IList enabledAzurePlans = default(IList)) + { + DisplayName = displayName; + PoNumber = poNumber; + Address = address; + InvoiceEmailOptIn = invoiceEmailOptIn; + EnabledAzurePlans = enabledAzurePlans; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the billing profile name. + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets purchase order number. + /// + [JsonProperty(PropertyName = "poNumber")] + public string PoNumber { get; set; } + + /// + /// Gets or sets billing address. + /// + [JsonProperty(PropertyName = "address")] + public AddressDetails Address { get; set; } + + /// + /// Gets or sets if the billing profile is opted in to receive invoices + /// via email. + /// + [JsonProperty(PropertyName = "invoiceEmailOptIn")] + public bool? InvoiceEmailOptIn { get; set; } + + /// + /// Gets or sets enabled azure plans for this billing profile. + /// + [JsonProperty(PropertyName = "enabledAzurePlans")] + public IList EnabledAzurePlans { get; set; } + + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingProfilesCreateHeaders.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingProfilesCreateHeaders.cs new file mode 100644 index 0000000000000..c5888737ec7d7 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingProfilesCreateHeaders.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Create operation. + /// + public partial class BillingProfilesCreateHeaders + { + /// + /// Initializes a new instance of the BillingProfilesCreateHeaders + /// class. + /// + public BillingProfilesCreateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingProfilesCreateHeaders + /// class. + /// + /// Location URI to poll for result + /// Recommends the retryable time after + /// receiving this. + public BillingProfilesCreateHeaders(string location = default(string), int? retryAfter = default(int?)) + { + Location = location; + RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets location URI to poll for result + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets recommends the retryable time after receiving this. + /// + [JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter { get; set; } + + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingProperty.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingProperty.cs index 899f2827f887d..088d082429163 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingProperty.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingProperty.cs @@ -37,27 +37,30 @@ public BillingProperty() /// Resource type. /// Billing tenant Id. /// Billing account Id. - /// Billing account name. + /// Billing account display + /// name. /// Billing profile Id. - /// Billing profile name. + /// Billing profile display + /// name. /// Cost center name. /// Invoice Section Id. - /// Invoice Section name. + /// Invoice Section display + /// name. /// Product Id. /// Product name. /// SKU Id. /// SKU description. - public BillingProperty(string id = default(string), string name = default(string), string type = default(string), string billingTenantId = default(string), string billingAccountId = default(string), string billingAccountName = default(string), string billingProfileId = default(string), string billingProfileName = default(string), string costCenter = default(string), string invoiceSectionId = default(string), string invoiceSectionName = default(string), string productId = default(string), string productName = default(string), string skuId = default(string), string skuDescription = default(string)) + public BillingProperty(string id = default(string), string name = default(string), string type = default(string), string billingTenantId = default(string), string billingAccountId = default(string), string billingAccountDisplayName = default(string), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string costCenter = default(string), string invoiceSectionId = default(string), string invoiceSectionDisplayName = default(string), string productId = default(string), string productName = default(string), string skuId = default(string), string skuDescription = default(string)) : base(id, name, type) { BillingTenantId = billingTenantId; BillingAccountId = billingAccountId; - BillingAccountName = billingAccountName; + BillingAccountDisplayName = billingAccountDisplayName; BillingProfileId = billingProfileId; - BillingProfileName = billingProfileName; + BillingProfileDisplayName = billingProfileDisplayName; CostCenter = costCenter; InvoiceSectionId = invoiceSectionId; - InvoiceSectionName = invoiceSectionName; + InvoiceSectionDisplayName = invoiceSectionDisplayName; ProductId = productId; ProductName = productName; SkuId = skuId; @@ -83,10 +86,10 @@ public BillingProperty() public string BillingAccountId { get; private set; } /// - /// Gets billing account name. + /// Gets billing account display name. /// - [JsonProperty(PropertyName = "properties.billingAccountName")] - public string BillingAccountName { get; private set; } + [JsonProperty(PropertyName = "properties.billingAccountDisplayName")] + public string BillingAccountDisplayName { get; private set; } /// /// Gets billing profile Id. @@ -95,10 +98,10 @@ public BillingProperty() public string BillingProfileId { get; private set; } /// - /// Gets billing profile name. + /// Gets billing profile display name. /// - [JsonProperty(PropertyName = "properties.billingProfileName")] - public string BillingProfileName { get; private set; } + [JsonProperty(PropertyName = "properties.billingProfileDisplayName")] + public string BillingProfileDisplayName { get; private set; } /// /// Gets cost center name. @@ -113,10 +116,10 @@ public BillingProperty() public string InvoiceSectionId { get; private set; } /// - /// Gets invoice Section name. + /// Gets invoice Section display name. /// - [JsonProperty(PropertyName = "properties.invoiceSectionName")] - public string InvoiceSectionName { get; private set; } + [JsonProperty(PropertyName = "properties.invoiceSectionDisplayName")] + public string InvoiceSectionDisplayName { get; private set; } /// /// Gets product Id. diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingRoleAssignmentPayload.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingRoleAssignmentPayload.cs index 9fc63badaf949..74d64a4af330a 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingRoleAssignmentPayload.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingRoleAssignmentPayload.cs @@ -33,12 +33,12 @@ public BillingRoleAssignmentPayload() /// /// The user's principal id that the role /// gets assigned to - /// The role definition + /// The role definition /// id - public BillingRoleAssignmentPayload(string principalId = default(string), string billingRoleDefinitionName = default(string)) + public BillingRoleAssignmentPayload(string principalId = default(string), string billingRoleDefinitionId = default(string)) { PrincipalId = principalId; - BillingRoleDefinitionName = billingRoleDefinitionName; + BillingRoleDefinitionId = billingRoleDefinitionId; CustomInit(); } @@ -48,16 +48,16 @@ public BillingRoleAssignmentPayload() partial void CustomInit(); /// - /// Gets the user's principal id that the role gets assigned to + /// Gets or sets the user's principal id that the role gets assigned to /// [JsonProperty(PropertyName = "principalId")] - public string PrincipalId { get; private set; } + public string PrincipalId { get; set; } /// - /// Gets the role definition id + /// Gets or sets the role definition id /// - [JsonProperty(PropertyName = "billingRoleDefinitionName")] - public string BillingRoleDefinitionName { get; private set; } + [JsonProperty(PropertyName = "billingRoleDefinitionId")] + public string BillingRoleDefinitionId { get; set; } } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingRoleDefinition.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingRoleDefinition.cs index 1ab8f7a72fefc..1d8e57c0f051e 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingRoleDefinition.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingRoleDefinition.cs @@ -38,7 +38,7 @@ public BillingRoleDefinition() /// Resource name. /// Resource type. /// The role description - /// The list OF billingPermissions a caller has on + /// The list of billingPermissions a caller has on /// a billing account. /// The name of the role public BillingRoleDefinition(string id = default(string), string name = default(string), string type = default(string), string description = default(string), IList value = default(IList), string roleName = default(string)) @@ -62,7 +62,7 @@ public BillingRoleDefinition() public string Description { get; private set; } /// - /// Gets the list OF billingPermissions a caller has on a billing + /// Gets the list of billingPermissions a caller has on a billing /// account. /// [JsonProperty(PropertyName = "properties.permissions.value")] diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingSubscriptionSummary.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingSubscription.cs similarity index 62% rename from sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingSubscriptionSummary.cs rename to sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingSubscription.cs index af34cba8b4b76..0d8e1dc1a2cc6 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingSubscriptionSummary.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingSubscription.cs @@ -16,21 +16,21 @@ namespace Microsoft.Azure.Management.Billing.Models using System.Linq; /// - /// A billing Subscription summary resource. + /// A billing Subscription resource. /// [Rest.Serialization.JsonTransformation] - public partial class BillingSubscriptionSummary : Resource + public partial class BillingSubscription : Resource { /// - /// Initializes a new instance of the BillingSubscriptionSummary class. + /// Initializes a new instance of the BillingSubscription class. /// - public BillingSubscriptionSummary() + public BillingSubscription() { CustomInit(); } /// - /// Initializes a new instance of the BillingSubscriptionSummary class. + /// Initializes a new instance of the BillingSubscription class. /// /// Resource Id. /// Resource name. @@ -44,15 +44,20 @@ public BillingSubscriptionSummary() /// Month to date charges. /// Billing Profile id to which this /// product belongs. - /// Billing Profile name to which this - /// product belongs. + /// Billing Profile display + /// name to which this product belongs. + /// Customer id to which this product + /// belongs. + /// Display name of customer to which + /// this product belongs. /// Invoice section id to which this /// product belongs. - /// Invoice section name to which this - /// product belongs. + /// Invoice section display + /// name to which this product belongs. + /// Reseller for this subscription. /// The sku id. /// The sku description. - public BillingSubscriptionSummary(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), System.Guid? subscriptionId = default(System.Guid?), string subscriptionBillingStatus = default(string), Amount lastMonthCharges = default(Amount), Amount monthToDateCharges = default(Amount), string billingProfileId = default(string), string billingProfileName = default(string), string invoiceSectionId = default(string), string invoiceSectionName = default(string), string skuId = default(string), string skuDescription = default(string)) + public BillingSubscription(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), System.Guid? subscriptionId = default(System.Guid?), string subscriptionBillingStatus = default(string), Amount lastMonthCharges = default(Amount), Amount monthToDateCharges = default(Amount), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string customerId = default(string), string customerDisplayName = default(string), string invoiceSectionId = default(string), string invoiceSectionDisplayName = default(string), Reseller reseller = default(Reseller), string skuId = default(string), string skuDescription = default(string)) : base(id, name, type) { DisplayName = displayName; @@ -61,9 +66,12 @@ public BillingSubscriptionSummary() LastMonthCharges = lastMonthCharges; MonthToDateCharges = monthToDateCharges; BillingProfileId = billingProfileId; - BillingProfileName = billingProfileName; + BillingProfileDisplayName = billingProfileDisplayName; + CustomerId = customerId; + CustomerDisplayName = customerDisplayName; InvoiceSectionId = invoiceSectionId; - InvoiceSectionName = invoiceSectionName; + InvoiceSectionDisplayName = invoiceSectionDisplayName; + Reseller = reseller; SkuId = skuId; SkuDescription = skuDescription; CustomInit(); @@ -112,10 +120,22 @@ public BillingSubscriptionSummary() public string BillingProfileId { get; private set; } /// - /// Gets billing Profile name to which this product belongs. + /// Gets billing Profile display name to which this product belongs. + /// + [JsonProperty(PropertyName = "properties.billingProfileDisplayName")] + public string BillingProfileDisplayName { get; private set; } + + /// + /// Gets customer id to which this product belongs. /// - [JsonProperty(PropertyName = "properties.billingProfileName")] - public string BillingProfileName { get; private set; } + [JsonProperty(PropertyName = "properties.customerId")] + public string CustomerId { get; private set; } + + /// + /// Gets display name of customer to which this product belongs. + /// + [JsonProperty(PropertyName = "properties.customerDisplayName")] + public string CustomerDisplayName { get; private set; } /// /// Gets invoice section id to which this product belongs. @@ -124,10 +144,16 @@ public BillingSubscriptionSummary() public string InvoiceSectionId { get; private set; } /// - /// Gets invoice section name to which this product belongs. + /// Gets invoice section display name to which this product belongs. + /// + [JsonProperty(PropertyName = "properties.invoiceSectionDisplayName")] + public string InvoiceSectionDisplayName { get; private set; } + + /// + /// Gets reseller for this subscription. /// - [JsonProperty(PropertyName = "properties.invoiceSectionName")] - public string InvoiceSectionName { get; private set; } + [JsonProperty(PropertyName = "properties.reseller")] + public Reseller Reseller { get; private set; } /// /// Gets or sets the sku id. diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingSubscriptionsListResult.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingSubscriptionsListResult.cs index 4b5829c166b0e..65f02e801fef7 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingSubscriptionsListResult.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingSubscriptionsListResult.cs @@ -16,7 +16,7 @@ namespace Microsoft.Azure.Management.Billing.Models using System.Linq; /// - /// Result of listing billing subscriptions summary. + /// Result of listing billing subscriptions. /// public partial class BillingSubscriptionsListResult { @@ -33,11 +33,10 @@ public BillingSubscriptionsListResult() /// Initializes a new instance of the BillingSubscriptionsListResult /// class. /// - /// The list of billing subscriptions - /// summary. + /// The list of billing subscriptions. /// The link (url) to the next page of /// results. - public BillingSubscriptionsListResult(IList value = default(IList), string nextLink = default(string)) + public BillingSubscriptionsListResult(IList value = default(IList), string nextLink = default(string)) { Value = value; NextLink = nextLink; @@ -50,10 +49,10 @@ public BillingSubscriptionsListResult() partial void CustomInit(); /// - /// Gets the list of billing subscriptions summary. + /// Gets the list of billing subscriptions. /// [JsonProperty(PropertyName = "value")] - public IList Value { get; private set; } + public IList Value { get; private set; } /// /// Gets the link (url) to the next page of results. diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingSubscriptionsTransferHeaders.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingSubscriptionsTransferHeaders.cs index 582e08544f7f3..253d7ba5b08db 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingSubscriptionsTransferHeaders.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/BillingSubscriptionsTransferHeaders.cs @@ -34,13 +34,10 @@ public BillingSubscriptionsTransferHeaders() /// Location URI to poll for result. /// Recommends the retryable time after /// receiving this. - /// URI to poll for the operation - /// status - public BillingSubscriptionsTransferHeaders(string location = default(string), int? retryAfter = default(int?), string azureAsyncOperation = default(string)) + public BillingSubscriptionsTransferHeaders(string location = default(string), int? retryAfter = default(int?)) { Location = location; RetryAfter = retryAfter; - AzureAsyncOperation = azureAsyncOperation; CustomInit(); } @@ -61,11 +58,5 @@ public BillingSubscriptionsTransferHeaders() [JsonProperty(PropertyName = "Retry-After")] public int? RetryAfter { get; set; } - /// - /// Gets or sets URI to poll for the operation status - /// - [JsonProperty(PropertyName = "Azure-AsyncOperation")] - public string AzureAsyncOperation { get; set; } - } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Customer.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Customer.cs new file mode 100644 index 0000000000000..89c7ab63b4cfe --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Customer.cs @@ -0,0 +1,79 @@ +// +// 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.Billing.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A partner's customer. + /// + [Rest.Serialization.JsonTransformation] + public partial class Customer : Resource + { + /// + /// Initializes a new instance of the Customer class. + /// + public Customer() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Customer class. + /// + /// Resource Id. + /// Resource name. + /// Resource type. + /// The name of the customer. + /// Information about the + /// product. + /// The resellers which are allowed to provide + /// service to this customer. + public Customer(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), IList enabledAzurePlans = default(IList), IList resellers = default(IList)) + : base(id, name, type) + { + DisplayName = displayName; + EnabledAzurePlans = enabledAzurePlans; + Resellers = resellers; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the customer. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets information about the product. + /// + [JsonProperty(PropertyName = "properties.enabledAzurePlans")] + public IList EnabledAzurePlans { get; set; } + + /// + /// Gets or sets the resellers which are allowed to provide service to + /// this customer. + /// + [JsonProperty(PropertyName = "properties.resellers")] + public IList Resellers { get; set; } + + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/CustomerType.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/CustomerType.cs new file mode 100644 index 0000000000000..f3aa34eb08481 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/CustomerType.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for CustomerType. + /// + public static class CustomerType + { + public const string Enterprise = "Enterprise"; + public const string Individual = "Individual"; + public const string Partner = "Partner"; + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/DownloadProperties.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Document.cs similarity index 83% rename from sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/DownloadProperties.cs rename to sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Document.cs index f91a65dcf1cb2..36f973b7dd431 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/DownloadProperties.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Document.cs @@ -16,23 +16,23 @@ namespace Microsoft.Azure.Management.Billing.Models /// /// The properties of the invoice download. /// - public partial class DownloadProperties + public partial class Document { /// - /// Initializes a new instance of the DownloadProperties class. + /// Initializes a new instance of the Document class. /// - public DownloadProperties() + public Document() { CustomInit(); } /// - /// Initializes a new instance of the DownloadProperties class. + /// Initializes a new instance of the Document class. /// /// Document type. Possible values include: /// 'Invoice', 'VoidNote', 'Receipt', 'CreditNote' /// Document URL. - public DownloadProperties(string kind = default(string), string url = default(string)) + public Document(string kind = default(string), string url = default(string)) { Kind = kind; Url = url; diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/DocumentType.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/DocumentType.cs new file mode 100644 index 0000000000000..6a75ed6700685 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/DocumentType.cs @@ -0,0 +1,24 @@ +// +// 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.Billing.Models +{ + + /// + /// Defines values for DocumentType. + /// + public static class DocumentType + { + public const string Invoice = "Invoice"; + public const string VoidNote = "VoidNote"; + public const string Receipt = "Receipt"; + public const string CreditNote = "CreditNote"; + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InitiateTransferRequest.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InitiateTransferRequest.cs index a16b7c341e08b..00b981362f05b 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InitiateTransferRequest.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InitiateTransferRequest.cs @@ -32,14 +32,13 @@ public InitiateTransferRequest() /// /// Initializes a new instance of the InitiateTransferRequest class. /// - /// Target Usage context for devTest - /// subscriptions. /// Email Id of recipient for /// transfer. - public InitiateTransferRequest(string billingProfileId = default(string), string recipientEmailId = default(string)) + /// Optional reseller Id for transfer. + public InitiateTransferRequest(string recipientEmailId = default(string), string resellerId = default(string)) { - BillingProfileId = billingProfileId; RecipientEmailId = recipientEmailId; + ResellerId = resellerId; CustomInit(); } @@ -48,17 +47,17 @@ public InitiateTransferRequest() /// partial void CustomInit(); - /// - /// Gets or sets target Usage context for devTest subscriptions. - /// - [JsonProperty(PropertyName = "properties.billingProfileId")] - public string BillingProfileId { get; set; } - /// /// Gets or sets email Id of recipient for transfer. /// [JsonProperty(PropertyName = "properties.recipientEmailId")] public string RecipientEmailId { get; set; } + /// + /// Gets or sets optional reseller Id for transfer. + /// + [JsonProperty(PropertyName = "properties.resellerId")] + public string ResellerId { get; set; } + } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceSummary.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Invoice.cs similarity index 73% rename from sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceSummary.cs rename to sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Invoice.cs index ffd2e631cc45c..21725e4db6571 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceSummary.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Invoice.cs @@ -21,18 +21,18 @@ namespace Microsoft.Azure.Management.Billing.Models /// An invoice resource. /// [Rest.Serialization.JsonTransformation] - public partial class InvoiceSummary : Resource + public partial class Invoice : Resource { /// - /// Initializes a new instance of the InvoiceSummary class. + /// Initializes a new instance of the Invoice class. /// - public InvoiceSummary() + public Invoice() { CustomInit(); } /// - /// Initializes a new instance of the InvoiceSummary class. + /// Initializes a new instance of the Invoice class. /// /// Resource Id. /// Resource name. @@ -50,14 +50,14 @@ public InvoiceSummary() /// period. /// The billing profile id this invoice /// belongs to. - /// The profile name this invoice - /// belongs to. + /// The billing profile display + /// name this invoice belongs to. /// The purchase identifier for the /// invoice. - /// List of document urls available to - /// download including invoice and tax documents. + /// List of documents available to download + /// including invoice and tax documents. /// List of payments. - public InvoiceSummary(string id = default(string), string name = default(string), string type = default(string), System.DateTime? dueDate = default(System.DateTime?), System.DateTime? invoiceDate = default(System.DateTime?), string status = default(string), Amount amountDue = default(Amount), Amount billedAmount = default(Amount), System.DateTime? invoicePeriodStartDate = default(System.DateTime?), System.DateTime? invoicePeriodEndDate = default(System.DateTime?), string billingProfileId = default(string), string billingProfileName = default(string), string purchaseOrderNumber = default(string), IList documentUrls = default(IList), IList payments = default(IList)) + public Invoice(string id = default(string), string name = default(string), string type = default(string), System.DateTime? dueDate = default(System.DateTime?), System.DateTime? invoiceDate = default(System.DateTime?), string status = default(string), Amount amountDue = default(Amount), Amount billedAmount = default(Amount), System.DateTime? invoicePeriodStartDate = default(System.DateTime?), System.DateTime? invoicePeriodEndDate = default(System.DateTime?), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string purchaseOrderNumber = default(string), IList documents = default(IList), IList payments = default(IList)) : base(id, name, type) { DueDate = dueDate; @@ -68,9 +68,9 @@ public InvoiceSummary() InvoicePeriodStartDate = invoicePeriodStartDate; InvoicePeriodEndDate = invoicePeriodEndDate; BillingProfileId = billingProfileId; - BillingProfileName = billingProfileName; + BillingProfileDisplayName = billingProfileDisplayName; PurchaseOrderNumber = purchaseOrderNumber; - DocumentUrls = documentUrls; + Documents = documents; Payments = payments; CustomInit(); } @@ -130,10 +130,10 @@ public InvoiceSummary() public string BillingProfileId { get; private set; } /// - /// Gets the profile name this invoice belongs to. + /// Gets the billing profile display name this invoice belongs to. /// - [JsonProperty(PropertyName = "properties.billingProfileName")] - public string BillingProfileName { get; private set; } + [JsonProperty(PropertyName = "properties.billingProfileDisplayName")] + public string BillingProfileDisplayName { get; private set; } /// /// Gets the purchase identifier for the invoice. @@ -142,11 +142,11 @@ public InvoiceSummary() public string PurchaseOrderNumber { get; private set; } /// - /// Gets list of document urls available to download including invoice - /// and tax documents. + /// Gets list of documents available to download including invoice and + /// tax documents. /// - [JsonProperty(PropertyName = "properties.documentUrls")] - public IList DocumentUrls { get; private set; } + [JsonProperty(PropertyName = "properties.documents")] + public IList Documents { get; private set; } /// /// Gets list of payments. diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceListResult.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceListResult.cs index 3d3d9d8b41aef..29686c43e46f0 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceListResult.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceListResult.cs @@ -34,7 +34,7 @@ public InvoiceListResult() /// The list of invoices. /// The link (url) to the next page of /// results. - public InvoiceListResult(IList value = default(IList), string nextLink = default(string)) + public InvoiceListResult(IList value = default(IList), string nextLink = default(string)) { Value = value; NextLink = nextLink; @@ -50,7 +50,7 @@ public InvoiceListResult() /// Gets the list of invoices. /// [JsonProperty(PropertyName = "value")] - public IList Value { get; private set; } + public IList Value { get; private set; } /// /// Gets the link (url) to the next page of results. diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceSection.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceSection.cs index 2c83b9f016f66..7d0e4e64e6d7c 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceSection.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceSection.cs @@ -13,8 +13,6 @@ namespace Microsoft.Azure.Management.Billing.Models using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// @@ -38,13 +36,10 @@ public InvoiceSection() /// Resource name. /// Resource type. /// The name of the InvoiceSection. - /// The billing profiles associated to - /// the billing account. - public InvoiceSection(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), IList billingProfiles = default(IList)) + public InvoiceSection(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string)) : base(id, name, type) { DisplayName = displayName; - BillingProfiles = billingProfiles; CustomInit(); } @@ -59,12 +54,5 @@ public InvoiceSection() [JsonProperty(PropertyName = "properties.displayName")] public string DisplayName { get; set; } - /// - /// Gets or sets the billing profiles associated to the billing - /// account. - /// - [JsonProperty(PropertyName = "properties.billingProfiles")] - public IList BillingProfiles { get; set; } - } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceSectionProperties.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceSectionCreationRequest.cs similarity index 57% rename from sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceSectionProperties.cs rename to sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceSectionCreationRequest.cs index 0d524e480a908..63666bada0da4 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceSectionProperties.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceSectionCreationRequest.cs @@ -11,33 +11,30 @@ namespace Microsoft.Azure.Management.Billing.Models { using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// /// The properties of an InvoiceSection. /// - public partial class InvoiceSectionProperties + public partial class InvoiceSectionCreationRequest { /// - /// Initializes a new instance of the InvoiceSectionProperties class. + /// Initializes a new instance of the InvoiceSectionCreationRequest + /// class. /// - public InvoiceSectionProperties() + public InvoiceSectionCreationRequest() { CustomInit(); } /// - /// Initializes a new instance of the InvoiceSectionProperties class. + /// Initializes a new instance of the InvoiceSectionCreationRequest + /// class. /// /// The name of the InvoiceSection. - /// The billing profiles associated to - /// the billing account. - public InvoiceSectionProperties(string displayName = default(string), IList billingProfiles = default(IList)) + public InvoiceSectionCreationRequest(string displayName = default(string)) { DisplayName = displayName; - BillingProfiles = billingProfiles; CustomInit(); } @@ -52,12 +49,5 @@ public InvoiceSectionProperties() [JsonProperty(PropertyName = "displayName")] public string DisplayName { get; set; } - /// - /// Gets or sets the billing profiles associated to the billing - /// account. - /// - [JsonProperty(PropertyName = "billingProfiles")] - public IList BillingProfiles { get; set; } - } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceSectionsCreateHeaders.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceSectionsCreateHeaders.cs index 035ba83f811e6..347073d3b7c44 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceSectionsCreateHeaders.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceSectionsCreateHeaders.cs @@ -34,13 +34,10 @@ public InvoiceSectionsCreateHeaders() /// Location URI to poll for result /// Recommends the retryable time after /// receiving this. - /// URI to poll for the operation - /// status - public InvoiceSectionsCreateHeaders(string location = default(string), int? retryAfter = default(int?), string azureAsyncOperation = default(string)) + public InvoiceSectionsCreateHeaders(string location = default(string), int? retryAfter = default(int?)) { Location = location; RetryAfter = retryAfter; - AzureAsyncOperation = azureAsyncOperation; CustomInit(); } @@ -61,11 +58,5 @@ public InvoiceSectionsCreateHeaders() [JsonProperty(PropertyName = "Retry-After")] public int? RetryAfter { get; set; } - /// - /// Gets or sets URI to poll for the operation status - /// - [JsonProperty(PropertyName = "Azure-AsyncOperation")] - public string AzureAsyncOperation { get; set; } - } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceStatus.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceStatus.cs new file mode 100644 index 0000000000000..3ed93022c0554 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/InvoiceStatus.cs @@ -0,0 +1,24 @@ +// +// 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.Billing.Models +{ + + /// + /// Defines values for InvoiceStatus. + /// + public static class InvoiceStatus + { + public const string PastDue = "PastDue"; + public const string Due = "Due"; + public const string Paid = "Paid"; + public const string Void = "Void"; + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/LineOfCredit.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/LineOfCredit.cs new file mode 100644 index 0000000000000..69722dbd54338 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/LineOfCredit.cs @@ -0,0 +1,85 @@ +// +// 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.Billing.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Line of credit resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class LineOfCredit : Resource + { + /// + /// Initializes a new instance of the LineOfCredit class. + /// + public LineOfCredit() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LineOfCredit class. + /// + /// Resource Id. + /// Resource name. + /// Resource type. + /// The current credit limit. + /// The reason for the line of credit status when + /// not approved. + /// Remaining balance. + /// The line of credit status. Possible values + /// include: 'Approved', 'Rejected' + public LineOfCredit(string id = default(string), string name = default(string), string type = default(string), Amount creditLimit = default(Amount), string reason = default(string), Amount remainingBalance = default(Amount), string status = default(string)) + : base(id, name, type) + { + CreditLimit = creditLimit; + Reason = reason; + RemainingBalance = remainingBalance; + Status = status; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the current credit limit. + /// + [JsonProperty(PropertyName = "properties.creditLimit")] + public Amount CreditLimit { get; set; } + + /// + /// Gets the reason for the line of credit status when not approved. + /// + [JsonProperty(PropertyName = "properties.reason")] + public string Reason { get; private set; } + + /// + /// Gets remaining balance. + /// + [JsonProperty(PropertyName = "properties.remainingBalance")] + public Amount RemainingBalance { get; private set; } + + /// + /// Gets or sets the line of credit status. Possible values include: + /// 'Approved', 'Rejected' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; set; } + + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/LineOfCreditsUpdateHeaders.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/LineOfCreditsUpdateHeaders.cs new file mode 100644 index 0000000000000..11328f1778e59 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/LineOfCreditsUpdateHeaders.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Update operation. + /// + public partial class LineOfCreditsUpdateHeaders + { + /// + /// Initializes a new instance of the LineOfCreditsUpdateHeaders class. + /// + public LineOfCreditsUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LineOfCreditsUpdateHeaders class. + /// + /// Location URI to poll for result. + /// Recommends the retryable time after + /// receiving this. + public LineOfCreditsUpdateHeaders(string location = default(string), int? retryAfter = default(int?)) + { + Location = location; + RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets location URI to poll for result. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets recommends the retryable time after receiving this. + /// + [JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter { get; set; } + + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/MarketplacePurchasesPolicy.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/MarketplacePurchasesPolicy.cs new file mode 100644 index 0000000000000..b9b51871a589f --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/MarketplacePurchasesPolicy.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for MarketplacePurchasesPolicy. + /// + public static class MarketplacePurchasesPolicy + { + public const string AllAllowed = "AllAllowed"; + public const string FreeAllowed = "FreeAllowed"; + public const string NotAllowed = "NotAllowed"; + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/OperationStatus.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/OperationStatus.cs deleted file mode 100644 index 26a84a70ab38b..0000000000000 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/OperationStatus.cs +++ /dev/null @@ -1,68 +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.Billing.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// status of the Billing POST/PUT operation. - /// - public partial class OperationStatus - { - /// - /// Initializes a new instance of the OperationStatus class. - /// - public OperationStatus() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the OperationStatus class. - /// - /// The operation Id. - /// Status of the pending operation - /// Status Detail of the pending - /// operation - public OperationStatus(string id = default(string), string status = default(string), string statusDetail = default(string)) - { - Id = id; - Status = status; - StatusDetail = statusDetail; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the operation Id. - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } - - /// - /// Gets or sets status of the pending operation - /// - [JsonProperty(PropertyName = "status")] - public string Status { get; set; } - - /// - /// Gets or sets status Detail of the pending operation - /// - [JsonProperty(PropertyName = "statusDetail")] - public string StatusDetail { get; set; } - - } -} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/PaymentMethod.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/PaymentMethod.cs index 5cf71f943c913..02fb87d8c3d00 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/PaymentMethod.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/PaymentMethod.cs @@ -38,10 +38,10 @@ public PaymentMethod() /// Payment method type. Possible /// values include: 'Credits', 'ChequeWire' /// Details about the payment method. - /// Expiration date. + /// Expiration month and year. /// The currency associated with the payment /// method. - public PaymentMethod(string id = default(string), string name = default(string), string type = default(string), string paymentMethodType = default(string), string details = default(string), System.DateTime? expiration = default(System.DateTime?), string currency = default(string)) + public PaymentMethod(string id = default(string), string name = default(string), string type = default(string), string paymentMethodType = default(string), string details = default(string), string expiration = default(string), string currency = default(string)) : base(id, name, type) { PaymentMethodType = paymentMethodType; @@ -70,10 +70,10 @@ public PaymentMethod() public string Details { get; private set; } /// - /// Gets expiration date. + /// Gets expiration month and year. /// [JsonProperty(PropertyName = "properties.expiration")] - public System.DateTime? Expiration { get; private set; } + public string Expiration { get; private set; } /// /// Gets the currency associated with the payment method. diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Policy.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Policy.cs index 1e3f633436fef..85de382160acb 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Policy.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Policy.cs @@ -35,18 +35,20 @@ public Policy() /// Resource Id. /// Resource name. /// Resource type. - /// The - /// marketplacePurchasesAllowed flag. - /// The - /// reservationPurchasesAllowed flag. - /// The - /// subscriptionOwnerCanViewCharges flag. - public Policy(string id = default(string), string name = default(string), string type = default(string), bool? marketplacePurchasesAllowed = default(bool?), bool? reservationPurchasesAllowed = default(bool?), bool? subscriptionOwnerCanViewCharges = default(bool?)) + /// The marketplace purchases are + /// free, allowed or not allowed. Possible values include: + /// 'AllAllowed', 'FreeAllowed', 'NotAllowed' + /// The reservation purchases + /// allowed or not. Possible values include: 'Allowed', + /// 'NotAllowed' + /// Who can view charges. Possible values + /// include: 'None', 'SubscriptionOwner' + public Policy(string id = default(string), string name = default(string), string type = default(string), string marketplacePurchases = default(string), string reservationPurchases = default(string), string viewCharges = default(string)) : base(id, name, type) { - MarketplacePurchasesAllowed = marketplacePurchasesAllowed; - ReservationPurchasesAllowed = reservationPurchasesAllowed; - SubscriptionOwnerCanViewCharges = subscriptionOwnerCanViewCharges; + MarketplacePurchases = marketplacePurchases; + ReservationPurchases = reservationPurchases; + ViewCharges = viewCharges; CustomInit(); } @@ -56,22 +58,26 @@ public Policy() partial void CustomInit(); /// - /// Gets or sets the marketplacePurchasesAllowed flag. + /// Gets or sets the marketplace purchases are free, allowed or not + /// allowed. Possible values include: 'AllAllowed', 'FreeAllowed', + /// 'NotAllowed' /// - [JsonProperty(PropertyName = "properties.marketplacePurchasesAllowed")] - public bool? MarketplacePurchasesAllowed { get; set; } + [JsonProperty(PropertyName = "properties.marketplacePurchases")] + public string MarketplacePurchases { get; set; } /// - /// Gets or sets the reservationPurchasesAllowed flag. + /// Gets or sets the reservation purchases allowed or not. Possible + /// values include: 'Allowed', 'NotAllowed' /// - [JsonProperty(PropertyName = "properties.reservationPurchasesAllowed")] - public bool? ReservationPurchasesAllowed { get; set; } + [JsonProperty(PropertyName = "properties.reservationPurchases")] + public string ReservationPurchases { get; set; } /// - /// Gets or sets the subscriptionOwnerCanViewCharges flag. + /// Gets or sets who can view charges. Possible values include: 'None', + /// 'SubscriptionOwner' /// - [JsonProperty(PropertyName = "properties.subscriptionOwnerCanViewCharges")] - public bool? SubscriptionOwnerCanViewCharges { get; set; } + [JsonProperty(PropertyName = "properties.viewCharges")] + public string ViewCharges { get; set; } } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/PriceSheetDownloadByBillingProfileHeaders.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/PriceSheetDownloadByBillingProfileHeaders.cs new file mode 100644 index 0000000000000..47a7dd2a5b11c --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/PriceSheetDownloadByBillingProfileHeaders.cs @@ -0,0 +1,74 @@ +// +// 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.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for DownloadByBillingProfile operation. + /// + public partial class PriceSheetDownloadByBillingProfileHeaders + { + /// + /// Initializes a new instance of the + /// PriceSheetDownloadByBillingProfileHeaders class. + /// + public PriceSheetDownloadByBillingProfileHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// PriceSheetDownloadByBillingProfileHeaders 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. + /// The operation entity Id GUID. + public PriceSheetDownloadByBillingProfileHeaders(string location = default(string), string retryAfter = default(string), string oDataEntityId = default(string)) + { + Location = location; + RetryAfter = retryAfter; + ODataEntityId = oDataEntityId; + 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 the operation entity Id GUID. + /// + [JsonProperty(PropertyName = "OData-EntityId")] + public string ODataEntityId { get; set; } + + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/PriceSheetDownloadHeaders.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/PriceSheetDownloadHeaders.cs index d01435a680a8b..29f758def14c2 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/PriceSheetDownloadHeaders.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/PriceSheetDownloadHeaders.cs @@ -34,15 +34,11 @@ public PriceSheetDownloadHeaders() /// 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. /// The operation entity Id GUID. - public PriceSheetDownloadHeaders(string location = default(string), string retryAfter = default(string), string azureAsyncOperation = default(string), string oDataEntityId = default(string)) + public PriceSheetDownloadHeaders(string location = default(string), string retryAfter = default(string), string oDataEntityId = default(string)) { Location = location; RetryAfter = retryAfter; - AzureAsyncOperation = azureAsyncOperation; ODataEntityId = oDataEntityId; CustomInit(); } @@ -66,13 +62,6 @@ public PriceSheetDownloadHeaders() [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; } - /// /// Gets or sets the operation entity Id GUID. /// diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ProductSummary.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Product.cs similarity index 70% rename from sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ProductSummary.cs rename to sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Product.cs index 7b824db3a0c1b..4b60b0b0a8e9c 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ProductSummary.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Product.cs @@ -16,21 +16,21 @@ namespace Microsoft.Azure.Management.Billing.Models using System.Linq; /// - /// A product summary resource. + /// A product resource. /// [Rest.Serialization.JsonTransformation] - public partial class ProductSummary : Resource + public partial class Product : Resource { /// - /// Initializes a new instance of the ProductSummary class. + /// Initializes a new instance of the Product class. /// - public ProductSummary() + public Product() { CustomInit(); } /// - /// Initializes a new instance of the ProductSummary class. + /// Initializes a new instance of the Product class. /// /// Resource Id. /// Resource name. @@ -54,13 +54,17 @@ public ProductSummary() /// Parent Product Id. /// Invoice section id to which this /// product belongs. - /// Invoice section name to which this - /// product belongs. + /// Invoice section display + /// name to which this product belongs. /// Billing Profile id to which this /// product belongs. - /// Billing Profile name to which this - /// product belongs. - public ProductSummary(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), System.DateTime? purchaseDate = default(System.DateTime?), string productTypeId = default(string), string productType = default(string), string status = default(string), System.DateTime? endDate = default(System.DateTime?), string billingFrequency = default(string), Amount lastCharge = default(Amount), System.DateTime? lastChargeDate = default(System.DateTime?), double? quantity = default(double?), string skuId = default(string), string skuDescription = default(string), string availabilityId = default(string), string parentProductId = default(string), string invoiceSectionId = default(string), string invoiceSectionName = default(string), string billingProfileId = default(string), string billingProfileName = default(string)) + /// Billing Profile display + /// name to which this product belongs. + /// Customer id to which this product + /// belongs. + /// Display name of customer to which + /// this product belongs. + public Product(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), System.DateTime? purchaseDate = default(System.DateTime?), string productTypeId = default(string), string productType = default(string), string status = default(string), System.DateTime? endDate = default(System.DateTime?), string billingFrequency = default(string), Amount lastCharge = default(Amount), System.DateTime? lastChargeDate = default(System.DateTime?), double? quantity = default(double?), string skuId = default(string), string skuDescription = default(string), string availabilityId = default(string), string parentProductId = default(string), string invoiceSectionId = default(string), string invoiceSectionDisplayName = default(string), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string customerId = default(string), string customerDisplayName = default(string)) : base(id, name, type) { DisplayName = displayName; @@ -78,9 +82,11 @@ public ProductSummary() AvailabilityId = availabilityId; ParentProductId = parentProductId; InvoiceSectionId = invoiceSectionId; - InvoiceSectionName = invoiceSectionName; + InvoiceSectionDisplayName = invoiceSectionDisplayName; BillingProfileId = billingProfileId; - BillingProfileName = billingProfileName; + BillingProfileDisplayName = billingProfileDisplayName; + CustomerId = customerId; + CustomerDisplayName = customerDisplayName; CustomInit(); } @@ -183,10 +189,10 @@ public ProductSummary() public string InvoiceSectionId { get; private set; } /// - /// Gets invoice section name to which this product belongs. + /// Gets invoice section display name to which this product belongs. /// - [JsonProperty(PropertyName = "properties.invoiceSectionName")] - public string InvoiceSectionName { get; private set; } + [JsonProperty(PropertyName = "properties.invoiceSectionDisplayName")] + public string InvoiceSectionDisplayName { get; private set; } /// /// Gets billing Profile id to which this product belongs. @@ -195,10 +201,22 @@ public ProductSummary() public string BillingProfileId { get; private set; } /// - /// Gets billing Profile name to which this product belongs. + /// Gets billing Profile display name to which this product belongs. + /// + [JsonProperty(PropertyName = "properties.billingProfileDisplayName")] + public string BillingProfileDisplayName { get; private set; } + + /// + /// Gets customer id to which this product belongs. + /// + [JsonProperty(PropertyName = "properties.customerId")] + public string CustomerId { get; private set; } + + /// + /// Gets display name of customer to which this product belongs. /// - [JsonProperty(PropertyName = "properties.billingProfileName")] - public string BillingProfileName { get; private set; } + [JsonProperty(PropertyName = "properties.customerDisplayName")] + public string CustomerDisplayName { get; private set; } } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ProductTransferValidationErrorCode.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ProductTransferValidationErrorCode.cs new file mode 100644 index 0000000000000..b2aa3eff7e272 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ProductTransferValidationErrorCode.cs @@ -0,0 +1,29 @@ +// +// 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.Billing.Models +{ + + /// + /// Defines values for ProductTransferValidationErrorCode. + /// + public static class ProductTransferValidationErrorCode + { + public const string InvalidSource = "InvalidSource"; + public const string ProductNotActive = "ProductNotActive"; + public const string InsufficientPermissionOnSource = "InsufficientPermissionOnSource"; + public const string InsufficientPermissionOnDestination = "InsufficientPermissionOnDestination"; + public const string DestinationBillingProfilePastDue = "DestinationBillingProfilePastDue"; + public const string ProductTypeNotSupported = "ProductTypeNotSupported"; + public const string CrossBillingAccountNotAllowed = "CrossBillingAccountNotAllowed"; + public const string NotAvailableForDestinationMarket = "NotAvailableForDestinationMarket"; + public const string OneTimePurchaseProductTransferNotAllowed = "OneTimePurchaseProductTransferNotAllowed"; + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ProductsListResult.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ProductsListResult.cs index f32c04aec14b0..90a6ed7c54f02 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ProductsListResult.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ProductsListResult.cs @@ -16,8 +16,8 @@ namespace Microsoft.Azure.Management.Billing.Models using System.Linq; /// - /// Result of listing products summary. It contains a list of available - /// products summaries in reverse chronological order by purchase date. + /// Result of listing products. It contains a list of available products + /// summaries in reverse chronological order by purchase date. /// public partial class ProductsListResult { @@ -32,10 +32,10 @@ public ProductsListResult() /// /// Initializes a new instance of the ProductsListResult class. /// - /// The list of products summary. + /// The list of products. /// The link (url) to the next page of /// results. - public ProductsListResult(IList value = default(IList), string nextLink = default(string)) + public ProductsListResult(IList value = default(IList), string nextLink = default(string)) { Value = value; NextLink = nextLink; @@ -48,10 +48,10 @@ public ProductsListResult() partial void CustomInit(); /// - /// Gets the list of products summary. + /// Gets the list of products. /// [JsonProperty(PropertyName = "value")] - public IList Value { get; private set; } + public IList Value { get; private set; } /// /// Gets the link (url) to the next page of results. diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ProductsTransferHeaders.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ProductsTransferHeaders.cs index d0cadf2b0d550..2440f6d2f2f09 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ProductsTransferHeaders.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ProductsTransferHeaders.cs @@ -32,13 +32,10 @@ public ProductsTransferHeaders() /// Location URI to poll for result /// Recommends the retryable time after /// receiving this. - /// URI to poll for the operation - /// status - public ProductsTransferHeaders(string location = default(string), int? retryAfter = default(int?), string azureAsyncOperation = default(string)) + public ProductsTransferHeaders(string location = default(string), int? retryAfter = default(int?)) { Location = location; RetryAfter = retryAfter; - AzureAsyncOperation = azureAsyncOperation; CustomInit(); } @@ -59,11 +56,5 @@ public ProductsTransferHeaders() [JsonProperty(PropertyName = "Retry-After")] public int? RetryAfter { get; set; } - /// - /// Gets or sets URI to poll for the operation status - /// - [JsonProperty(PropertyName = "Azure-AsyncOperation")] - public string AzureAsyncOperation { get; set; } - } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/RecipientTransferDetails.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/RecipientTransferDetails.cs index a451ae984fb1a..c4dddcb9ca961 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/RecipientTransferDetails.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/RecipientTransferDetails.cs @@ -45,13 +45,17 @@ public RecipientTransferDetails() /// transfer. /// Email Id of initiator of /// transfer. + /// Reseller Id for transfer. + /// Reseller name for transfer. + /// Customer type of the + /// initiator. /// Email Id who user canceled the /// transfer. /// Transfer last modification /// time. /// Detailed transfer /// status. - public RecipientTransferDetails(System.DateTime? creationTime = default(System.DateTime?), System.DateTime? expirationTime = default(System.DateTime?), IList allowedProductType = default(IList), string transferStatus = default(string), string recipientEmailId = default(string), string initiatorEmailId = default(string), string canceledBy = default(string), System.DateTime? lastModifiedTime = default(System.DateTime?), IList detailedTransferStatus = default(IList)) + public RecipientTransferDetails(System.DateTime? creationTime = default(System.DateTime?), System.DateTime? expirationTime = default(System.DateTime?), IList allowedProductType = default(IList), string transferStatus = default(string), string recipientEmailId = default(string), string initiatorEmailId = default(string), string resellerId = default(string), string resellerName = default(string), string initiatorCustomerType = default(string), string canceledBy = default(string), System.DateTime? lastModifiedTime = default(System.DateTime?), IList detailedTransferStatus = default(IList)) { CreationTime = creationTime; ExpirationTime = expirationTime; @@ -59,6 +63,9 @@ public RecipientTransferDetails() TransferStatus = transferStatus; RecipientEmailId = recipientEmailId; InitiatorEmailId = initiatorEmailId; + ResellerId = resellerId; + ResellerName = resellerName; + InitiatorCustomerType = initiatorCustomerType; CanceledBy = canceledBy; LastModifiedTime = lastModifiedTime; DetailedTransferStatus = detailedTransferStatus; @@ -108,6 +115,24 @@ public RecipientTransferDetails() [JsonProperty(PropertyName = "properties.initiatorEmailId")] public string InitiatorEmailId { get; private set; } + /// + /// Gets reseller Id for transfer. + /// + [JsonProperty(PropertyName = "properties.resellerId")] + public string ResellerId { get; private set; } + + /// + /// Gets reseller name for transfer. + /// + [JsonProperty(PropertyName = "properties.resellerName")] + public string ResellerName { get; private set; } + + /// + /// Gets customer type of the initiator. + /// + [JsonProperty(PropertyName = "properties.initiatorCustomerType")] + public string InitiatorCustomerType { get; private set; } + /// /// Gets email Id who user canceled the transfer. /// diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Reseller.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Reseller.cs new file mode 100644 index 0000000000000..5efc6c6fcde2d --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Reseller.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.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Details about a reseller. + /// + public partial class Reseller + { + /// + /// Initializes a new instance of the Reseller class. + /// + public Reseller() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Reseller class. + /// + /// The reseller id. + /// A description of the reseller. + public Reseller(string resellerId = default(string), string description = default(string)) + { + ResellerId = resellerId; + Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the reseller id. + /// + [JsonProperty(PropertyName = "resellerId")] + public string ResellerId { get; private set; } + + /// + /// Gets a description of the reseller. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; private set; } + + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ReservationPurchasesPolicy.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ReservationPurchasesPolicy.cs new file mode 100644 index 0000000000000..a41293d8b273a --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ReservationPurchasesPolicy.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.Billing.Models +{ + + /// + /// Defines values for ReservationPurchasesPolicy. + /// + public static class ReservationPurchasesPolicy + { + public const string Allowed = "Allowed"; + public const string NotAllowed = "NotAllowed"; + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Status.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Status.cs new file mode 100644 index 0000000000000..c0910b8037339 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Status.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.Billing.Models +{ + + /// + /// Defines values for Status. + /// + public static class Status + { + public const string Approved = "Approved"; + public const string Rejected = "Rejected"; + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/SubscriptionTransferValidationErrorCode.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/SubscriptionTransferValidationErrorCode.cs new file mode 100644 index 0000000000000..128d487ef129c --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/SubscriptionTransferValidationErrorCode.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for SubscriptionTransferValidationErrorCode. + /// + public static class SubscriptionTransferValidationErrorCode + { + public const string InvalidSource = "InvalidSource"; + public const string SubscriptionNotActive = "SubscriptionNotActive"; + public const string InsufficientPermissionOnSource = "InsufficientPermissionOnSource"; + public const string InsufficientPermissionOnDestination = "InsufficientPermissionOnDestination"; + public const string DestinationBillingProfilePastDue = "DestinationBillingProfilePastDue"; + public const string SubscriptionTypeNotSupported = "SubscriptionTypeNotSupported"; + public const string CrossBillingAccountNotAllowed = "CrossBillingAccountNotAllowed"; + public const string NotAvailableForDestinationMarket = "NotAvailableForDestinationMarket"; + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransactionsSummary.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Transaction.cs similarity index 70% rename from sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransactionsSummary.cs rename to sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Transaction.cs index 97e3617a5a09d..41adddc53beee 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransactionsSummary.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/Transaction.cs @@ -16,21 +16,21 @@ namespace Microsoft.Azure.Management.Billing.Models using System.Linq; /// - /// A reservation transaction summary resource. + /// A reservation transaction resource. /// [Rest.Serialization.JsonTransformation] - public partial class TransactionsSummary : Resource + public partial class Transaction : Resource { /// - /// Initializes a new instance of the TransactionsSummary class. + /// Initializes a new instance of the Transaction class. /// - public TransactionsSummary() + public Transaction() { CustomInit(); } /// - /// Initializes a new instance of the TransactionsSummary class. + /// Initializes a new instance of the Transaction class. /// /// Resource Id. /// Resource name. @@ -53,15 +53,19 @@ public TransactionsSummary() /// Purchase quantity. /// Invoice section id to which this /// product belongs. - /// Invoice section name to which this - /// product belongs. + /// Invoice section display + /// name to which this product belongs. /// Billing Profile id to which this /// product belongs. - /// Billing Profile name to which this - /// product belongs. + /// Billing Profile display + /// name to which this product belongs. + /// Customer id to which this product + /// belongs. + /// Display name of customer to which + /// this product belongs. /// The subscription id. /// The subscription name. - public TransactionsSummary(string id = default(string), string name = default(string), string type = default(string), string kind = default(string), System.DateTime? date = default(System.DateTime?), string invoice = default(string), string orderId = default(string), string orderName = default(string), string productFamily = default(string), string productTypeId = default(string), string productType = default(string), string productDescription = default(string), string transactionType = default(string), Amount transactionAmount = default(Amount), int? quantity = default(int?), string invoiceSectionId = default(string), string invoiceSectionName = default(string), string billingProfileId = default(string), string billingProfileName = default(string), string subscriptionId = default(string), string subscriptionName = default(string)) + public Transaction(string id = default(string), string name = default(string), string type = default(string), string kind = default(string), System.DateTime? date = default(System.DateTime?), string invoice = default(string), string orderId = default(string), string orderName = default(string), string productFamily = default(string), string productTypeId = default(string), string productType = default(string), string productDescription = default(string), string transactionType = default(string), Amount transactionAmount = default(Amount), int? quantity = default(int?), string invoiceSectionId = default(string), string invoiceSectionDisplayName = default(string), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string customerId = default(string), string customerDisplayName = default(string), string subscriptionId = default(string), string subscriptionName = default(string)) : base(id, name, type) { Kind = kind; @@ -77,9 +81,11 @@ public TransactionsSummary() TransactionAmount = transactionAmount; Quantity = quantity; InvoiceSectionId = invoiceSectionId; - InvoiceSectionName = invoiceSectionName; + InvoiceSectionDisplayName = invoiceSectionDisplayName; BillingProfileId = billingProfileId; - BillingProfileName = billingProfileName; + BillingProfileDisplayName = billingProfileDisplayName; + CustomerId = customerId; + CustomerDisplayName = customerDisplayName; SubscriptionId = subscriptionId; SubscriptionName = subscriptionName; CustomInit(); @@ -171,10 +177,10 @@ public TransactionsSummary() public string InvoiceSectionId { get; private set; } /// - /// Gets invoice section name to which this product belongs. + /// Gets invoice section display name to which this product belongs. /// - [JsonProperty(PropertyName = "properties.invoiceSectionName")] - public string InvoiceSectionName { get; private set; } + [JsonProperty(PropertyName = "properties.invoiceSectionDisplayName")] + public string InvoiceSectionDisplayName { get; private set; } /// /// Gets billing Profile id to which this product belongs. @@ -183,10 +189,22 @@ public TransactionsSummary() public string BillingProfileId { get; private set; } /// - /// Gets billing Profile name to which this product belongs. + /// Gets billing Profile display name to which this product belongs. + /// + [JsonProperty(PropertyName = "properties.billingProfileDisplayName")] + public string BillingProfileDisplayName { get; private set; } + + /// + /// Gets customer id to which this product belongs. + /// + [JsonProperty(PropertyName = "properties.customerId")] + public string CustomerId { get; private set; } + + /// + /// Gets display name of customer to which this product belongs. /// - [JsonProperty(PropertyName = "properties.billingProfileName")] - public string BillingProfileName { get; private set; } + [JsonProperty(PropertyName = "properties.customerDisplayName")] + public string CustomerDisplayName { get; private set; } /// /// Gets the subscription id. diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransactionsListResult.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransactionListResult.cs similarity index 70% rename from sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransactionsListResult.cs rename to sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransactionListResult.cs index 0698ce1fb2e6a..b38f7aa05616f 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransactionsListResult.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransactionListResult.cs @@ -16,26 +16,25 @@ namespace Microsoft.Azure.Management.Billing.Models using System.Linq; /// - /// Result of listing reservation transactions summary. + /// Result of listing reservation transactions. /// - public partial class TransactionsListResult + public partial class TransactionListResult { /// - /// Initializes a new instance of the TransactionsListResult class. + /// Initializes a new instance of the TransactionListResult class. /// - public TransactionsListResult() + public TransactionListResult() { CustomInit(); } /// - /// Initializes a new instance of the TransactionsListResult class. + /// Initializes a new instance of the TransactionListResult class. /// - /// The list of reservation transactions - /// summary. + /// The list of reservation transactions. /// The link (url) to the next page of /// results. - public TransactionsListResult(IList value = default(IList), string nextLink = default(string)) + public TransactionListResult(IList value = default(IList), string nextLink = default(string)) { Value = value; NextLink = nextLink; @@ -48,10 +47,10 @@ public TransactionsListResult() partial void CustomInit(); /// - /// Gets the list of reservation transactions summary. + /// Gets the list of reservation transactions. /// [JsonProperty(PropertyName = "value")] - public IList Value { get; private set; } + public IList Value { get; private set; } /// /// Gets the link (url) to the next page of results. diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransferBillingSubscriptionRequest.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransferBillingSubscriptionRequest.cs index 73356f7165b63..caee5a03f3323 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransferBillingSubscriptionRequest.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransferBillingSubscriptionRequest.cs @@ -36,9 +36,12 @@ public TransferBillingSubscriptionRequest() /// /// The destination invoice /// section id. - public TransferBillingSubscriptionRequest(string destinationInvoiceSectionId = default(string)) + /// The destination billing + /// profile id. + public TransferBillingSubscriptionRequest(string destinationInvoiceSectionId = default(string), string destinationBillingProfileId = default(string)) { DestinationInvoiceSectionId = destinationInvoiceSectionId; + DestinationBillingProfileId = destinationBillingProfileId; CustomInit(); } @@ -53,5 +56,11 @@ public TransferBillingSubscriptionRequest() [JsonProperty(PropertyName = "properties.destinationInvoiceSectionId")] public string DestinationInvoiceSectionId { get; set; } + /// + /// Gets or sets the destination billing profile id. + /// + [JsonProperty(PropertyName = "properties.destinationBillingProfileId")] + public string DestinationBillingProfileId { get; set; } + } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransferBillingSubscriptionRequestProperties.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransferBillingSubscriptionRequestProperties.cs index 1de9174f58fd8..c441d309ce65a 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransferBillingSubscriptionRequestProperties.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransferBillingSubscriptionRequestProperties.cs @@ -33,9 +33,12 @@ public TransferBillingSubscriptionRequestProperties() /// /// The destination invoice /// section id. - public TransferBillingSubscriptionRequestProperties(string destinationInvoiceSectionId = default(string)) + /// The destination billing + /// profile id. + public TransferBillingSubscriptionRequestProperties(string destinationInvoiceSectionId = default(string), string destinationBillingProfileId = default(string)) { DestinationInvoiceSectionId = destinationInvoiceSectionId; + DestinationBillingProfileId = destinationBillingProfileId; CustomInit(); } @@ -50,5 +53,11 @@ public TransferBillingSubscriptionRequestProperties() [JsonProperty(PropertyName = "destinationInvoiceSectionId")] public string DestinationInvoiceSectionId { get; set; } + /// + /// Gets or sets the destination billing profile id. + /// + [JsonProperty(PropertyName = "destinationBillingProfileId")] + public string DestinationBillingProfileId { get; set; } + } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransferDetails.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransferDetails.cs index ea1d76fa501e5..293d805691c8d 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransferDetails.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransferDetails.cs @@ -38,6 +38,11 @@ public TransferDetails() /// Transfer expiration time. /// Target invoice section Id. /// Target billing account Id. + /// Reseller Id for transfer. + /// Reseller name for transfer. + /// Customer type of the + /// initiator. + /// Target billing profile Id. /// Overall transfer status. Possible /// values include: 'Pending', 'InProgress', 'Completed', /// 'CompletedWithErrors', 'Failed', 'Canceled', 'Declined' @@ -51,12 +56,16 @@ public TransferDetails() /// time. /// Detailed transfer /// status. - public TransferDetails(System.DateTime? creationTime = default(System.DateTime?), System.DateTime? expirationTime = default(System.DateTime?), string invoiceSectionId = default(string), string billingAccountId = default(string), string transferStatus = default(string), string recipientEmailId = default(string), string initiatorEmailId = default(string), string canceledBy = default(string), System.DateTime? lastModifiedTime = default(System.DateTime?), IList detailedTransferStatus = default(IList)) + public TransferDetails(System.DateTime? creationTime = default(System.DateTime?), System.DateTime? expirationTime = default(System.DateTime?), string invoiceSectionId = default(string), string billingAccountId = default(string), string resellerId = default(string), string resellerName = default(string), string initiatorCustomerType = default(string), string billingProfileId = default(string), string transferStatus = default(string), string recipientEmailId = default(string), string initiatorEmailId = default(string), string canceledBy = default(string), System.DateTime? lastModifiedTime = default(System.DateTime?), IList detailedTransferStatus = default(IList)) { CreationTime = creationTime; ExpirationTime = expirationTime; InvoiceSectionId = invoiceSectionId; BillingAccountId = billingAccountId; + ResellerId = resellerId; + ResellerName = resellerName; + InitiatorCustomerType = initiatorCustomerType; + BillingProfileId = billingProfileId; TransferStatus = transferStatus; RecipientEmailId = recipientEmailId; InitiatorEmailId = initiatorEmailId; @@ -95,6 +104,30 @@ public TransferDetails() [JsonProperty(PropertyName = "properties.billingAccountId")] public string BillingAccountId { get; private set; } + /// + /// Gets reseller Id for transfer. + /// + [JsonProperty(PropertyName = "properties.resellerId")] + public string ResellerId { get; private set; } + + /// + /// Gets reseller name for transfer. + /// + [JsonProperty(PropertyName = "properties.resellerName")] + public string ResellerName { get; private set; } + + /// + /// Gets customer type of the initiator. + /// + [JsonProperty(PropertyName = "properties.initiatorCustomerType")] + public string InitiatorCustomerType { get; private set; } + + /// + /// Gets target billing profile Id. + /// + [JsonProperty(PropertyName = "properties.billingProfileId")] + public string BillingProfileId { get; private set; } + /// /// Gets overall transfer status. Possible values include: 'Pending', /// 'InProgress', 'Completed', 'CompletedWithErrors', 'Failed', diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransferProductRequestProperties.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransferProductRequestProperties.cs index dab785ca787c2..76f21e33a9eb6 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransferProductRequestProperties.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/TransferProductRequestProperties.cs @@ -31,11 +31,14 @@ public TransferProductRequestProperties() /// Initializes a new instance of the TransferProductRequestProperties /// class. /// - /// Destination invoice + /// The destination invoice /// section id. - public TransferProductRequestProperties(string destinationInvoiceSectionId = default(string)) + /// The destination billing + /// profile id. + public TransferProductRequestProperties(string destinationInvoiceSectionId = default(string), string destinationBillingProfileId = default(string)) { DestinationInvoiceSectionId = destinationInvoiceSectionId; + DestinationBillingProfileId = destinationBillingProfileId; CustomInit(); } @@ -45,10 +48,16 @@ public TransferProductRequestProperties() partial void CustomInit(); /// - /// Gets or sets destination invoice section id. + /// Gets or sets the destination invoice section id. /// [JsonProperty(PropertyName = "destinationInvoiceSectionId")] public string DestinationInvoiceSectionId { get; set; } + /// + /// Gets or sets the destination billing profile id. + /// + [JsonProperty(PropertyName = "destinationBillingProfileId")] + public string DestinationBillingProfileId { get; set; } + } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/UpdateAutoRenewOperationSummary.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/UpdateAutoRenewOperation.cs similarity index 84% rename from sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/UpdateAutoRenewOperationSummary.cs rename to sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/UpdateAutoRenewOperation.cs index 7df5ea8e5aca5..d30e817542b05 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/UpdateAutoRenewOperationSummary.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/UpdateAutoRenewOperation.cs @@ -19,23 +19,21 @@ namespace Microsoft.Azure.Management.Billing.Models /// Summary of cancel product operation /// [Rest.Serialization.JsonTransformation] - public partial class UpdateAutoRenewOperationSummary + public partial class UpdateAutoRenewOperation { /// - /// Initializes a new instance of the UpdateAutoRenewOperationSummary - /// class. + /// Initializes a new instance of the UpdateAutoRenewOperation class. /// - public UpdateAutoRenewOperationSummary() + public UpdateAutoRenewOperation() { CustomInit(); } /// - /// Initializes a new instance of the UpdateAutoRenewOperationSummary - /// class. + /// Initializes a new instance of the UpdateAutoRenewOperation class. /// /// The end date of this asset - public UpdateAutoRenewOperationSummary(System.DateTime? endDate = default(System.DateTime?)) + public UpdateAutoRenewOperation(System.DateTime? endDate = default(System.DateTime?)) { EndDate = endDate; CustomInit(); diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ValidateAddressResponse.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ValidateAddressResponse.cs new file mode 100644 index 0000000000000..076c6728e33de --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ValidateAddressResponse.cs @@ -0,0 +1,72 @@ +// +// 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.Billing.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Result of the address validation + /// + public partial class ValidateAddressResponse + { + /// + /// Initializes a new instance of the ValidateAddressResponse class. + /// + public ValidateAddressResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ValidateAddressResponse class. + /// + /// status of the address validation. Possible + /// values include: 'Valid', 'Invalid' + /// list of suggested + /// addresses. + /// Validation error message. + public ValidateAddressResponse(string status = default(string), IList suggestedAddresses = default(IList), string validationMessage = default(string)) + { + Status = status; + SuggestedAddresses = suggestedAddresses; + ValidationMessage = validationMessage; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets status of the address validation. Possible values + /// include: 'Valid', 'Invalid' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Gets or sets list of suggested addresses. + /// + [JsonProperty(PropertyName = "suggestedAddresses")] + public IList SuggestedAddresses { get; set; } + + /// + /// Gets or sets validation error message. + /// + [JsonProperty(PropertyName = "validationMessage")] + public string ValidationMessage { get; set; } + + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ValidateProductTransferEligibilityError.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ValidateProductTransferEligibilityError.cs new file mode 100644 index 0000000000000..6d06b5bcc5597 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ValidateProductTransferEligibilityError.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.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Error details of the product transfer eligibility validation. + /// + public partial class ValidateProductTransferEligibilityError + { + /// + /// Initializes a new instance of the + /// ValidateProductTransferEligibilityError class. + /// + public ValidateProductTransferEligibilityError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ValidateProductTransferEligibilityError class. + /// + /// Error code for the product transfer validation. + /// Possible values include: 'InvalidSource', 'ProductNotActive', + /// 'InsufficientPermissionOnSource', + /// 'InsufficientPermissionOnDestination', + /// 'DestinationBillingProfilePastDue', 'ProductTypeNotSupported', + /// 'CrossBillingAccountNotAllowed', + /// 'NotAvailableForDestinationMarket', + /// 'OneTimePurchaseProductTransferNotAllowed' + /// The error message. + /// Detailed error message explaining the + /// error. + public ValidateProductTransferEligibilityError(string code = default(string), string message = default(string), string details = default(string)) + { + Code = code; + Message = message; + Details = details; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets error code for the product transfer validation. + /// Possible values include: 'InvalidSource', 'ProductNotActive', + /// 'InsufficientPermissionOnSource', + /// 'InsufficientPermissionOnDestination', + /// 'DestinationBillingProfilePastDue', 'ProductTypeNotSupported', + /// 'CrossBillingAccountNotAllowed', + /// 'NotAvailableForDestinationMarket', + /// 'OneTimePurchaseProductTransferNotAllowed' + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets the error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// Gets or sets detailed error message explaining the error. + /// + [JsonProperty(PropertyName = "details")] + public string Details { get; set; } + + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ValidateProductTransferEligibilityResult.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ValidateProductTransferEligibilityResult.cs new file mode 100644 index 0000000000000..20546dd70c0fe --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ValidateProductTransferEligibilityResult.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Result of the product transfer eligibility validation. + /// + public partial class ValidateProductTransferEligibilityResult + { + /// + /// Initializes a new instance of the + /// ValidateProductTransferEligibilityResult class. + /// + public ValidateProductTransferEligibilityResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ValidateProductTransferEligibilityResult class. + /// + /// Specifies whether the transfer is + /// eligible or not. + /// Validation error details. + public ValidateProductTransferEligibilityResult(bool? isTransferEligible = default(bool?), ValidateProductTransferEligibilityError errorDetails = default(ValidateProductTransferEligibilityError)) + { + IsTransferEligible = isTransferEligible; + ErrorDetails = errorDetails; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets specifies whether the transfer is eligible or not. + /// + [JsonProperty(PropertyName = "isTransferEligible")] + public bool? IsTransferEligible { get; private set; } + + /// + /// Gets or sets validation error details. + /// + [JsonProperty(PropertyName = "errorDetails")] + public ValidateProductTransferEligibilityError ErrorDetails { get; set; } + + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ValidateSubscriptionTransferEligibilityError.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ValidateSubscriptionTransferEligibilityError.cs new file mode 100644 index 0000000000000..93b4696ea5174 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ValidateSubscriptionTransferEligibilityError.cs @@ -0,0 +1,81 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Error details of the transfer eligibility validation + /// + public partial class ValidateSubscriptionTransferEligibilityError + { + /// + /// Initializes a new instance of the + /// ValidateSubscriptionTransferEligibilityError class. + /// + public ValidateSubscriptionTransferEligibilityError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ValidateSubscriptionTransferEligibilityError class. + /// + /// Error code for the product transfer validation. + /// Possible values include: 'InvalidSource', 'SubscriptionNotActive', + /// 'InsufficientPermissionOnSource', + /// 'InsufficientPermissionOnDestination', + /// 'DestinationBillingProfilePastDue', 'SubscriptionTypeNotSupported', + /// 'CrossBillingAccountNotAllowed', + /// 'NotAvailableForDestinationMarket' + /// The error message. + /// Detailed error message explaining the + /// error. + public ValidateSubscriptionTransferEligibilityError(string code = default(string), string message = default(string), string details = default(string)) + { + Code = code; + Message = message; + Details = details; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets error code for the product transfer validation. + /// Possible values include: 'InvalidSource', 'SubscriptionNotActive', + /// 'InsufficientPermissionOnSource', + /// 'InsufficientPermissionOnDestination', + /// 'DestinationBillingProfilePastDue', 'SubscriptionTypeNotSupported', + /// 'CrossBillingAccountNotAllowed', 'NotAvailableForDestinationMarket' + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets the error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// Gets or sets detailed error message explaining the error. + /// + [JsonProperty(PropertyName = "details")] + public string Details { get; set; } + + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ValidateSubscriptionTransferEligibilityResult.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ValidateSubscriptionTransferEligibilityResult.cs new file mode 100644 index 0000000000000..d467475793bac --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ValidateSubscriptionTransferEligibilityResult.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Billing.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Result of the transfer eligibility validation. + /// + public partial class ValidateSubscriptionTransferEligibilityResult + { + /// + /// Initializes a new instance of the + /// ValidateSubscriptionTransferEligibilityResult class. + /// + public ValidateSubscriptionTransferEligibilityResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ValidateSubscriptionTransferEligibilityResult class. + /// + /// Specifies whether the transfer is + /// eligible or not. + /// Validation error details. + public ValidateSubscriptionTransferEligibilityResult(bool? isTransferEligible = default(bool?), ValidateSubscriptionTransferEligibilityError errorDetails = default(ValidateSubscriptionTransferEligibilityError)) + { + IsTransferEligible = isTransferEligible; + ErrorDetails = errorDetails; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets specifies whether the transfer is eligible or not. + /// + [JsonProperty(PropertyName = "isTransferEligible")] + public bool? IsTransferEligible { get; private set; } + + /// + /// Gets or sets validation error details. + /// + [JsonProperty(PropertyName = "errorDetails")] + public ValidateSubscriptionTransferEligibilityError ErrorDetails { get; set; } + + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ViewChargesPolicy.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ViewChargesPolicy.cs new file mode 100644 index 0000000000000..7b579b67e3457 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/Models/ViewChargesPolicy.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.Billing.Models +{ + + /// + /// Defines values for ViewChargesPolicy. + /// + public static class ViewChargesPolicy + { + public const string None = "None"; + public const string SubscriptionOwner = "SubscriptionOwner"; + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PartnerTransfersOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PartnerTransfersOperations.cs new file mode 100644 index 0000000000000..84085899e0d6d --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PartnerTransfersOperations.cs @@ -0,0 +1,647 @@ +// +// 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.Billing +{ + 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; + + /// + /// PartnerTransfersOperations operations. + /// + internal partial class PartnerTransfersOperations : IServiceOperations, IPartnerTransfersOperations + { + /// + /// Initializes a new instance of the PartnerTransfersOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PartnerTransfersOperations(BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// Initiates the request to transfer the legacy subscriptions or RIs. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Customer name. + /// + /// + /// Parameters supplied to initiate the transfer. + /// + /// + /// 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> InitiateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string customerName, InitiateTransferRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + if (customerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "customerName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("customerName", customerName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Initiate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/initiateTransfer").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); + 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("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; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // 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; + } + + /// + /// Gets the transfer details for given transfer Id. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Customer name. + /// + /// + /// Transfer Name. + /// + /// + /// 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 billingAccountName, string billingProfileName, string customerName, string transferName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + if (customerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "customerName"); + } + if (transferName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "transferName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("customerName", customerName); + tracingParameters.Add("transferName", transferName); + 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/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/transfers/{transferName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); + _url = _url.Replace("{transferName}", System.Uri.EscapeDataString(transferName)); + 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; + } + + /// + /// Cancels the transfer for given transfer Id. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Customer name. + /// + /// + /// Transfer Name. + /// + /// + /// 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> CancelWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string customerName, string transferName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + if (customerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "customerName"); + } + if (transferName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "transferName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("customerName", customerName); + tracingParameters.Add("transferName", transferName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Cancel", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/transfers/{transferName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); + _url = _url.Replace("{transferName}", System.Uri.EscapeDataString(transferName)); + 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("DELETE"); + _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/billing/Microsoft.Azure.Management.Billing/src/Generated/PartnerTransfersOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PartnerTransfersOperationsExtensions.cs new file mode 100644 index 0000000000000..8860052a15e99 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PartnerTransfersOperationsExtensions.cs @@ -0,0 +1,181 @@ +// +// 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.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for PartnerTransfersOperations. + /// + public static partial class PartnerTransfersOperationsExtensions + { + /// + /// Initiates the request to transfer the legacy subscriptions or RIs. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Customer name. + /// + /// + /// Parameters supplied to initiate the transfer. + /// + public static TransferDetails Initiate(this IPartnerTransfersOperations operations, string billingAccountName, string billingProfileName, string customerName, InitiateTransferRequest parameters) + { + return operations.InitiateAsync(billingAccountName, billingProfileName, customerName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Initiates the request to transfer the legacy subscriptions or RIs. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Customer name. + /// + /// + /// Parameters supplied to initiate the transfer. + /// + /// + /// The cancellation token. + /// + public static async Task InitiateAsync(this IPartnerTransfersOperations operations, string billingAccountName, string billingProfileName, string customerName, InitiateTransferRequest parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.InitiateWithHttpMessagesAsync(billingAccountName, billingProfileName, customerName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the transfer details for given transfer Id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Customer name. + /// + /// + /// Transfer Name. + /// + public static TransferDetails Get(this IPartnerTransfersOperations operations, string billingAccountName, string billingProfileName, string customerName, string transferName) + { + return operations.GetAsync(billingAccountName, billingProfileName, customerName, transferName).GetAwaiter().GetResult(); + } + + /// + /// Gets the transfer details for given transfer Id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Customer name. + /// + /// + /// Transfer Name. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IPartnerTransfersOperations operations, string billingAccountName, string billingProfileName, string customerName, string transferName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, billingProfileName, customerName, transferName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Cancels the transfer for given transfer Id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Customer name. + /// + /// + /// Transfer Name. + /// + public static TransferDetails Cancel(this IPartnerTransfersOperations operations, string billingAccountName, string billingProfileName, string customerName, string transferName) + { + return operations.CancelAsync(billingAccountName, billingProfileName, customerName, transferName).GetAwaiter().GetResult(); + } + + /// + /// Cancels the transfer for given transfer Id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Customer name. + /// + /// + /// Transfer Name. + /// + /// + /// The cancellation token. + /// + public static async Task CancelAsync(this IPartnerTransfersOperations operations, string billingAccountName, string billingProfileName, string customerName, string transferName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CancelWithHttpMessagesAsync(billingAccountName, billingProfileName, customerName, transferName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PartnerTransfersTransfersOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PartnerTransfersTransfersOperations.cs new file mode 100644 index 0000000000000..76b9b237a451c --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PartnerTransfersTransfersOperations.cs @@ -0,0 +1,409 @@ +// +// 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.Billing +{ + 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; + + /// + /// PartnerTransfersTransfersOperations operations. + /// + internal partial class PartnerTransfersTransfersOperations : IServiceOperations, IPartnerTransfersTransfersOperations + { + /// + /// Initializes a new instance of the PartnerTransfersTransfersOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PartnerTransfersTransfersOperations(BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// Lists all transfer's details initiated from given invoice section. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Customer name. + /// + /// + /// 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 billingAccountName, string billingProfileName, string customerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + if (customerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "customerName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("customerName", customerName); + 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/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/transfers").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all transfer's details initiated from given invoice section. + /// + /// + /// 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/billing/Microsoft.Azure.Management.Billing/src/Generated/PartnerTransfersTransfersOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PartnerTransfersTransfersOperationsExtensions.cs new file mode 100644 index 0000000000000..92744de0099d8 --- /dev/null +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PartnerTransfersTransfersOperationsExtensions.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.Billing +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for PartnerTransfersTransfersOperations. + /// + public static partial class PartnerTransfersTransfersOperationsExtensions + { + /// + /// Lists all transfer's details initiated from given invoice section. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Customer name. + /// + public static IPage List(this IPartnerTransfersTransfersOperations operations, string billingAccountName, string billingProfileName, string customerName) + { + return operations.ListAsync(billingAccountName, billingProfileName, customerName).GetAwaiter().GetResult(); + } + + /// + /// Lists all transfer's details initiated from given invoice section. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Customer name. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IPartnerTransfersTransfersOperations operations, string billingAccountName, string billingProfileName, string customerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(billingAccountName, billingProfileName, customerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all transfer's details initiated from given invoice section. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IPartnerTransfersTransfersOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all transfer's details initiated from given invoice section. + /// + /// + /// 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 IPartnerTransfersTransfersOperations 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/billing/Microsoft.Azure.Management.Billing/src/Generated/PaymentMethodsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PaymentMethodsOperations.cs index 374230e3d8d21..e624b752ef7a7 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PaymentMethodsOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PaymentMethodsOperations.cs @@ -52,7 +52,7 @@ internal PaymentMethodsOperations(BillingManagementClient client) /// /// Lists the Payment Methods by billing account Id. - /// + /// /// /// /// billing Account Id. @@ -78,7 +78,7 @@ internal PaymentMethodsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (billingAccountName == null) { @@ -97,7 +97,7 @@ internal PaymentMethodsOperations(BillingManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -230,7 +230,7 @@ internal PaymentMethodsOperations(BillingManagementClient client) /// /// Lists the Payment Methods by billing profile Id. - /// + /// /// /// /// billing Account Id. @@ -259,7 +259,7 @@ internal PaymentMethodsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (billingAccountName == null) { @@ -283,7 +283,7 @@ internal PaymentMethodsOperations(BillingManagementClient client) tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -417,7 +417,7 @@ internal PaymentMethodsOperations(BillingManagementClient client) /// /// Lists the Payment Methods by billing account Id. - /// + /// /// /// /// The NextLink from the previous successful call to List operation. @@ -443,7 +443,7 @@ internal PaymentMethodsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingAccountNameNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -458,7 +458,7 @@ internal PaymentMethodsOperations(BillingManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNameNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -586,7 +586,7 @@ internal PaymentMethodsOperations(BillingManagementClient client) /// /// Lists the Payment Methods by billing profile Id. - /// + /// /// /// /// The NextLink from the previous successful call to List operation. @@ -612,7 +612,7 @@ internal PaymentMethodsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingProfileNameNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -627,7 +627,7 @@ internal PaymentMethodsOperations(BillingManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileNameNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PaymentMethodsOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PaymentMethodsOperationsExtensions.cs index f68d86f732f46..8f13960e5ac32 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PaymentMethodsOperationsExtensions.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PaymentMethodsOperationsExtensions.cs @@ -23,7 +23,7 @@ public static partial class PaymentMethodsOperationsExtensions { /// /// Lists the Payment Methods by billing account Id. - /// + /// /// /// /// The operations group for this extension method. @@ -31,14 +31,14 @@ public static partial class PaymentMethodsOperationsExtensions /// /// billing Account Id. /// - public static IPage ListByBillingAccountName(this IPaymentMethodsOperations operations, string billingAccountName) + public static IPage ListByBillingAccount(this IPaymentMethodsOperations operations, string billingAccountName) { - return operations.ListByBillingAccountNameAsync(billingAccountName).GetAwaiter().GetResult(); + return operations.ListByBillingAccountAsync(billingAccountName).GetAwaiter().GetResult(); } /// /// Lists the Payment Methods by billing account Id. - /// + /// /// /// /// The operations group for this extension method. @@ -49,9 +49,9 @@ public static IPage ListByBillingAccountName(this IPaymentMethods /// /// The cancellation token. /// - public static async Task> ListByBillingAccountNameAsync(this IPaymentMethodsOperations operations, string billingAccountName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByBillingAccountAsync(this IPaymentMethodsOperations operations, string billingAccountName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByBillingAccountNameWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -59,7 +59,7 @@ public static IPage ListByBillingAccountName(this IPaymentMethods /// /// Lists the Payment Methods by billing profile Id. - /// + /// /// /// /// The operations group for this extension method. @@ -70,14 +70,14 @@ public static IPage ListByBillingAccountName(this IPaymentMethods /// /// Billing Profile Id. /// - public static IPage ListByBillingProfileName(this IPaymentMethodsOperations operations, string billingAccountName, string billingProfileName) + public static IPage ListByBillingProfile(this IPaymentMethodsOperations operations, string billingAccountName, string billingProfileName) { - return operations.ListByBillingProfileNameAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + return operations.ListByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); } /// /// Lists the Payment Methods by billing profile Id. - /// + /// /// /// /// The operations group for this extension method. @@ -91,9 +91,9 @@ public static IPage ListByBillingProfileName(this IPaymentMethods /// /// The cancellation token. /// - public static async Task> ListByBillingProfileNameAsync(this IPaymentMethodsOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByBillingProfileAsync(this IPaymentMethodsOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByBillingProfileNameWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -101,7 +101,7 @@ public static IPage ListByBillingProfileName(this IPaymentMethods /// /// Lists the Payment Methods by billing account Id. - /// + /// /// /// /// The operations group for this extension method. @@ -109,14 +109,14 @@ public static IPage ListByBillingProfileName(this IPaymentMethods /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListByBillingAccountNameNext(this IPaymentMethodsOperations operations, string nextPageLink) + public static IPage ListByBillingAccountNext(this IPaymentMethodsOperations operations, string nextPageLink) { - return operations.ListByBillingAccountNameNextAsync(nextPageLink).GetAwaiter().GetResult(); + return operations.ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// /// Lists the Payment Methods by billing account Id. - /// + /// /// /// /// The operations group for this extension method. @@ -127,9 +127,9 @@ public static IPage ListByBillingAccountNameNext(this IPaymentMet /// /// The cancellation token. /// - public static async Task> ListByBillingAccountNameNextAsync(this IPaymentMethodsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByBillingAccountNextAsync(this IPaymentMethodsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByBillingAccountNameNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -137,7 +137,7 @@ public static IPage ListByBillingAccountNameNext(this IPaymentMet /// /// Lists the Payment Methods by billing profile Id. - /// + /// /// /// /// The operations group for this extension method. @@ -145,14 +145,14 @@ public static IPage ListByBillingAccountNameNext(this IPaymentMet /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListByBillingProfileNameNext(this IPaymentMethodsOperations operations, string nextPageLink) + public static IPage ListByBillingProfileNext(this IPaymentMethodsOperations operations, string nextPageLink) { - return operations.ListByBillingProfileNameNextAsync(nextPageLink).GetAwaiter().GetResult(); + return operations.ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// /// Lists the Payment Methods by billing profile Id. - /// + /// /// /// /// The operations group for this extension method. @@ -163,9 +163,9 @@ public static IPage ListByBillingProfileNameNext(this IPaymentMet /// /// The cancellation token. /// - public static async Task> ListByBillingProfileNameNextAsync(this IPaymentMethodsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByBillingProfileNextAsync(this IPaymentMethodsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByBillingProfileNameNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PoliciesOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PoliciesOperations.cs index 0e0efa6ab96fb..85836ea30bec8 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PoliciesOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PoliciesOperations.cs @@ -52,7 +52,7 @@ internal PoliciesOperations(BillingManagementClient client) /// /// The policy for a given billing account name and billing profile name. - /// + /// /// /// /// billing Account Id. @@ -81,7 +81,7 @@ internal PoliciesOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (billingAccountName == null) { @@ -105,7 +105,7 @@ internal PoliciesOperations(BillingManagementClient client) tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetByBillingProfileName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetByBillingProfile", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PoliciesOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PoliciesOperationsExtensions.cs index 15938b36e44c9..7ac8cdb865722 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PoliciesOperationsExtensions.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PoliciesOperationsExtensions.cs @@ -23,7 +23,7 @@ public static partial class PoliciesOperationsExtensions { /// /// The policy for a given billing account name and billing profile name. - /// + /// /// /// /// The operations group for this extension method. @@ -34,14 +34,14 @@ public static partial class PoliciesOperationsExtensions /// /// Billing Profile Id. /// - public static Policy GetByBillingProfileName(this IPoliciesOperations operations, string billingAccountName, string billingProfileName) + public static Policy GetByBillingProfile(this IPoliciesOperations operations, string billingAccountName, string billingProfileName) { - return operations.GetByBillingProfileNameAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + return operations.GetByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); } /// /// The policy for a given billing account name and billing profile name. - /// + /// /// /// /// The operations group for this extension method. @@ -55,9 +55,9 @@ public static Policy GetByBillingProfileName(this IPoliciesOperations operations /// /// The cancellation token. /// - public static async Task GetByBillingProfileNameAsync(this IPoliciesOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetByBillingProfileAsync(this IPoliciesOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetByBillingProfileNameWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PriceSheetOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PriceSheetOperations.cs index 1169c16a7a45f..73c97053b8c61 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PriceSheetOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PriceSheetOperations.cs @@ -54,10 +54,35 @@ internal PriceSheetOperations(BillingManagementClient client) /// Download price sheet for an invoice. /// /// - /// Azure Billing Account ID. + /// billing Account Id. + /// + /// + /// Billing Profile Id. /// /// - /// The name of an invoice resource. + /// Invoice Id. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> DownloadWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDownloadWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Download price sheet for a billing profile. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. /// /// /// The headers that will be added to request. @@ -65,10 +90,10 @@ internal PriceSheetOperations(BillingManagementClient client) /// /// The cancellation token. /// - public async Task> DownloadWithHttpMessagesAsync(string billingAccountName, string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> DownloadByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - AzureOperationResponse _response = await BeginDownloadWithHttpMessagesAsync(billingAccountName, invoiceName, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginDownloadByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } @@ -76,10 +101,13 @@ internal PriceSheetOperations(BillingManagementClient client) /// Download price sheet for an invoice. /// /// - /// Azure Billing Account ID. + /// billing Account Id. + /// + /// + /// Billing Profile Id. /// /// - /// The name of an invoice resource. + /// Invoice Id. /// /// /// Headers that will be added to request. @@ -102,7 +130,7 @@ internal PriceSheetOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginDownloadWithHttpMessagesAsync(string billingAccountName, string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginDownloadWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -112,6 +140,10 @@ internal PriceSheetOperations(BillingManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } if (invoiceName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "invoiceName"); @@ -124,14 +156,16 @@ internal PriceSheetOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceName", invoiceName); 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("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/pricesheet/default/download").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}/pricesheet/default/download").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{invoiceName}", System.Uri.EscapeDataString(invoiceName)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -271,5 +305,204 @@ internal PriceSheetOperations(BillingManagementClient client) return _result; } + /// + /// Download price sheet for a billing profile. + /// + /// + /// billing Account Id. + /// + /// + /// 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> BeginDownloadByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDownloadByBillingProfile", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/pricesheet/default/download").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + 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("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; + } + } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PriceSheetOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PriceSheetOperationsExtensions.cs index 44adaa29634e7..a1be5f407ad0e 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PriceSheetOperationsExtensions.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/PriceSheetOperationsExtensions.cs @@ -28,14 +28,17 @@ public static partial class PriceSheetOperationsExtensions /// The operations group for this extension method. /// /// - /// Azure Billing Account ID. + /// billing Account Id. + /// + /// + /// Billing Profile Id. /// /// - /// The name of an invoice resource. + /// Invoice Id. /// - public static DownloadUrl Download(this IPriceSheetOperations operations, string billingAccountName, string invoiceName) + public static DownloadUrl Download(this IPriceSheetOperations operations, string billingAccountName, string billingProfileName, string invoiceName) { - return operations.DownloadAsync(billingAccountName, invoiceName).GetAwaiter().GetResult(); + return operations.DownloadAsync(billingAccountName, billingProfileName, invoiceName).GetAwaiter().GetResult(); } /// @@ -45,17 +48,60 @@ public static DownloadUrl Download(this IPriceSheetOperations operations, string /// The operations group for this extension method. /// /// - /// Azure Billing Account ID. + /// billing Account Id. + /// + /// + /// Billing Profile Id. /// /// - /// The name of an invoice resource. + /// Invoice Id. + /// + /// + /// The cancellation token. + /// + public static async Task DownloadAsync(this IPriceSheetOperations operations, string billingAccountName, string billingProfileName, string invoiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DownloadWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Download price sheet for a billing profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + public static DownloadUrl DownloadByBillingProfile(this IPriceSheetOperations operations, string billingAccountName, string billingProfileName) + { + return operations.DownloadByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + } + + /// + /// Download price sheet for a billing profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. /// /// /// The cancellation token. /// - public static async Task DownloadAsync(this IPriceSheetOperations operations, string billingAccountName, string invoiceName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DownloadByBillingProfileAsync(this IPriceSheetOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.DownloadWithHttpMessagesAsync(billingAccountName, invoiceName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.DownloadByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -68,14 +114,17 @@ public static DownloadUrl Download(this IPriceSheetOperations operations, string /// The operations group for this extension method. /// /// - /// Azure Billing Account ID. + /// billing Account Id. + /// + /// + /// Billing Profile Id. /// /// - /// The name of an invoice resource. + /// Invoice Id. /// - public static DownloadUrl BeginDownload(this IPriceSheetOperations operations, string billingAccountName, string invoiceName) + public static DownloadUrl BeginDownload(this IPriceSheetOperations operations, string billingAccountName, string billingProfileName, string invoiceName) { - return operations.BeginDownloadAsync(billingAccountName, invoiceName).GetAwaiter().GetResult(); + return operations.BeginDownloadAsync(billingAccountName, billingProfileName, invoiceName).GetAwaiter().GetResult(); } /// @@ -85,17 +134,60 @@ public static DownloadUrl BeginDownload(this IPriceSheetOperations operations, s /// The operations group for this extension method. /// /// - /// Azure Billing Account ID. + /// billing Account Id. + /// + /// + /// Billing Profile Id. /// /// - /// The name of an invoice resource. + /// Invoice Id. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDownloadAsync(this IPriceSheetOperations operations, string billingAccountName, string billingProfileName, string invoiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginDownloadWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Download price sheet for a billing profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + public static DownloadUrl BeginDownloadByBillingProfile(this IPriceSheetOperations operations, string billingAccountName, string billingProfileName) + { + return operations.BeginDownloadByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + } + + /// + /// Download price sheet for a billing profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. /// /// /// The cancellation token. /// - public static async Task BeginDownloadAsync(this IPriceSheetOperations operations, string billingAccountName, string invoiceName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginDownloadByBillingProfileAsync(this IPriceSheetOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.BeginDownloadWithHttpMessagesAsync(billingAccountName, invoiceName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginDownloadByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ProductsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ProductsOperations.cs index f6745ea37bcc8..1425cc87381d2 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ProductsOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ProductsOperations.cs @@ -50,9 +50,403 @@ internal ProductsOperations(BillingManagementClient client) /// public BillingManagementClient Client { get; private set; } + /// + /// Lists products by customer id. + /// + /// + /// + /// billing Account Id. + /// + /// + /// Customer name. + /// + /// + /// May be used to filter by product type. The filter supports 'eq', 'lt', + /// 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or + /// 'not'. Tag filter is a key value pair string where key and value is + /// separated by a colon (:). + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ListByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (customerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "customerName"); + } + 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("billingAccountName", billingAccountName); + tracingParameters.Add("customerName", customerName); + tracingParameters.Add("filter", filter); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByCustomer", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/products").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get a customer's product by name. + /// + /// + /// + /// billing Account Id. + /// + /// + /// Customer name. + /// + /// + /// Invoice 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> GetByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, string productName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (customerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "customerName"); + } + if (productName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "productName"); + } + 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("billingAccountName", billingAccountName); + tracingParameters.Add("customerName", customerName); + tracingParameters.Add("productName", productName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetByCustomer", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/products/{productName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); + _url = _url.Replace("{productName}", System.Uri.EscapeDataString(productName)); + 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 products by billing account name. - /// + /// /// /// /// billing Account Id. @@ -84,7 +478,7 @@ internal ProductsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (billingAccountName == null) { @@ -104,7 +498,7 @@ internal ProductsOperations(BillingManagementClient client) tracingParameters.Add("billingAccountName", billingAccountName); tracingParameters.Add("filter", filter); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -207,7 +601,7 @@ internal ProductsOperations(BillingManagementClient 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")) @@ -220,7 +614,7 @@ internal ProductsOperations(BillingManagementClient 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) { @@ -241,11 +635,14 @@ internal ProductsOperations(BillingManagementClient client) /// /// Lists products by invoice section name. - /// + /// /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -276,12 +673,16 @@ internal ProductsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (billingAccountName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } if (invoiceSectionName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); @@ -298,15 +699,17 @@ internal ProductsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("filter", filter); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSectionName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSection", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/products").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/products").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -439,11 +842,14 @@ internal ProductsOperations(BillingManagementClient client) /// /// Get a single product by name. - /// + /// /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -471,12 +877,16 @@ internal ProductsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string productName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string productName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (billingAccountName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } if (invoiceSectionName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); @@ -497,6 +907,7 @@ internal ProductsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("productName", productName); tracingParameters.Add("cancellationToken", cancellationToken); @@ -504,8 +915,9 @@ internal ProductsOperations(BillingManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/products/{productName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/products/{productName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); _url = _url.Replace("{productName}", System.Uri.EscapeDataString(productName)); List _queryParameters = new List(); @@ -601,7 +1013,7 @@ internal ProductsOperations(BillingManagementClient 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")) @@ -614,7 +1026,7 @@ internal ProductsOperations(BillingManagementClient 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) { @@ -639,6 +1051,9 @@ internal ProductsOperations(BillingManagementClient client) /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -669,12 +1084,16 @@ internal ProductsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> TransferWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string productName, TransferProductRequestProperties parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> TransferWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string productName, TransferProductRequestProperties parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (billingAccountName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } if (invoiceSectionName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); @@ -699,6 +1118,7 @@ internal ProductsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("productName", productName); tracingParameters.Add("parameters", parameters); @@ -707,8 +1127,9 @@ internal ProductsOperations(BillingManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/products/{productName}/transfer").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/products/{productName}/transfer").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); _url = _url.Replace("{productName}", System.Uri.EscapeDataString(productName)); List _queryParameters = new List(); @@ -810,7 +1231,7 @@ internal ProductsOperations(BillingManagementClient 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")) @@ -823,7 +1244,7 @@ internal ProductsOperations(BillingManagementClient 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) { @@ -855,6 +1276,216 @@ internal ProductsOperations(BillingManagementClient client) return _result; } + /// + /// Validates the transfer of products across invoice sections. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// InvoiceSection Id. + /// + /// + /// Invoice Id. + /// + /// + /// Parameters supplied to the Transfer Products 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> ValidateTransferWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string productName, TransferProductRequestProperties parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + if (invoiceSectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); + } + if (productName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "productName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("invoiceSectionName", invoiceSectionName); + tracingParameters.Add("productName", productName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ValidateTransfer", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/products/{productName}/validateTransferEligibility").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); + _url = _url.Replace("{productName}", System.Uri.EscapeDataString(productName)); + 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("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; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // 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; + } + /// /// Cancel auto renew for product by product id and billing account name /// @@ -888,7 +1519,7 @@ internal ProductsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateAutoRenewByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, string productName, UpdateAutoRenewRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateAutoRenewByBillingAccountWithHttpMessagesAsync(string billingAccountName, string productName, UpdateAutoRenewRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (billingAccountName == null) { @@ -917,7 +1548,7 @@ internal ProductsOperations(BillingManagementClient client) tracingParameters.Add("productName", productName); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "UpdateAutoRenewByBillingAccountName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "UpdateAutoRenewByBillingAccount", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -1023,7 +1654,7 @@ internal ProductsOperations(BillingManagementClient 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")) @@ -1036,7 +1667,7 @@ internal ProductsOperations(BillingManagementClient 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) { @@ -1061,6 +1692,9 @@ internal ProductsOperations(BillingManagementClient client) /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -1091,12 +1725,16 @@ internal ProductsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateAutoRenewByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string productName, UpdateAutoRenewRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateAutoRenewByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string productName, UpdateAutoRenewRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (billingAccountName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } if (invoiceSectionName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); @@ -1121,16 +1759,18 @@ internal ProductsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("productName", productName); tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "UpdateAutoRenewByInvoiceSectionName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "UpdateAutoRenewByInvoiceSection", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/products/{productName}/updateAutoRenew").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/products/{productName}/updateAutoRenew").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); _url = _url.Replace("{productName}", System.Uri.EscapeDataString(productName)); List _queryParameters = new List(); @@ -1232,7 +1872,7 @@ internal ProductsOperations(BillingManagementClient 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")) @@ -1245,7 +1885,7 @@ internal ProductsOperations(BillingManagementClient 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) { @@ -1266,7 +1906,7 @@ internal ProductsOperations(BillingManagementClient client) /// /// Lists products by billing account name. - /// + /// /// /// /// The NextLink from the previous successful call to List operation. @@ -1292,7 +1932,7 @@ internal ProductsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingAccountNameNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -1307,7 +1947,7 @@ internal ProductsOperations(BillingManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNameNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -1401,7 +2041,7 @@ internal ProductsOperations(BillingManagementClient 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")) @@ -1414,7 +2054,7 @@ internal ProductsOperations(BillingManagementClient 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/billing/Microsoft.Azure.Management.Billing/src/Generated/ProductsOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ProductsOperationsExtensions.cs index d8574bf10be0d..3389be778b587 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ProductsOperationsExtensions.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/ProductsOperationsExtensions.cs @@ -21,9 +21,111 @@ namespace Microsoft.Azure.Management.Billing /// public static partial class ProductsOperationsExtensions { + /// + /// Lists products by customer id. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Customer name. + /// + /// + /// May be used to filter by product type. The filter supports 'eq', 'lt', + /// 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or + /// 'not'. Tag filter is a key value pair string where key and value is + /// separated by a colon (:). + /// + public static ProductsListResult ListByCustomer(this IProductsOperations operations, string billingAccountName, string customerName, string filter = default(string)) + { + return operations.ListByCustomerAsync(billingAccountName, customerName, filter).GetAwaiter().GetResult(); + } + + /// + /// Lists products by customer id. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Customer name. + /// + /// + /// May be used to filter by product type. The filter supports 'eq', 'lt', + /// 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or + /// 'not'. Tag filter is a key value pair string where key and value is + /// separated by a colon (:). + /// + /// + /// The cancellation token. + /// + public static async Task ListByCustomerAsync(this IProductsOperations operations, string billingAccountName, string customerName, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByCustomerWithHttpMessagesAsync(billingAccountName, customerName, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a customer's product by name. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Customer name. + /// + /// + /// Invoice Id. + /// + public static Product GetByCustomer(this IProductsOperations operations, string billingAccountName, string customerName, string productName) + { + return operations.GetByCustomerAsync(billingAccountName, customerName, productName).GetAwaiter().GetResult(); + } + + /// + /// Get a customer's product by name. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Customer name. + /// + /// + /// Invoice Id. + /// + /// + /// The cancellation token. + /// + public static async Task GetByCustomerAsync(this IProductsOperations operations, string billingAccountName, string customerName, string productName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetByCustomerWithHttpMessagesAsync(billingAccountName, customerName, productName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Lists products by billing account name. - /// + /// /// /// /// The operations group for this extension method. @@ -37,14 +139,14 @@ public static partial class ProductsOperationsExtensions /// 'not'. Tag filter is a key value pair string where key and value is /// separated by a colon (:). /// - public static IPage ListByBillingAccountName(this IProductsOperations operations, string billingAccountName, string filter = default(string)) + public static IPage ListByBillingAccount(this IProductsOperations operations, string billingAccountName, string filter = default(string)) { - return operations.ListByBillingAccountNameAsync(billingAccountName, filter).GetAwaiter().GetResult(); + return operations.ListByBillingAccountAsync(billingAccountName, filter).GetAwaiter().GetResult(); } /// /// Lists products by billing account name. - /// + /// /// /// /// The operations group for this extension method. @@ -61,9 +163,9 @@ public static partial class ProductsOperationsExtensions /// /// The cancellation token. /// - public static async Task> ListByBillingAccountNameAsync(this IProductsOperations operations, string billingAccountName, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByBillingAccountAsync(this IProductsOperations operations, string billingAccountName, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByBillingAccountNameWithHttpMessagesAsync(billingAccountName, filter, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, filter, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -71,7 +173,7 @@ public static partial class ProductsOperationsExtensions /// /// Lists products by invoice section name. - /// + /// /// /// /// The operations group for this extension method. @@ -79,6 +181,9 @@ public static partial class ProductsOperationsExtensions /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -88,14 +193,14 @@ public static partial class ProductsOperationsExtensions /// 'not'. Tag filter is a key value pair string where key and value is /// separated by a colon (:). /// - public static ProductsListResult ListByInvoiceSectionName(this IProductsOperations operations, string billingAccountName, string invoiceSectionName, string filter = default(string)) + public static ProductsListResult ListByInvoiceSection(this IProductsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string filter = default(string)) { - return operations.ListByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName, filter).GetAwaiter().GetResult(); + return operations.ListByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, filter).GetAwaiter().GetResult(); } /// /// Lists products by invoice section name. - /// + /// /// /// /// The operations group for this extension method. @@ -103,6 +208,9 @@ public static partial class ProductsOperationsExtensions /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -115,9 +223,9 @@ public static partial class ProductsOperationsExtensions /// /// The cancellation token. /// - public static async Task ListByInvoiceSectionNameAsync(this IProductsOperations operations, string billingAccountName, string invoiceSectionName, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListByInvoiceSectionAsync(this IProductsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByInvoiceSectionNameWithHttpMessagesAsync(billingAccountName, invoiceSectionName, filter, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, filter, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -125,7 +233,7 @@ public static partial class ProductsOperationsExtensions /// /// Get a single product by name. - /// + /// /// /// /// The operations group for this extension method. @@ -133,20 +241,23 @@ public static partial class ProductsOperationsExtensions /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// /// Invoice Id. /// - public static ProductSummary Get(this IProductsOperations operations, string billingAccountName, string invoiceSectionName, string productName) + public static Product Get(this IProductsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string productName) { - return operations.GetAsync(billingAccountName, invoiceSectionName, productName).GetAwaiter().GetResult(); + return operations.GetAsync(billingAccountName, billingProfileName, invoiceSectionName, productName).GetAwaiter().GetResult(); } /// /// Get a single product by name. - /// + /// /// /// /// The operations group for this extension method. @@ -154,6 +265,9 @@ public static ProductSummary Get(this IProductsOperations operations, string bil /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -163,9 +277,9 @@ public static ProductSummary Get(this IProductsOperations operations, string bil /// /// The cancellation token. /// - public static async Task GetAsync(this IProductsOperations operations, string billingAccountName, string invoiceSectionName, string productName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IProductsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string productName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, invoiceSectionName, productName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, productName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -180,6 +294,9 @@ public static ProductSummary Get(this IProductsOperations operations, string bil /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -189,9 +306,9 @@ public static ProductSummary Get(this IProductsOperations operations, string bil /// /// Parameters supplied to the Transfer Product operation. /// - public static ProductSummary Transfer(this IProductsOperations operations, string billingAccountName, string invoiceSectionName, string productName, TransferProductRequestProperties parameters) + public static Product Transfer(this IProductsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string productName, TransferProductRequestProperties parameters) { - return operations.TransferAsync(billingAccountName, invoiceSectionName, productName, parameters).GetAwaiter().GetResult(); + return operations.TransferAsync(billingAccountName, billingProfileName, invoiceSectionName, productName, parameters).GetAwaiter().GetResult(); } /// @@ -203,6 +320,9 @@ public static ProductSummary Transfer(this IProductsOperations operations, strin /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -215,9 +335,67 @@ public static ProductSummary Transfer(this IProductsOperations operations, strin /// /// The cancellation token. /// - public static async Task TransferAsync(this IProductsOperations operations, string billingAccountName, string invoiceSectionName, string productName, TransferProductRequestProperties parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task TransferAsync(this IProductsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string productName, TransferProductRequestProperties parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.TransferWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, productName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Validates the transfer of products across invoice sections. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// InvoiceSection Id. + /// + /// + /// Invoice Id. + /// + /// + /// Parameters supplied to the Transfer Products operation. + /// + public static ValidateProductTransferEligibilityResult ValidateTransfer(this IProductsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string productName, TransferProductRequestProperties parameters) + { + return operations.ValidateTransferAsync(billingAccountName, billingProfileName, invoiceSectionName, productName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Validates the transfer of products across invoice sections. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// InvoiceSection Id. + /// + /// + /// Invoice Id. + /// + /// + /// Parameters supplied to the Transfer Products operation. + /// + /// + /// The cancellation token. + /// + public static async Task ValidateTransferAsync(this IProductsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string productName, TransferProductRequestProperties parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.TransferWithHttpMessagesAsync(billingAccountName, invoiceSectionName, productName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ValidateTransferWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, productName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -238,9 +416,9 @@ public static ProductSummary Transfer(this IProductsOperations operations, strin /// /// Update auto renew request parameters. /// - public static UpdateAutoRenewOperationSummary UpdateAutoRenewByBillingAccountName(this IProductsOperations operations, string billingAccountName, string productName, UpdateAutoRenewRequest body) + public static UpdateAutoRenewOperation UpdateAutoRenewByBillingAccount(this IProductsOperations operations, string billingAccountName, string productName, UpdateAutoRenewRequest body) { - return operations.UpdateAutoRenewByBillingAccountNameAsync(billingAccountName, productName, body).GetAwaiter().GetResult(); + return operations.UpdateAutoRenewByBillingAccountAsync(billingAccountName, productName, body).GetAwaiter().GetResult(); } /// @@ -261,9 +439,9 @@ public static UpdateAutoRenewOperationSummary UpdateAutoRenewByBillingAccountNam /// /// The cancellation token. /// - public static async Task UpdateAutoRenewByBillingAccountNameAsync(this IProductsOperations operations, string billingAccountName, string productName, UpdateAutoRenewRequest body, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAutoRenewByBillingAccountAsync(this IProductsOperations operations, string billingAccountName, string productName, UpdateAutoRenewRequest body, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.UpdateAutoRenewByBillingAccountNameWithHttpMessagesAsync(billingAccountName, productName, body, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.UpdateAutoRenewByBillingAccountWithHttpMessagesAsync(billingAccountName, productName, body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -278,6 +456,9 @@ public static UpdateAutoRenewOperationSummary UpdateAutoRenewByBillingAccountNam /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -287,9 +468,9 @@ public static UpdateAutoRenewOperationSummary UpdateAutoRenewByBillingAccountNam /// /// Update auto renew request parameters. /// - public static UpdateAutoRenewOperationSummary UpdateAutoRenewByInvoiceSectionName(this IProductsOperations operations, string billingAccountName, string invoiceSectionName, string productName, UpdateAutoRenewRequest body) + public static UpdateAutoRenewOperation UpdateAutoRenewByInvoiceSection(this IProductsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string productName, UpdateAutoRenewRequest body) { - return operations.UpdateAutoRenewByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName, productName, body).GetAwaiter().GetResult(); + return operations.UpdateAutoRenewByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, productName, body).GetAwaiter().GetResult(); } /// @@ -301,6 +482,9 @@ public static UpdateAutoRenewOperationSummary UpdateAutoRenewByInvoiceSectionNam /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -313,9 +497,9 @@ public static UpdateAutoRenewOperationSummary UpdateAutoRenewByInvoiceSectionNam /// /// The cancellation token. /// - public static async Task UpdateAutoRenewByInvoiceSectionNameAsync(this IProductsOperations operations, string billingAccountName, string invoiceSectionName, string productName, UpdateAutoRenewRequest body, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAutoRenewByInvoiceSectionAsync(this IProductsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string productName, UpdateAutoRenewRequest body, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.UpdateAutoRenewByInvoiceSectionNameWithHttpMessagesAsync(billingAccountName, invoiceSectionName, productName, body, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.UpdateAutoRenewByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, productName, body, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -323,7 +507,7 @@ public static UpdateAutoRenewOperationSummary UpdateAutoRenewByInvoiceSectionNam /// /// Lists products by billing account name. - /// + /// /// /// /// The operations group for this extension method. @@ -331,14 +515,14 @@ public static UpdateAutoRenewOperationSummary UpdateAutoRenewByInvoiceSectionNam /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListByBillingAccountNameNext(this IProductsOperations operations, string nextPageLink) + public static IPage ListByBillingAccountNext(this IProductsOperations operations, string nextPageLink) { - return operations.ListByBillingAccountNameNextAsync(nextPageLink).GetAwaiter().GetResult(); + return operations.ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// /// Lists products by billing account name. - /// + /// /// /// /// The operations group for this extension method. @@ -349,9 +533,9 @@ public static IPage ListByBillingAccountNameNext(this IProductsO /// /// The cancellation token. /// - public static async Task> ListByBillingAccountNameNextAsync(this IProductsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByBillingAccountNextAsync(this IProductsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByBillingAccountNameNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/RecipientTransfersOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/RecipientTransfersOperations.cs index 379141cc81251..1a4e0ab4a9564 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/RecipientTransfersOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/RecipientTransfersOperations.cs @@ -56,8 +56,8 @@ internal RecipientTransfersOperations(BillingManagementClient client) /// /// Transfer Name. /// - /// - /// Accept transfer parameters. + /// + /// Parameters supplied to accept the transfer. /// /// /// Headers that will be added to request. @@ -80,15 +80,15 @@ internal RecipientTransfersOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> AcceptWithHttpMessagesAsync(string transferName, AcceptTransferRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> AcceptWithHttpMessagesAsync(string transferName, AcceptTransferRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (transferName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "transferName"); } - if (body == null) + if (parameters == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "body"); + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -98,7 +98,7 @@ internal RecipientTransfersOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("transferName", transferName); - tracingParameters.Add("body", body); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Accept", tracingParameters); } @@ -145,9 +145,9 @@ internal RecipientTransfersOperations(BillingManagementClient client) // Serialize Request string _requestContent = null; - if(body != null) + if(parameters != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); } @@ -448,7 +448,7 @@ internal RecipientTransfersOperations(BillingManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/transfers/{transferName}/").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/transfers/{transferName}").ToString(); _url = _url.Replace("{transferName}", System.Uri.EscapeDataString(transferName)); List _queryParameters = new List(); if (_queryParameters.Count > 0) diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/RecipientTransfersOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/RecipientTransfersOperationsExtensions.cs index bd0c5678ac0a1..3ab2e5dccd0c5 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/RecipientTransfersOperationsExtensions.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/RecipientTransfersOperationsExtensions.cs @@ -30,12 +30,12 @@ public static partial class RecipientTransfersOperationsExtensions /// /// Transfer Name. /// - /// - /// Accept transfer parameters. + /// + /// Parameters supplied to accept the transfer. /// - public static RecipientTransferDetails Accept(this IRecipientTransfersOperations operations, string transferName, AcceptTransferRequest body) + public static RecipientTransferDetails Accept(this IRecipientTransfersOperations operations, string transferName, AcceptTransferRequest parameters) { - return operations.AcceptAsync(transferName, body).GetAwaiter().GetResult(); + return operations.AcceptAsync(transferName, parameters).GetAwaiter().GetResult(); } /// @@ -47,15 +47,15 @@ public static RecipientTransferDetails Accept(this IRecipientTransfersOperations /// /// Transfer Name. /// - /// - /// Accept transfer parameters. + /// + /// Parameters supplied to accept the transfer. /// /// /// The cancellation token. /// - public static async Task AcceptAsync(this IRecipientTransfersOperations operations, string transferName, AcceptTransferRequest body, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task AcceptAsync(this IRecipientTransfersOperations operations, string transferName, AcceptTransferRequest parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.AcceptWithHttpMessagesAsync(transferName, body, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.AcceptWithHttpMessagesAsync(transferName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/SdkInfo_BillingManagementClient.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/SdkInfo_BillingManagementClient.cs index ea1bcebcf0bde..df921c36912f3 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/SdkInfo_BillingManagementClient.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/SdkInfo_BillingManagementClient.cs @@ -19,27 +19,32 @@ public static IEnumerable> ApiInfo_BillingManageme { return new Tuple[] { - new Tuple("Billing", "Agreements", "2018-11-01-preview"), - new Tuple("Billing", "AvailableBalances", "2018-11-01-preview"), - new Tuple("Billing", "BillingAccounts", "2018-11-01-preview"), - new Tuple("Billing", "BillingPermissions", "2018-11-01-preview"), - new Tuple("Billing", "BillingProfiles", "2018-11-01-preview"), - new Tuple("Billing", "BillingProperty", "2018-11-01-preview"), - new Tuple("Billing", "BillingRoleAssignments", "2018-11-01-preview"), - new Tuple("Billing", "BillingRoleDefinitions", "2018-11-01-preview"), - new Tuple("Billing", "BillingSubscriptions", "2018-11-01-preview"), - new Tuple("Billing", "Departments", "2018-11-01-preview"), - new Tuple("Billing", "EnrollmentAccounts", "2018-11-01-preview"), - new Tuple("Billing", "InvoiceSections", "2018-11-01-preview"), - new Tuple("Billing", "Invoices", "2018-11-01-preview"), - new Tuple("Billing", "Operations", "2018-11-01-preview"), - new Tuple("Billing", "PaymentMethods", "2018-11-01-preview"), - new Tuple("Billing", "Policies", "2018-11-01-preview"), - new Tuple("Billing", "PriceSheet", "2018-11-01-preview"), - new Tuple("Billing", "Products", "2018-11-01-preview"), - new Tuple("Billing", "RecipientTransfers", "2018-11-01-preview"), - new Tuple("Billing", "Transactions", "2018-11-01-preview"), - new Tuple("Billing", "Transfers", "2018-11-01-preview"), + new Tuple("Billing", "Address", "2019-10-01-preview"), + new Tuple("Billing", "Agreements", "2019-10-01-preview"), + new Tuple("Billing", "AvailableBalances", "2019-10-01-preview"), + new Tuple("Billing", "BillingAccounts", "2019-10-01-preview"), + new Tuple("Billing", "BillingPermissions", "2019-10-01-preview"), + new Tuple("Billing", "BillingProfiles", "2019-10-01-preview"), + new Tuple("Billing", "BillingProperty", "2019-10-01-preview"), + new Tuple("Billing", "BillingRoleAssignments", "2019-10-01-preview"), + new Tuple("Billing", "BillingRoleDefinitions", "2019-10-01-preview"), + new Tuple("Billing", "BillingSubscriptions", "2019-10-01-preview"), + new Tuple("Billing", "Customers", "2019-10-01-preview"), + new Tuple("Billing", "Departments", "2019-10-01-preview"), + new Tuple("Billing", "EnrollmentAccounts", "2019-10-01-preview"), + new Tuple("Billing", "InvoiceSections", "2019-10-01-preview"), + new Tuple("Billing", "Invoices", "2019-10-01-preview"), + new Tuple("Billing", "LineOfCredits", "2019-10-01-preview"), + new Tuple("Billing", "Operations", "2019-10-01-preview"), + new Tuple("Billing", "PartnerTransfers", "2019-10-01-preview"), + new Tuple("Billing", "PartnerTransfersTransfers", "2019-10-01-preview"), + new Tuple("Billing", "PaymentMethods", "2019-10-01-preview"), + new Tuple("Billing", "Policies", "2019-10-01-preview"), + new Tuple("Billing", "PriceSheet", "2019-10-01-preview"), + new Tuple("Billing", "Products", "2019-10-01-preview"), + new Tuple("Billing", "RecipientTransfers", "2019-10-01-preview"), + new Tuple("Billing", "Transactions", "2019-10-01-preview"), + new Tuple("Billing", "Transfers", "2019-10-01-preview"), }.AsEnumerable(); } } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/TransactionsOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/TransactionsOperations.cs index 15c25c43a8514..af4f493326756 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/TransactionsOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/TransactionsOperations.cs @@ -50,10 +50,232 @@ internal TransactionsOperations(BillingManagementClient client) /// public BillingManagementClient Client { get; private set; } + /// + /// Lists the transactions by customer id for given start date and end date. + /// + /// + /// + /// billing Account Id. + /// + /// + /// Customer name. + /// + /// + /// Start date + /// + /// + /// End date + /// + /// + /// May be used to filter by transaction kind. The filter supports 'eq', 'lt', + /// 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or + /// 'not'. Tag filter is a key value pair string where key and value is + /// separated by a colon (:). + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, string startDate, string endDate, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (customerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "customerName"); + } + 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("billingAccountName", billingAccountName); + tracingParameters.Add("customerName", customerName); + tracingParameters.Add("startDate", startDate); + tracingParameters.Add("endDate", endDate); + tracingParameters.Add("filter", filter); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByCustomer", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/transactions").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); + 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 (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Lists the transactions by billing account name for given start and end /// date. - /// + /// /// /// /// billing Account Id. @@ -91,7 +313,7 @@ internal TransactionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, string startDate, string endDate, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string startDate, string endDate, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (billingAccountName == null) { @@ -121,7 +343,7 @@ internal TransactionsOperations(BillingManagementClient client) tracingParameters.Add("endDate", endDate); tracingParameters.Add("filter", filter); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -232,7 +454,7 @@ internal TransactionsOperations(BillingManagementClient 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")) @@ -245,7 +467,7 @@ internal TransactionsOperations(BillingManagementClient 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) { @@ -267,7 +489,7 @@ internal TransactionsOperations(BillingManagementClient client) /// /// Lists the transactions by billing profile name for given start date and end /// date. - /// + /// /// /// /// billing Account Id. @@ -308,7 +530,7 @@ internal TransactionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string startDate, string endDate, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string startDate, string endDate, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (billingAccountName == null) { @@ -343,7 +565,7 @@ internal TransactionsOperations(BillingManagementClient client) tracingParameters.Add("endDate", endDate); tracingParameters.Add("filter", filter); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -455,7 +677,7 @@ internal TransactionsOperations(BillingManagementClient 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")) @@ -468,7 +690,7 @@ internal TransactionsOperations(BillingManagementClient 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) { @@ -490,11 +712,14 @@ internal TransactionsOperations(BillingManagementClient client) /// /// Lists the transactions by invoice section name for given start date and end /// date. - /// + /// /// /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -531,12 +756,16 @@ internal TransactionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string startDate, string endDate, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string startDate, string endDate, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (billingAccountName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } if (invoiceSectionName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); @@ -561,17 +790,19 @@ internal TransactionsOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("startDate", startDate); tracingParameters.Add("endDate", endDate); tracingParameters.Add("filter", filter); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSectionName", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSection", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/transactions").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/transactions").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); List _queryParameters = new List(); if (Client.ApiVersion != null) @@ -678,7 +909,7 @@ internal TransactionsOperations(BillingManagementClient 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")) @@ -691,7 +922,7 @@ internal TransactionsOperations(BillingManagementClient 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) { @@ -711,9 +942,398 @@ internal TransactionsOperations(BillingManagementClient client) } /// - /// Lists the transactions by billing account name for given start and end - /// date. - /// + /// Get the transaction. + /// + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Transaction name. + /// + /// + /// 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> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string transactionName, string startDate, string endDate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (billingAccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); + } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } + if (transactionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "transactionName"); + } + if (startDate == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "startDate"); + } + if (endDate == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "endDate"); + } + 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("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("transactionName", transactionName); + tracingParameters.Add("startDate", startDate); + tracingParameters.Add("endDate", endDate); + 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/{billingAccountName}/billingProfiles/{billingProfileName}/transactions/{transactionName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{transactionName}", System.Uri.EscapeDataString(transactionName)); + 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 (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 transactions by customer id for given start date 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>> ListByCustomerNextWithHttpMessagesAsync(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, "ListByCustomerNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the transactions by billing account name for given start and end + /// date. + /// /// /// /// The NextLink from the previous successful call to List operation. @@ -739,7 +1359,7 @@ internal TransactionsOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByBillingAccountNameNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -754,7 +1374,7 @@ internal TransactionsOperations(BillingManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNameNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -848,7 +1468,7 @@ internal TransactionsOperations(BillingManagementClient 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")) @@ -861,7 +1481,7 @@ internal TransactionsOperations(BillingManagementClient 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/billing/Microsoft.Azure.Management.Billing/src/Generated/TransactionsOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/TransactionsOperationsExtensions.cs index b688c5fd9120f..c94b794fd62b2 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/TransactionsOperationsExtensions.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/TransactionsOperationsExtensions.cs @@ -21,10 +21,76 @@ namespace Microsoft.Azure.Management.Billing /// public static partial class TransactionsOperationsExtensions { + /// + /// Lists the transactions by customer id for given start date and end date. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Customer name. + /// + /// + /// Start date + /// + /// + /// End date + /// + /// + /// May be used to filter by transaction kind. The filter supports 'eq', 'lt', + /// 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or + /// 'not'. Tag filter is a key value pair string where key and value is + /// separated by a colon (:). + /// + public static IPage ListByCustomer(this ITransactionsOperations operations, string billingAccountName, string customerName, string startDate, string endDate, string filter = default(string)) + { + return operations.ListByCustomerAsync(billingAccountName, customerName, startDate, endDate, filter).GetAwaiter().GetResult(); + } + + /// + /// Lists the transactions by customer id for given start date and end date. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Customer name. + /// + /// + /// Start date + /// + /// + /// End date + /// + /// + /// May be used to filter by transaction kind. The filter supports 'eq', 'lt', + /// 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or + /// 'not'. Tag filter is a key value pair string where key and value is + /// separated by a colon (:). + /// + /// + /// The cancellation token. + /// + public static async Task> ListByCustomerAsync(this ITransactionsOperations operations, string billingAccountName, string customerName, string startDate, string endDate, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByCustomerWithHttpMessagesAsync(billingAccountName, customerName, startDate, endDate, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Lists the transactions by billing account name for given start and end /// date. - /// + /// /// /// /// The operations group for this extension method. @@ -44,15 +110,15 @@ public static partial class TransactionsOperationsExtensions /// 'not'. Tag filter is a key value pair string where key and value is /// separated by a colon (:). /// - public static IPage ListByBillingAccountName(this ITransactionsOperations operations, string billingAccountName, string startDate, string endDate, string filter = default(string)) + public static IPage ListByBillingAccount(this ITransactionsOperations operations, string billingAccountName, string startDate, string endDate, string filter = default(string)) { - return operations.ListByBillingAccountNameAsync(billingAccountName, startDate, endDate, filter).GetAwaiter().GetResult(); + return operations.ListByBillingAccountAsync(billingAccountName, startDate, endDate, filter).GetAwaiter().GetResult(); } /// /// Lists the transactions by billing account name for given start and end /// date. - /// + /// /// /// /// The operations group for this extension method. @@ -75,9 +141,9 @@ public static partial class TransactionsOperationsExtensions /// /// The cancellation token. /// - public static async Task> ListByBillingAccountNameAsync(this ITransactionsOperations operations, string billingAccountName, string startDate, string endDate, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByBillingAccountAsync(this ITransactionsOperations operations, string billingAccountName, string startDate, string endDate, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByBillingAccountNameWithHttpMessagesAsync(billingAccountName, startDate, endDate, filter, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, startDate, endDate, filter, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -86,7 +152,7 @@ public static partial class TransactionsOperationsExtensions /// /// Lists the transactions by billing profile name for given start date and end /// date. - /// + /// /// /// /// The operations group for this extension method. @@ -109,15 +175,15 @@ public static partial class TransactionsOperationsExtensions /// 'not'. Tag filter is a key value pair string where key and value is /// separated by a colon (:). /// - public static TransactionsListResult ListByBillingProfileName(this ITransactionsOperations operations, string billingAccountName, string billingProfileName, string startDate, string endDate, string filter = default(string)) + public static TransactionListResult ListByBillingProfile(this ITransactionsOperations operations, string billingAccountName, string billingProfileName, string startDate, string endDate, string filter = default(string)) { - return operations.ListByBillingProfileNameAsync(billingAccountName, billingProfileName, startDate, endDate, filter).GetAwaiter().GetResult(); + return operations.ListByBillingProfileAsync(billingAccountName, billingProfileName, startDate, endDate, filter).GetAwaiter().GetResult(); } /// /// Lists the transactions by billing profile name for given start date and end /// date. - /// + /// /// /// /// The operations group for this extension method. @@ -143,9 +209,9 @@ public static partial class TransactionsOperationsExtensions /// /// The cancellation token. /// - public static async Task ListByBillingProfileNameAsync(this ITransactionsOperations operations, string billingAccountName, string billingProfileName, string startDate, string endDate, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListByBillingProfileAsync(this ITransactionsOperations operations, string billingAccountName, string billingProfileName, string startDate, string endDate, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByBillingProfileNameWithHttpMessagesAsync(billingAccountName, billingProfileName, startDate, endDate, filter, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, startDate, endDate, filter, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -154,7 +220,7 @@ public static partial class TransactionsOperationsExtensions /// /// Lists the transactions by invoice section name for given start date and end /// date. - /// + /// /// /// /// The operations group for this extension method. @@ -162,6 +228,9 @@ public static partial class TransactionsOperationsExtensions /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -177,15 +246,15 @@ public static partial class TransactionsOperationsExtensions /// 'not'. Tag filter is a key value pair string where key and value is /// separated by a colon (:). /// - public static TransactionsListResult ListByInvoiceSectionName(this ITransactionsOperations operations, string billingAccountName, string invoiceSectionName, string startDate, string endDate, string filter = default(string)) + public static TransactionListResult ListByInvoiceSection(this ITransactionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string startDate, string endDate, string filter = default(string)) { - return operations.ListByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName, startDate, endDate, filter).GetAwaiter().GetResult(); + return operations.ListByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, startDate, endDate, filter).GetAwaiter().GetResult(); } /// /// Lists the transactions by invoice section name for given start date and end /// date. - /// + /// /// /// /// The operations group for this extension method. @@ -193,6 +262,9 @@ public static partial class TransactionsOperationsExtensions /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -211,9 +283,105 @@ public static partial class TransactionsOperationsExtensions /// /// The cancellation token. /// - public static async Task ListByInvoiceSectionNameAsync(this ITransactionsOperations operations, string billingAccountName, string invoiceSectionName, string startDate, string endDate, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListByInvoiceSectionAsync(this ITransactionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string startDate, string endDate, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, startDate, endDate, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get the transaction. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Transaction name. + /// + /// + /// Start date + /// + /// + /// End date + /// + public static Transaction Get(this ITransactionsOperations operations, string billingAccountName, string billingProfileName, string transactionName, string startDate, string endDate) + { + return operations.GetAsync(billingAccountName, billingProfileName, transactionName, startDate, endDate).GetAwaiter().GetResult(); + } + + /// + /// Get the transaction. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + /// + /// Transaction name. + /// + /// + /// Start date + /// + /// + /// End date + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ITransactionsOperations operations, string billingAccountName, string billingProfileName, string transactionName, string startDate, string endDate, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByInvoiceSectionNameWithHttpMessagesAsync(billingAccountName, invoiceSectionName, startDate, endDate, filter, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, billingProfileName, transactionName, startDate, endDate, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the transactions by customer id for given start date and end date. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByCustomerNext(this ITransactionsOperations operations, string nextPageLink) + { + return operations.ListByCustomerNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the transactions by customer id for given start date 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> ListByCustomerNextAsync(this ITransactionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByCustomerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -222,7 +390,7 @@ public static partial class TransactionsOperationsExtensions /// /// Lists the transactions by billing account name for given start and end /// date. - /// + /// /// /// /// The operations group for this extension method. @@ -230,15 +398,15 @@ public static partial class TransactionsOperationsExtensions /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListByBillingAccountNameNext(this ITransactionsOperations operations, string nextPageLink) + public static IPage ListByBillingAccountNext(this ITransactionsOperations operations, string nextPageLink) { - return operations.ListByBillingAccountNameNextAsync(nextPageLink).GetAwaiter().GetResult(); + return operations.ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// /// Lists the transactions by billing account name for given start and end /// date. - /// + /// /// /// /// The operations group for this extension method. @@ -249,9 +417,9 @@ public static IPage ListByBillingAccountNameNext(this ITran /// /// The cancellation token. /// - public static async Task> ListByBillingAccountNameNextAsync(this ITransactionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByBillingAccountNextAsync(this ITransactionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByBillingAccountNameNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/TransfersOperations.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/TransfersOperations.cs index 9bd562f3cebd5..7a42f150f109c 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/TransfersOperations.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/TransfersOperations.cs @@ -56,11 +56,14 @@ internal TransfersOperations(BillingManagementClient client) /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// - /// - /// Initiate transfer parameters. + /// + /// Parameters supplied to initiate the transfer. /// /// /// Headers that will be added to request. @@ -83,19 +86,23 @@ internal TransfersOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> InitiateWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, InitiateTransferRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> InitiateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, InitiateTransferRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (billingAccountName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } if (invoiceSectionName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); } - if (body == null) + if (parameters == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "body"); + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -105,15 +112,17 @@ internal TransfersOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); - tracingParameters.Add("body", body); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Initiate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/initiateTransfer").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/initiateTransfer").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); List _queryParameters = new List(); if (_queryParameters.Count > 0) @@ -154,9 +163,9 @@ internal TransfersOperations(BillingManagementClient client) // Serialize Request string _requestContent = null; - if(body != null) + if(parameters != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); } @@ -248,6 +257,9 @@ internal TransfersOperations(BillingManagementClient client) /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -275,12 +287,16 @@ internal TransfersOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string transferName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string transferName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (billingAccountName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } if (invoiceSectionName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); @@ -297,6 +313,7 @@ internal TransfersOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("transferName", transferName); tracingParameters.Add("cancellationToken", cancellationToken); @@ -304,8 +321,9 @@ internal TransfersOperations(BillingManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/transfers/{transferName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/transfers/{transferName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); _url = _url.Replace("{transferName}", System.Uri.EscapeDataString(transferName)); List _queryParameters = new List(); @@ -435,6 +453,9 @@ internal TransfersOperations(BillingManagementClient client) /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -462,12 +483,16 @@ internal TransfersOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CancelWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string transferName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CancelWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string transferName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (billingAccountName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } if (invoiceSectionName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); @@ -484,6 +509,7 @@ internal TransfersOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); tracingParameters.Add("transferName", transferName); tracingParameters.Add("cancellationToken", cancellationToken); @@ -491,8 +517,9 @@ internal TransfersOperations(BillingManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/transfers/{transferName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/transfers/{transferName}").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); _url = _url.Replace("{transferName}", System.Uri.EscapeDataString(transferName)); List _queryParameters = new List(); @@ -622,6 +649,9 @@ internal TransfersOperations(BillingManagementClient client) /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -646,12 +676,16 @@ internal TransfersOperations(BillingManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (billingAccountName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName"); } + if (billingProfileName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName"); + } if (invoiceSectionName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName"); @@ -664,14 +698,16 @@ internal TransfersOperations(BillingManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); tracingParameters.Add("invoiceSectionName", invoiceSectionName); 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/{billingAccountName}/invoiceSections/{invoiceSectionName}/transfers").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/transfers").ToString(); _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); List _queryParameters = new List(); if (_queryParameters.Count > 0) diff --git a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/TransfersOperationsExtensions.cs b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/TransfersOperationsExtensions.cs index fc89c4ca02b4b..3b529a83a0c3f 100644 --- a/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/TransfersOperationsExtensions.cs +++ b/sdk/billing/Microsoft.Azure.Management.Billing/src/Generated/TransfersOperationsExtensions.cs @@ -30,15 +30,18 @@ public static partial class TransfersOperationsExtensions /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// - /// - /// Initiate transfer parameters. + /// + /// Parameters supplied to initiate the transfer. /// - public static TransferDetails Initiate(this ITransfersOperations operations, string billingAccountName, string invoiceSectionName, InitiateTransferRequest body) + public static TransferDetails Initiate(this ITransfersOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, InitiateTransferRequest parameters) { - return operations.InitiateAsync(billingAccountName, invoiceSectionName, body).GetAwaiter().GetResult(); + return operations.InitiateAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters).GetAwaiter().GetResult(); } /// @@ -50,18 +53,21 @@ public static TransferDetails Initiate(this ITransfersOperations operations, str /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// - /// - /// Initiate transfer parameters. + /// + /// Parameters supplied to initiate the transfer. /// /// /// The cancellation token. /// - public static async Task InitiateAsync(this ITransfersOperations operations, string billingAccountName, string invoiceSectionName, InitiateTransferRequest body, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task InitiateAsync(this ITransfersOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, InitiateTransferRequest parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.InitiateWithHttpMessagesAsync(billingAccountName, invoiceSectionName, body, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.InitiateWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -76,15 +82,18 @@ public static TransferDetails Initiate(this ITransfersOperations operations, str /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// /// Transfer Name. /// - public static TransferDetails Get(this ITransfersOperations operations, string billingAccountName, string invoiceSectionName, string transferName) + public static TransferDetails Get(this ITransfersOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string transferName) { - return operations.GetAsync(billingAccountName, invoiceSectionName, transferName).GetAwaiter().GetResult(); + return operations.GetAsync(billingAccountName, billingProfileName, invoiceSectionName, transferName).GetAwaiter().GetResult(); } /// @@ -96,6 +105,9 @@ public static TransferDetails Get(this ITransfersOperations operations, string b /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -105,9 +117,9 @@ public static TransferDetails Get(this ITransfersOperations operations, string b /// /// The cancellation token. /// - public static async Task GetAsync(this ITransfersOperations operations, string billingAccountName, string invoiceSectionName, string transferName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this ITransfersOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string transferName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, invoiceSectionName, transferName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, transferName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -122,15 +134,18 @@ public static TransferDetails Get(this ITransfersOperations operations, string b /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// /// Transfer Name. /// - public static TransferDetails Cancel(this ITransfersOperations operations, string billingAccountName, string invoiceSectionName, string transferName) + public static TransferDetails Cancel(this ITransfersOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string transferName) { - return operations.CancelAsync(billingAccountName, invoiceSectionName, transferName).GetAwaiter().GetResult(); + return operations.CancelAsync(billingAccountName, billingProfileName, invoiceSectionName, transferName).GetAwaiter().GetResult(); } /// @@ -142,6 +157,9 @@ public static TransferDetails Cancel(this ITransfersOperations operations, strin /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// @@ -151,9 +169,9 @@ public static TransferDetails Cancel(this ITransfersOperations operations, strin /// /// The cancellation token. /// - public static async Task CancelAsync(this ITransfersOperations operations, string billingAccountName, string invoiceSectionName, string transferName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CancelAsync(this ITransfersOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string transferName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CancelWithHttpMessagesAsync(billingAccountName, invoiceSectionName, transferName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CancelWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, transferName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -168,12 +186,15 @@ public static TransferDetails Cancel(this ITransfersOperations operations, strin /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// - public static IPage List(this ITransfersOperations operations, string billingAccountName, string invoiceSectionName) + public static IPage List(this ITransfersOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName) { - return operations.ListAsync(billingAccountName, invoiceSectionName).GetAwaiter().GetResult(); + return operations.ListAsync(billingAccountName, billingProfileName, invoiceSectionName).GetAwaiter().GetResult(); } /// @@ -185,15 +206,18 @@ public static IPage List(this ITransfersOperations operations, /// /// billing Account Id. /// + /// + /// Billing Profile Id. + /// /// /// InvoiceSection Id. /// /// /// The cancellation token. /// - public static async Task> ListAsync(this ITransfersOperations operations, string billingAccountName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this ITransfersOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListWithHttpMessagesAsync(billingAccountName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; }