From 0ffb353e91e05d09ea409ad87d00c72a9c0baaaf Mon Sep 17 00:00:00 2001 From: adxsdknet <39844661+adxsdknet@users.noreply.github.com> Date: Fri, 29 Mar 2019 10:43:33 -0700 Subject: [PATCH] AutoPr-Billing-wilcobmsft-REST Spec PrNumber 5486 (#5602) * .NET SDK Resource Provider:'Billing' REST Spec PR 'https://github.com/Azure/azure-rest-api-specs/pull/5486' REST Spec PR Author 'wilcobmsft' REST Spec PR Last commit * .NET SDK Resource Provider:'Billing' REST Spec PR 'https://github.com/Azure/azure-rest-api-specs/pull/5486' REST Spec PR Author 'wilcobmsft' REST Spec PR Last commit * .NET SDK Resource Provider:'Billing' REST Spec PR 'https://github.com/Azure/azure-rest-api-specs/pull/5486' REST Spec PR Author 'wilcobmsft' REST Spec PR Last commit * .NET SDK Resource Provider:'Billing' REST Spec PR 'https://github.com/Azure/azure-rest-api-specs/pull/5486' REST Spec PR Author 'wilcobmsft' REST Spec PR Last commit --- ...eSectionsByBillingAccountNameOperations.cs | 2 +- .../Generated/IInvoiceSectionsOperations.cs | 48 +++ ...hCreateSubscriptionPermissionOperations.cs | 2 +- ...eSectionsByBillingAccountNameOperations.cs | 19 +- .../Generated/InvoiceSectionsOperations.cs | 344 ++++++++++++++++++ .../InvoiceSectionsOperationsExtensions.cs | 79 ++++ ...hCreateSubscriptionPermissionOperations.cs | 19 +- ...SectionsByBillingAccountNameListHeaders.cs | 66 ---- ...CreateSubscriptionPermissionListHeaders.cs | 66 ---- 9 files changed, 479 insertions(+), 166 deletions(-) delete mode 100644 src/SDKs/Billing/Management.Billing/Generated/Models/InvoiceSectionsByBillingAccountNameListHeaders.cs delete mode 100644 src/SDKs/Billing/Management.Billing/Generated/Models/InvoiceSectionsWithCreateSubscriptionPermissionListHeaders.cs diff --git a/src/SDKs/Billing/Management.Billing/Generated/IInvoiceSectionsByBillingAccountNameOperations.cs b/src/SDKs/Billing/Management.Billing/Generated/IInvoiceSectionsByBillingAccountNameOperations.cs index 73b8b070427b..8a9c32ffef12 100644 --- a/src/SDKs/Billing/Management.Billing/Generated/IInvoiceSectionsByBillingAccountNameOperations.cs +++ b/src/SDKs/Billing/Management.Billing/Generated/IInvoiceSectionsByBillingAccountNameOperations.cs @@ -47,6 +47,6 @@ public partial interface IInvoiceSectionsByBillingAccountNameOperations /// /// Thrown when a required parameter is null /// - Task> ListWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/src/SDKs/Billing/Management.Billing/Generated/IInvoiceSectionsOperations.cs b/src/SDKs/Billing/Management.Billing/Generated/IInvoiceSectionsOperations.cs index e15c1f00694b..a84830082b95 100644 --- a/src/SDKs/Billing/Management.Billing/Generated/IInvoiceSectionsOperations.cs +++ b/src/SDKs/Billing/Management.Billing/Generated/IInvoiceSectionsOperations.cs @@ -49,6 +49,32 @@ public partial interface IInvoiceSectionsOperations /// Task> CreateWithHttpMessagesAsync(string billingAccountName, InvoiceSectionProperties parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Lists all invoice sections under a billing profile for a user which + /// he has access to. + /// + /// + /// billing Account Id. + /// + /// + /// 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)); + /// /// Get the InvoiceSection by id. /// /// @@ -105,6 +131,28 @@ public partial interface IInvoiceSectionsOperations /// Task> UpdateWithHttpMessagesAsync(string billingAccountName, 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. + /// + /// + /// InvoiceSection Id. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task ElevateToBillingProfileWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// The operation to create a InvoiceSection. /// /// diff --git a/src/SDKs/Billing/Management.Billing/Generated/IInvoiceSectionsWithCreateSubscriptionPermissionOperations.cs b/src/SDKs/Billing/Management.Billing/Generated/IInvoiceSectionsWithCreateSubscriptionPermissionOperations.cs index 1b8d4ec1f66a..758b2d926ce8 100644 --- a/src/SDKs/Billing/Management.Billing/Generated/IInvoiceSectionsWithCreateSubscriptionPermissionOperations.cs +++ b/src/SDKs/Billing/Management.Billing/Generated/IInvoiceSectionsWithCreateSubscriptionPermissionOperations.cs @@ -48,6 +48,6 @@ public partial interface IInvoiceSectionsWithCreateSubscriptionPermissionOperati /// /// Thrown when a required parameter is null /// - Task> ListWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/src/SDKs/Billing/Management.Billing/Generated/InvoiceSectionsByBillingAccountNameOperations.cs b/src/SDKs/Billing/Management.Billing/Generated/InvoiceSectionsByBillingAccountNameOperations.cs index 5411ff991ddc..718ccaaba215 100644 --- a/src/SDKs/Billing/Management.Billing/Generated/InvoiceSectionsByBillingAccountNameOperations.cs +++ b/src/SDKs/Billing/Management.Billing/Generated/InvoiceSectionsByBillingAccountNameOperations.cs @@ -80,7 +80,7 @@ internal InvoiceSectionsByBillingAccountNameOperations(BillingManagementClient c /// /// A response object containing the response body and response headers. /// - public async Task> ListWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -173,7 +173,7 @@ internal InvoiceSectionsByBillingAccountNameOperations(BillingManagementClient c 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 @@ -203,7 +203,7 @@ internal InvoiceSectionsByBillingAccountNameOperations(BillingManagementClient c 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")) @@ -228,19 +228,6 @@ internal InvoiceSectionsByBillingAccountNameOperations(BillingManagementClient c 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); diff --git a/src/SDKs/Billing/Management.Billing/Generated/InvoiceSectionsOperations.cs b/src/SDKs/Billing/Management.Billing/Generated/InvoiceSectionsOperations.cs index deb3b7f0b048..c3e5cc18a46a 100644 --- a/src/SDKs/Billing/Management.Billing/Generated/InvoiceSectionsOperations.cs +++ b/src/SDKs/Billing/Management.Billing/Generated/InvoiceSectionsOperations.cs @@ -72,6 +72,193 @@ internal InvoiceSectionsOperations(BillingManagementClient client) 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. + /// + /// + /// 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> ListByBillingProfileNameWithHttpMessagesAsync(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, "ListByBillingProfileName", 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").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("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 the InvoiceSection by id. /// @@ -291,6 +478,163 @@ internal InvoiceSectionsOperations(BillingManagementClient client) return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } + /// + /// Elevates the caller's access to match their billing profile access. + /// + /// + /// billing Account Id. + /// + /// + /// InvoiceSection Id. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// 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 ElevateToBillingProfileWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, 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"); + } + // 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("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(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); + 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; + // 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 != 204) + { + 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(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// The operation to create a InvoiceSection. /// diff --git a/src/SDKs/Billing/Management.Billing/Generated/InvoiceSectionsOperationsExtensions.cs b/src/SDKs/Billing/Management.Billing/Generated/InvoiceSectionsOperationsExtensions.cs index d87fb17619e7..ab0faf202780 100644 --- a/src/SDKs/Billing/Management.Billing/Generated/InvoiceSectionsOperationsExtensions.cs +++ b/src/SDKs/Billing/Management.Billing/Generated/InvoiceSectionsOperationsExtensions.cs @@ -61,6 +61,48 @@ public static InvoiceSection Create(this IInvoiceSectionsOperations operations, } } + /// + /// Lists all invoice sections under a billing profile for a user which he has + /// access to. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// Billing Profile Id. + /// + public static InvoiceSectionListResult ListByBillingProfileName(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName) + { + return operations.ListByBillingProfileNameAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + } + + /// + /// Lists all invoice sections under a billing profile for a user which he has + /// access to. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// 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; + } + } + /// /// Get the InvoiceSection by id. /// @@ -153,6 +195,43 @@ public static InvoiceSection Update(this IInvoiceSectionsOperations operations, } } + /// + /// Elevates the caller's access to match their billing profile access. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// InvoiceSection Id. + /// + public static void ElevateToBillingProfile(this IInvoiceSectionsOperations operations, string billingAccountName, string invoiceSectionName) + { + operations.ElevateToBillingProfileAsync(billingAccountName, invoiceSectionName).GetAwaiter().GetResult(); + } + + /// + /// Elevates the caller's access to match their billing profile access. + /// + /// + /// The operations group for this extension method. + /// + /// + /// billing Account Id. + /// + /// + /// InvoiceSection Id. + /// + /// + /// The cancellation token. + /// + public static async Task ElevateToBillingProfileAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ElevateToBillingProfileWithHttpMessagesAsync(billingAccountName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// The operation to create a InvoiceSection. /// diff --git a/src/SDKs/Billing/Management.Billing/Generated/InvoiceSectionsWithCreateSubscriptionPermissionOperations.cs b/src/SDKs/Billing/Management.Billing/Generated/InvoiceSectionsWithCreateSubscriptionPermissionOperations.cs index 839ec7153f42..a04c15556001 100644 --- a/src/SDKs/Billing/Management.Billing/Generated/InvoiceSectionsWithCreateSubscriptionPermissionOperations.cs +++ b/src/SDKs/Billing/Management.Billing/Generated/InvoiceSectionsWithCreateSubscriptionPermissionOperations.cs @@ -80,7 +80,7 @@ internal InvoiceSectionsWithCreateSubscriptionPermissionOperations(BillingManage /// /// A response object containing the response body and response headers. /// - public async Task> ListWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListWithHttpMessagesAsync(string billingAccountName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -173,7 +173,7 @@ internal InvoiceSectionsWithCreateSubscriptionPermissionOperations(BillingManage 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 @@ -203,7 +203,7 @@ internal InvoiceSectionsWithCreateSubscriptionPermissionOperations(BillingManage 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")) @@ -228,19 +228,6 @@ internal InvoiceSectionsWithCreateSubscriptionPermissionOperations(BillingManage 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); diff --git a/src/SDKs/Billing/Management.Billing/Generated/Models/InvoiceSectionsByBillingAccountNameListHeaders.cs b/src/SDKs/Billing/Management.Billing/Generated/Models/InvoiceSectionsByBillingAccountNameListHeaders.cs deleted file mode 100644 index 10dead4f6047..000000000000 --- a/src/SDKs/Billing/Management.Billing/Generated/Models/InvoiceSectionsByBillingAccountNameListHeaders.cs +++ /dev/null @@ -1,66 +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; - - /// - /// Defines headers for List operation. - /// - public partial class InvoiceSectionsByBillingAccountNameListHeaders - { - /// - /// Initializes a new instance of the - /// InvoiceSectionsByBillingAccountNameListHeaders class. - /// - public InvoiceSectionsByBillingAccountNameListHeaders() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// InvoiceSectionsByBillingAccountNameListHeaders 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. - public InvoiceSectionsByBillingAccountNameListHeaders(string location = default(string), string retryAfter = default(string)) - { - Location = location; - RetryAfter = retryAfter; - 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; } - - } -} diff --git a/src/SDKs/Billing/Management.Billing/Generated/Models/InvoiceSectionsWithCreateSubscriptionPermissionListHeaders.cs b/src/SDKs/Billing/Management.Billing/Generated/Models/InvoiceSectionsWithCreateSubscriptionPermissionListHeaders.cs deleted file mode 100644 index 70a70d02f1a5..000000000000 --- a/src/SDKs/Billing/Management.Billing/Generated/Models/InvoiceSectionsWithCreateSubscriptionPermissionListHeaders.cs +++ /dev/null @@ -1,66 +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; - - /// - /// Defines headers for List operation. - /// - public partial class InvoiceSectionsWithCreateSubscriptionPermissionListHeaders - { - /// - /// Initializes a new instance of the - /// InvoiceSectionsWithCreateSubscriptionPermissionListHeaders class. - /// - public InvoiceSectionsWithCreateSubscriptionPermissionListHeaders() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// InvoiceSectionsWithCreateSubscriptionPermissionListHeaders 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. - public InvoiceSectionsWithCreateSubscriptionPermissionListHeaders(string location = default(string), string retryAfter = default(string)) - { - Location = location; - RetryAfter = retryAfter; - 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; } - - } -}