diff --git a/src/SDKs/Billing/Management.Billing/Generated/AvailableBalanceByBillingProfileOperations.cs b/src/SDKs/Billing/Management.Billing/Generated/AvailableBalancesOperations.cs
similarity index 93%
rename from src/SDKs/Billing/Management.Billing/Generated/AvailableBalanceByBillingProfileOperations.cs
rename to src/SDKs/Billing/Management.Billing/Generated/AvailableBalancesOperations.cs
index ddce3acf6011..d5c456a3192d 100644
--- a/src/SDKs/Billing/Management.Billing/Generated/AvailableBalanceByBillingProfileOperations.cs
+++ b/src/SDKs/Billing/Management.Billing/Generated/AvailableBalancesOperations.cs
@@ -23,12 +23,12 @@ namespace Microsoft.Azure.Management.Billing
using System.Threading.Tasks;
///
- /// AvailableBalanceByBillingProfileOperations operations.
+ /// AvailableBalancesOperations operations.
///
- internal partial class AvailableBalanceByBillingProfileOperations : IServiceOperations, IAvailableBalanceByBillingProfileOperations
+ internal partial class AvailableBalancesOperations : IServiceOperations, IAvailableBalancesOperations
{
///
- /// Initializes a new instance of the AvailableBalanceByBillingProfileOperations class.
+ /// Initializes a new instance of the AvailableBalancesOperations class.
///
///
/// Reference to the service client.
@@ -36,7 +36,7 @@ internal partial class AvailableBalanceByBillingProfileOperations : IServiceOper
///
/// Thrown when a required parameter is null
///
- internal AvailableBalanceByBillingProfileOperations(BillingManagementClient client)
+ internal AvailableBalancesOperations(BillingManagementClient client)
{
if (client == null)
{
@@ -81,7 +81,7 @@ internal AvailableBalanceByBillingProfileOperations(BillingManagementClient clie
///
/// A response object containing the response body and response headers.
///
- public async Task> GetWithHttpMessagesAsync(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 AvailableBalanceByBillingProfileOperations(BillingManagementClient clie
tracingParameters.Add("billingAccountName", billingAccountName);
tracingParameters.Add("billingProfileName", billingProfileName);
tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "GetByBillingProfile", tracingParameters);
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
diff --git a/src/SDKs/Billing/Management.Billing/Generated/AvailableBalanceByBillingProfileOperationsExtensions.cs b/src/SDKs/Billing/Management.Billing/Generated/AvailableBalancesOperationsExtensions.cs
similarity index 69%
rename from src/SDKs/Billing/Management.Billing/Generated/AvailableBalanceByBillingProfileOperationsExtensions.cs
rename to src/SDKs/Billing/Management.Billing/Generated/AvailableBalancesOperationsExtensions.cs
index 68077b35397f..e1e1a592f137 100644
--- a/src/SDKs/Billing/Management.Billing/Generated/AvailableBalanceByBillingProfileOperationsExtensions.cs
+++ b/src/SDKs/Billing/Management.Billing/Generated/AvailableBalancesOperationsExtensions.cs
@@ -17,9 +17,9 @@ namespace Microsoft.Azure.Management.Billing
using System.Threading.Tasks;
///
- /// Extension methods for AvailableBalanceByBillingProfileOperations.
+ /// Extension methods for AvailableBalancesOperations.
///
- public static partial class AvailableBalanceByBillingProfileOperationsExtensions
+ public static partial class AvailableBalancesOperationsExtensions
{
///
/// The latest available credit balance for a given billingAccountName and
@@ -34,9 +34,9 @@ public static partial class AvailableBalanceByBillingProfileOperationsExtensions
///
/// Billing Profile Id.
///
- public static AvailableBalance Get(this IAvailableBalanceByBillingProfileOperations operations, string billingAccountName, string billingProfileName)
+ public static AvailableBalance GetByBillingProfile(this IAvailableBalancesOperations operations, string billingAccountName, string billingProfileName)
{
- return operations.GetAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult();
+ return operations.GetByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult();
}
///
@@ -55,9 +55,9 @@ public static AvailableBalance Get(this IAvailableBalanceByBillingProfileOperati
///
/// The cancellation token.
///
- public static async Task GetAsync(this IAvailableBalanceByBillingProfileOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task GetByBillingProfileAsync(this IAvailableBalancesOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.GetByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
diff --git a/src/SDKs/Billing/Management.Billing/Generated/BillingAccountbillingPermissionsOperations.cs b/src/SDKs/Billing/Management.Billing/Generated/BillingAccountbillingPermissionsOperations.cs
deleted file mode 100644
index d7dfb7e6c200..000000000000
--- a/src/SDKs/Billing/Management.Billing/Generated/BillingAccountbillingPermissionsOperations.cs
+++ /dev/null
@@ -1,231 +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
-{
- 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;
-
- ///
- /// BillingAccountBillingPermissionsOperations operations.
- ///
- internal partial class BillingAccountBillingPermissionsOperations : IServiceOperations, IBillingAccountBillingPermissionsOperations
- {
- ///
- /// Initializes a new instance of the BillingAccountBillingPermissionsOperations class.
- ///
- ///
- /// Reference to the service client.
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- internal BillingAccountBillingPermissionsOperations(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 billingPermissions for the caller has for a billing account.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// Headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when unable to deserialize the response
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// A response object containing the response body and response headers.
- ///
- public async Task> ListWithHttpMessagesAsync(string billingAccountName, 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("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}/providers/Microsoft.Billing/billingPermissions").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("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/src/SDKs/Billing/Management.Billing/Generated/BillingAccountbillingPermissionsOperationsExtensions.cs b/src/SDKs/Billing/Management.Billing/Generated/BillingAccountbillingPermissionsOperationsExtensions.cs
deleted file mode 100644
index 216698ede9a2..000000000000
--- a/src/SDKs/Billing/Management.Billing/Generated/BillingAccountbillingPermissionsOperationsExtensions.cs
+++ /dev/null
@@ -1,59 +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
-{
- using Microsoft.Rest;
- using Microsoft.Rest.Azure;
- using Models;
- using System.Threading;
- using System.Threading.Tasks;
-
- ///
- /// Extension methods for BillingAccountBillingPermissionsOperations.
- ///
- public static partial class BillingAccountBillingPermissionsOperationsExtensions
- {
- ///
- /// Lists all billingPermissions for the caller has for a billing account.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- public static BillingPermissionsListResult List(this IBillingAccountBillingPermissionsOperations operations, string billingAccountName)
- {
- return operations.ListAsync(billingAccountName).GetAwaiter().GetResult();
- }
-
- ///
- /// Lists all billingPermissions for the caller has for a billing account.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task ListAsync(this IBillingAccountBillingPermissionsOperations operations, string billingAccountName, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.ListWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- }
-}
diff --git a/src/SDKs/Billing/Management.Billing/Generated/BillingAccountbillingRoleAssignmentOperationsExtensions.cs b/src/SDKs/Billing/Management.Billing/Generated/BillingAccountbillingRoleAssignmentOperationsExtensions.cs
deleted file mode 100644
index 9c5c97d5444c..000000000000
--- a/src/SDKs/Billing/Management.Billing/Generated/BillingAccountbillingRoleAssignmentOperationsExtensions.cs
+++ /dev/null
@@ -1,173 +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
-{
- using Microsoft.Rest;
- using Microsoft.Rest.Azure;
- using Models;
- using System.Threading;
- using System.Threading.Tasks;
-
- ///
- /// Extension methods for BillingAccountBillingRoleAssignmentOperations.
- ///
- public static partial class BillingAccountBillingRoleAssignmentOperationsExtensions
- {
- ///
- /// Get the role assignment for the caller
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// role assignment id.
- ///
- public static BillingRoleAssignment Get(this IBillingAccountBillingRoleAssignmentOperations operations, string billingAccountName, string billingRoleAssignmentName)
- {
- return operations.GetAsync(billingAccountName, billingRoleAssignmentName).GetAwaiter().GetResult();
- }
-
- ///
- /// Get the role assignment for the caller
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// role assignment id.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task GetAsync(this IBillingAccountBillingRoleAssignmentOperations operations, string billingAccountName, string billingRoleAssignmentName, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// Delete the role assignment on this billing account
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// role assignment id.
- ///
- public static BillingRoleAssignment Delete(this IBillingAccountBillingRoleAssignmentOperations operations, string billingAccountName, string billingRoleAssignmentName)
- {
- return operations.DeleteAsync(billingAccountName, billingRoleAssignmentName).GetAwaiter().GetResult();
- }
-
- ///
- /// Delete the role assignment on this billing account
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// role assignment id.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task DeleteAsync(this IBillingAccountBillingRoleAssignmentOperations operations, string billingAccountName, string billingRoleAssignmentName, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.DeleteWithHttpMessagesAsync(billingAccountName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// Get the role assignments on the Billing Account
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- public static BillingRoleAssignmentListResult List(this IBillingAccountBillingRoleAssignmentOperations operations, string billingAccountName)
- {
- return operations.ListAsync(billingAccountName).GetAwaiter().GetResult();
- }
-
- ///
- /// Get the role assignments on the Billing Account
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task ListAsync(this IBillingAccountBillingRoleAssignmentOperations operations, string billingAccountName, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.ListWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// The operation to add a role assignment to a billing account.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- public static BillingRoleAssignmentListResult Add(this IBillingAccountBillingRoleAssignmentOperations operations, string billingAccountName)
- {
- return operations.AddAsync(billingAccountName).GetAwaiter().GetResult();
- }
-
- ///
- /// The operation to add a role assignment to a billing account.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task AddAsync(this IBillingAccountBillingRoleAssignmentOperations operations, string billingAccountName, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.AddWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- }
-}
diff --git a/src/SDKs/Billing/Management.Billing/Generated/BillingAccountbillingRoleDefinitionOperations.cs b/src/SDKs/Billing/Management.Billing/Generated/BillingAccountbillingRoleDefinitionOperations.cs
deleted file mode 100644
index d9f31f8e92ba..000000000000
--- a/src/SDKs/Billing/Management.Billing/Generated/BillingAccountbillingRoleDefinitionOperations.cs
+++ /dev/null
@@ -1,417 +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
-{
- 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;
-
- ///
- /// BillingAccountBillingRoleDefinitionOperations operations.
- ///
- internal partial class BillingAccountBillingRoleDefinitionOperations : IServiceOperations, IBillingAccountBillingRoleDefinitionOperations
- {
- ///
- /// Initializes a new instance of the BillingAccountBillingRoleDefinitionOperations class.
- ///
- ///
- /// Reference to the service client.
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- internal BillingAccountBillingRoleDefinitionOperations(BillingManagementClient client)
- {
- if (client == null)
- {
- throw new System.ArgumentNullException("client");
- }
- Client = client;
- }
-
- ///
- /// Gets a reference to the BillingManagementClient
- ///
- public BillingManagementClient Client { get; private set; }
-
- ///
- /// Gets the role definition for a role
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// role definition 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 billingRoleDefinitionName, 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 (billingRoleDefinitionName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "billingRoleDefinitionName");
- }
- // Tracing
- bool _shouldTrace = ServiceClientTracing.IsEnabled;
- string _invocationId = null;
- if (_shouldTrace)
- {
- _invocationId = ServiceClientTracing.NextInvocationId.ToString();
- Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("billingAccountName", billingAccountName);
- tracingParameters.Add("billingRoleDefinitionName", billingRoleDefinitionName);
- 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}/providers/Microsoft.Billing/billingRoleDefinitions/{billingRoleDefinitionName}").ToString();
- _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName));
- _url = _url.Replace("{billingRoleDefinitionName}", System.Uri.EscapeDataString(billingRoleDefinitionName));
- List _queryParameters = new List();
- if (Client.ApiVersion != null)
- {
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
- }
- if (_queryParameters.Count > 0)
- {
- _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
- }
- // Create HTTP transport objects
- var _httpRequest = new HttpRequestMessage();
- HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("GET");
- _httpRequest.RequestUri = new System.Uri(_url);
- // Set Headers
- if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
- {
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
- }
- if (Client.AcceptLanguage != null)
- {
- if (_httpRequest.Headers.Contains("accept-language"))
- {
- _httpRequest.Headers.Remove("accept-language");
- }
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
- }
-
-
- if (customHeaders != null)
- {
- foreach(var _header in customHeaders)
- {
- if (_httpRequest.Headers.Contains(_header.Key))
- {
- _httpRequest.Headers.Remove(_header.Key);
- }
- _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
- }
- }
-
- // Serialize Request
- string _requestContent = null;
- // Set Credentials
- if (Client.Credentials != null)
- {
- cancellationToken.ThrowIfCancellationRequested();
- await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- }
- // Send Request
- if (_shouldTrace)
- {
- ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
- }
- cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- if (_shouldTrace)
- {
- ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
- }
- HttpStatusCode _statusCode = _httpResponse.StatusCode;
- cancellationToken.ThrowIfCancellationRequested();
- string _responseContent = null;
- if ((int)_statusCode != 200)
- {
- var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- try
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- if (_errorBody != null)
- {
- ex.Body = _errorBody;
- }
- }
- catch (JsonException)
- {
- // Ignore the exception
- }
- ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
- if (_shouldTrace)
- {
- ServiceClientTracing.Error(_invocationId, ex);
- }
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw ex;
- }
- // Create Result
- var _result = new AzureOperationResponse();
- _result.Request = _httpRequest;
- _result.Response = _httpResponse;
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- // Deserialize Response
- if ((int)_statusCode == 200)
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- try
- {
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- }
- catch (JsonException ex)
- {
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
- }
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Exit(_invocationId, _result);
- }
- return _result;
- }
-
- ///
- /// Lists the role definition for a billing account
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// Headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when unable to deserialize the response
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// A response object containing the response body and response headers.
- ///
- public async Task> ListWithHttpMessagesAsync(string billingAccountName, 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("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}/providers/Microsoft.Billing/billingRoleDefinitions").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("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/src/SDKs/Billing/Management.Billing/Generated/BillingAccountbillingRoleDefinitionOperationsExtensions.cs b/src/SDKs/Billing/Management.Billing/Generated/BillingAccountbillingRoleDefinitionOperationsExtensions.cs
deleted file mode 100644
index 972504e8b1e8..000000000000
--- a/src/SDKs/Billing/Management.Billing/Generated/BillingAccountbillingRoleDefinitionOperationsExtensions.cs
+++ /dev/null
@@ -1,99 +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
-{
- using Microsoft.Rest;
- using Microsoft.Rest.Azure;
- using Models;
- using System.Threading;
- using System.Threading.Tasks;
-
- ///
- /// Extension methods for BillingAccountBillingRoleDefinitionOperations.
- ///
- public static partial class BillingAccountBillingRoleDefinitionOperationsExtensions
- {
- ///
- /// Gets the role definition for a role
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// role definition id.
- ///
- public static BillingRoleDefinition Get(this IBillingAccountBillingRoleDefinitionOperations operations, string billingAccountName, string billingRoleDefinitionName)
- {
- return operations.GetAsync(billingAccountName, billingRoleDefinitionName).GetAwaiter().GetResult();
- }
-
- ///
- /// Gets the role definition for a role
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// role definition id.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task GetAsync(this IBillingAccountBillingRoleDefinitionOperations operations, string billingAccountName, string billingRoleDefinitionName, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, billingRoleDefinitionName, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// Lists the role definition for a billing account
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- public static BillingRoleDefinitionListResult List(this IBillingAccountBillingRoleDefinitionOperations operations, string billingAccountName)
- {
- return operations.ListAsync(billingAccountName).GetAwaiter().GetResult();
- }
-
- ///
- /// Lists the role definition for a billing account
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task ListAsync(this IBillingAccountBillingRoleDefinitionOperations operations, string billingAccountName, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.ListWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- }
-}
diff --git a/src/SDKs/Billing/Management.Billing/Generated/BillingManagementClient.cs b/src/SDKs/Billing/Management.Billing/Generated/BillingManagementClient.cs
index 86f867bde5cf..a93d402253d4 100644
--- a/src/SDKs/Billing/Management.Billing/Generated/BillingManagementClient.cs
+++ b/src/SDKs/Billing/Management.Billing/Generated/BillingManagementClient.cs
@@ -20,8 +20,6 @@ namespace Microsoft.Azure.Management.Billing
using System.Linq;
using System.Net;
using System.Net.Http;
- using System.Threading;
- using System.Threading.Tasks;
///
/// Billing client provides access to billing resources for Azure
@@ -84,109 +82,49 @@ public partial class BillingManagementClient : ServiceClient
- /// Gets the IAvailableBalanceByBillingProfileOperations.
+ /// Gets the IAvailableBalancesOperations.
///
- public virtual IAvailableBalanceByBillingProfileOperations AvailableBalanceByBillingProfile { get; private set; }
+ public virtual IAvailableBalancesOperations AvailableBalances { get; private set; }
///
- /// Gets the IPaymentMethodsByBillingProfileOperations.
+ /// Gets the IPaymentMethodsOperations.
///
- public virtual IPaymentMethodsByBillingProfileOperations PaymentMethodsByBillingProfile { get; private set; }
-
- ///
- /// Gets the IBillingProfilesByBillingAccountNameOperations.
- ///
- public virtual IBillingProfilesByBillingAccountNameOperations BillingProfilesByBillingAccountName { get; private set; }
+ public virtual IPaymentMethodsOperations PaymentMethods { get; private set; }
///
/// Gets the IBillingProfilesOperations.
///
public virtual IBillingProfilesOperations BillingProfiles { get; private set; }
- ///
- /// Gets the IInvoiceSectionsByBillingAccountNameOperations.
- ///
- public virtual IInvoiceSectionsByBillingAccountNameOperations InvoiceSectionsByBillingAccountName { get; private set; }
-
///
/// Gets the IInvoiceSectionsOperations.
///
public virtual IInvoiceSectionsOperations InvoiceSections { get; private set; }
- ///
- /// Gets the IInvoiceSectionsWithCreateSubscriptionPermissionOperations.
- ///
- public virtual IInvoiceSectionsWithCreateSubscriptionPermissionOperations InvoiceSectionsWithCreateSubscriptionPermission { get; private set; }
-
- ///
- /// Gets the IDepartmentsByBillingAccountNameOperations.
- ///
- public virtual IDepartmentsByBillingAccountNameOperations DepartmentsByBillingAccountName { get; private set; }
-
///
/// Gets the IDepartmentsOperations.
///
public virtual IDepartmentsOperations Departments { get; private set; }
- ///
- /// Gets the IEnrollmentAccountsByBillingAccountNameOperations.
- ///
- public virtual IEnrollmentAccountsByBillingAccountNameOperations EnrollmentAccountsByBillingAccountName { get; private set; }
-
///
/// Gets the IEnrollmentAccountsOperations.
///
public virtual IEnrollmentAccountsOperations EnrollmentAccounts { get; private set; }
///
- /// Gets the IInvoicesByBillingAccountOperations.
- ///
- public virtual IInvoicesByBillingAccountOperations InvoicesByBillingAccount { get; private set; }
-
- ///
- /// Gets the IInvoicePricesheetOperations.
- ///
- public virtual IInvoicePricesheetOperations InvoicePricesheet { get; private set; }
-
- ///
- /// Gets the IInvoicesByBillingProfileOperations.
- ///
- public virtual IInvoicesByBillingProfileOperations InvoicesByBillingProfile { get; private set; }
-
- ///
- /// Gets the IInvoiceOperations.
+ /// Gets the IInvoicesOperations.
///
- public virtual IInvoiceOperations Invoice { get; private set; }
+ public virtual IInvoicesOperations Invoices { get; private set; }
///
- /// Gets the IProductsByBillingSubscriptionsOperations.
+ /// Gets the IPriceSheetOperations.
///
- public virtual IProductsByBillingSubscriptionsOperations ProductsByBillingSubscriptions { get; private set; }
+ public virtual IPriceSheetOperations PriceSheet { get; private set; }
///
- /// Gets the IBillingSubscriptionsByBillingProfileOperations.
+ /// Gets the IBillingSubscriptionsOperations.
///
- public virtual IBillingSubscriptionsByBillingProfileOperations BillingSubscriptionsByBillingProfile { get; private set; }
-
- ///
- /// Gets the IBillingSubscriptionsByInvoiceSectionOperations.
- ///
- public virtual IBillingSubscriptionsByInvoiceSectionOperations BillingSubscriptionsByInvoiceSection { get; private set; }
-
- ///
- /// Gets the IBillingSubscriptionOperations.
- ///
- public virtual IBillingSubscriptionOperations BillingSubscription { get; private set; }
-
- ///
- /// Gets the IProductsByBillingAccountOperations.
- ///
- public virtual IProductsByBillingAccountOperations ProductsByBillingAccount { get; private set; }
-
- ///
- /// Gets the IProductsByInvoiceSectionOperations.
- ///
- public virtual IProductsByInvoiceSectionOperations ProductsByInvoiceSection { get; private set; }
+ public virtual IBillingSubscriptionsOperations BillingSubscriptions { get; private set; }
///
/// Gets the IProductsOperations.
@@ -194,24 +132,14 @@ public partial class BillingManagementClient : ServiceClient
- /// Gets the ITransactionsByBillingAccountOperations.
+ /// Gets the ITransactionsOperations.
///
- public virtual ITransactionsByBillingAccountOperations TransactionsByBillingAccount { get; private set; }
+ public virtual ITransactionsOperations Transactions { get; private set; }
///
- /// Gets the ITransactionsByBillingProfileOperations.
+ /// Gets the IPoliciesOperations.
///
- public virtual ITransactionsByBillingProfileOperations TransactionsByBillingProfile { get; private set; }
-
- ///
- /// Gets the ITransactionsByInvoiceSectionOperations.
- ///
- public virtual ITransactionsByInvoiceSectionOperations TransactionsByInvoiceSection { get; private set; }
-
- ///
- /// Gets the IPolicyOperations.
- ///
- public virtual IPolicyOperations Policy { get; private set; }
+ public virtual IPoliciesOperations Policies { get; private set; }
///
/// Gets the IBillingPropertyOperations.
@@ -234,49 +162,19 @@ public partial class BillingManagementClient : ServiceClient
- /// Gets the IBillingAccountBillingPermissionsOperations.
- ///
- public virtual IBillingAccountBillingPermissionsOperations BillingAccountBillingPermissions { get; private set; }
-
- ///
- /// Gets the IInvoiceSectionsBillingPermissionsOperations.
- ///
- public virtual IInvoiceSectionsBillingPermissionsOperations InvoiceSectionsBillingPermissions { get; private set; }
-
- ///
- /// Gets the IBillingProfileBillingPermissionsOperations.
+ /// Gets the IBillingPermissionsOperations.
///
- public virtual IBillingProfileBillingPermissionsOperations BillingProfileBillingPermissions { get; private set; }
+ public virtual IBillingPermissionsOperations BillingPermissions { get; private set; }
///
- /// Gets the IBillingAccountBillingRoleDefinitionOperations.
+ /// Gets the IBillingRoleDefinitionsOperations.
///
- public virtual IBillingAccountBillingRoleDefinitionOperations BillingAccountBillingRoleDefinition { get; private set; }
+ public virtual IBillingRoleDefinitionsOperations BillingRoleDefinitions { get; private set; }
///
- /// Gets the IInvoiceSectionBillingRoleDefinitionOperations.
+ /// Gets the IBillingRoleAssignmentsOperations.
///
- public virtual IInvoiceSectionBillingRoleDefinitionOperations InvoiceSectionBillingRoleDefinition { get; private set; }
-
- ///
- /// Gets the IBillingProfileBillingRoleDefinitionOperations.
- ///
- public virtual IBillingProfileBillingRoleDefinitionOperations BillingProfileBillingRoleDefinition { get; private set; }
-
- ///
- /// Gets the IBillingAccountBillingRoleAssignmentOperations.
- ///
- public virtual IBillingAccountBillingRoleAssignmentOperations BillingAccountBillingRoleAssignment { get; private set; }
-
- ///
- /// Gets the IInvoiceSectionBillingRoleAssignmentOperations.
- ///
- public virtual IInvoiceSectionBillingRoleAssignmentOperations InvoiceSectionBillingRoleAssignment { get; private set; }
-
- ///
- /// Gets the IBillingProfileBillingRoleAssignmentOperations.
- ///
- public virtual IBillingProfileBillingRoleAssignmentOperations BillingProfileBillingRoleAssignment { get; private set; }
+ public virtual IBillingRoleAssignmentsOperations BillingRoleAssignments { get; private set; }
///
/// Gets the IAgreementsOperations.
@@ -525,45 +423,25 @@ public BillingManagementClient(System.Uri baseUri, ServiceClientCredentials cred
private void Initialize()
{
BillingAccounts = new BillingAccountsOperations(this);
- AvailableBalanceByBillingProfile = new AvailableBalanceByBillingProfileOperations(this);
- PaymentMethodsByBillingProfile = new PaymentMethodsByBillingProfileOperations(this);
- BillingProfilesByBillingAccountName = new BillingProfilesByBillingAccountNameOperations(this);
+ AvailableBalances = new AvailableBalancesOperations(this);
+ PaymentMethods = new PaymentMethodsOperations(this);
BillingProfiles = new BillingProfilesOperations(this);
- InvoiceSectionsByBillingAccountName = new InvoiceSectionsByBillingAccountNameOperations(this);
InvoiceSections = new InvoiceSectionsOperations(this);
- InvoiceSectionsWithCreateSubscriptionPermission = new InvoiceSectionsWithCreateSubscriptionPermissionOperations(this);
- DepartmentsByBillingAccountName = new DepartmentsByBillingAccountNameOperations(this);
Departments = new DepartmentsOperations(this);
- EnrollmentAccountsByBillingAccountName = new EnrollmentAccountsByBillingAccountNameOperations(this);
EnrollmentAccounts = new EnrollmentAccountsOperations(this);
- InvoicesByBillingAccount = new InvoicesByBillingAccountOperations(this);
- InvoicePricesheet = new InvoicePricesheetOperations(this);
- InvoicesByBillingProfile = new InvoicesByBillingProfileOperations(this);
- Invoice = new InvoiceOperations(this);
- ProductsByBillingSubscriptions = new ProductsByBillingSubscriptionsOperations(this);
- BillingSubscriptionsByBillingProfile = new BillingSubscriptionsByBillingProfileOperations(this);
- BillingSubscriptionsByInvoiceSection = new BillingSubscriptionsByInvoiceSectionOperations(this);
- BillingSubscription = new BillingSubscriptionOperations(this);
- ProductsByBillingAccount = new ProductsByBillingAccountOperations(this);
- ProductsByInvoiceSection = new ProductsByInvoiceSectionOperations(this);
+ Invoices = new InvoicesOperations(this);
+ PriceSheet = new PriceSheetOperations(this);
+ BillingSubscriptions = new BillingSubscriptionsOperations(this);
Products = new ProductsOperations(this);
- TransactionsByBillingAccount = new TransactionsByBillingAccountOperations(this);
- TransactionsByBillingProfile = new TransactionsByBillingProfileOperations(this);
- TransactionsByInvoiceSection = new TransactionsByInvoiceSectionOperations(this);
- Policy = new PolicyOperations(this);
+ Transactions = new TransactionsOperations(this);
+ Policies = new PoliciesOperations(this);
BillingProperty = new BillingPropertyOperations(this);
Transfers = new TransfersOperations(this);
RecipientTransfers = new RecipientTransfersOperations(this);
Operations = new Operations(this);
- BillingAccountBillingPermissions = new BillingAccountBillingPermissionsOperations(this);
- InvoiceSectionsBillingPermissions = new InvoiceSectionsBillingPermissionsOperations(this);
- BillingProfileBillingPermissions = new BillingProfileBillingPermissionsOperations(this);
- BillingAccountBillingRoleDefinition = new BillingAccountBillingRoleDefinitionOperations(this);
- InvoiceSectionBillingRoleDefinition = new InvoiceSectionBillingRoleDefinitionOperations(this);
- BillingProfileBillingRoleDefinition = new BillingProfileBillingRoleDefinitionOperations(this);
- BillingAccountBillingRoleAssignment = new BillingAccountBillingRoleAssignmentOperations(this);
- InvoiceSectionBillingRoleAssignment = new InvoiceSectionBillingRoleAssignmentOperations(this);
- BillingProfileBillingRoleAssignment = new BillingProfileBillingRoleAssignmentOperations(this);
+ BillingPermissions = new BillingPermissionsOperations(this);
+ BillingRoleDefinitions = new BillingRoleDefinitionsOperations(this);
+ BillingRoleAssignments = new BillingRoleAssignmentsOperations(this);
Agreements = new AgreementsOperations(this);
BaseUri = new System.Uri("https://management.azure.com");
ApiVersion = "2018-11-01-preview";
@@ -600,414 +478,5 @@ private void Initialize()
DeserializationSettings.Converters.Add(new TransformationJsonConverter());
DeserializationSettings.Converters.Add(new CloudErrorJsonConverter());
}
- ///
- /// Cancel product by product id
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// Invoice Id.
- ///
- ///
- /// Update auto renew request parameters.
- ///
- ///
- /// 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> UpdateAutoRenewForBillingAccountWithHttpMessagesAsync(string billingAccountName, string productName, UpdateAutoRenewRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- if (billingAccountName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName");
- }
- if (productName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "productName");
- }
- if (ApiVersion == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.ApiVersion");
- }
- if (body == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "body");
- }
- // Tracing
- bool _shouldTrace = ServiceClientTracing.IsEnabled;
- string _invocationId = null;
- if (_shouldTrace)
- {
- _invocationId = ServiceClientTracing.NextInvocationId.ToString();
- Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("billingAccountName", billingAccountName);
- tracingParameters.Add("productName", productName);
- tracingParameters.Add("body", body);
- tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "UpdateAutoRenewForBillingAccount", tracingParameters);
- }
- // Construct URL
- var _baseUrl = BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}/updateAutoRenew").ToString();
- _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName));
- _url = _url.Replace("{productName}", System.Uri.EscapeDataString(productName));
- List _queryParameters = new List();
- if (ApiVersion != null)
- {
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 (GenerateClientRequestId != null && GenerateClientRequestId.Value)
- {
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
- }
- if (AcceptLanguage != null)
- {
- if (_httpRequest.Headers.Contains("accept-language"))
- {
- _httpRequest.Headers.Remove("accept-language");
- }
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", 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(body != null)
- {
- _requestContent = SafeJsonConvert.SerializeObject(body, 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 (Credentials != null)
- {
- cancellationToken.ThrowIfCancellationRequested();
- await Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- }
- // Send Request
- if (_shouldTrace)
- {
- ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
- }
- cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await 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 = SafeJsonConvert.DeserializeObject(_responseContent, 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 = SafeJsonConvert.DeserializeObject(_responseContent, 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
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// InvoiceSection Id.
- ///
- ///
- /// Invoice Id.
- ///
- ///
- /// Update auto renew request parameters.
- ///
- ///
- /// 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> UpdateAutoRenewForInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string productName, UpdateAutoRenewRequest body, 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 (productName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "productName");
- }
- if (ApiVersion == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.ApiVersion");
- }
- if (body == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "body");
- }
- // 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("productName", productName);
- tracingParameters.Add("body", body);
- tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "UpdateAutoRenewForInvoiceSection", tracingParameters);
- }
- // Construct URL
- var _baseUrl = BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/products/{productName}/updateAutoRenew").ToString();
- _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName));
- _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName));
- _url = _url.Replace("{productName}", System.Uri.EscapeDataString(productName));
- List _queryParameters = new List();
- if (ApiVersion != null)
- {
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 (GenerateClientRequestId != null && GenerateClientRequestId.Value)
- {
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
- }
- if (AcceptLanguage != null)
- {
- if (_httpRequest.Headers.Contains("accept-language"))
- {
- _httpRequest.Headers.Remove("accept-language");
- }
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", 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(body != null)
- {
- _requestContent = SafeJsonConvert.SerializeObject(body, 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 (Credentials != null)
- {
- cancellationToken.ThrowIfCancellationRequested();
- await Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- }
- // Send Request
- if (_shouldTrace)
- {
- ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
- }
- cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await 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 = SafeJsonConvert.DeserializeObject(_responseContent, 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 = SafeJsonConvert.DeserializeObject(_responseContent, 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/src/SDKs/Billing/Management.Billing/Generated/BillingManagementClientExtensions.cs b/src/SDKs/Billing/Management.Billing/Generated/BillingManagementClientExtensions.cs
deleted file mode 100644
index a2fd45941a5a..000000000000
--- a/src/SDKs/Billing/Management.Billing/Generated/BillingManagementClientExtensions.cs
+++ /dev/null
@@ -1,123 +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
-{
- using Microsoft.Rest;
- using Microsoft.Rest.Azure;
- using Models;
- using System.Threading;
- using System.Threading.Tasks;
-
- ///
- /// Extension methods for BillingManagementClient.
- ///
- public static partial class BillingManagementClientExtensions
- {
- ///
- /// Cancel product by product id
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// Invoice Id.
- ///
- ///
- /// Update auto renew request parameters.
- ///
- public static UpdateAutoRenewOperationSummary UpdateAutoRenewForBillingAccount(this IBillingManagementClient operations, string billingAccountName, string productName, UpdateAutoRenewRequest body)
- {
- return operations.UpdateAutoRenewForBillingAccountAsync(billingAccountName, productName, body).GetAwaiter().GetResult();
- }
-
- ///
- /// Cancel product by product id
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// Invoice Id.
- ///
- ///
- /// Update auto renew request parameters.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task UpdateAutoRenewForBillingAccountAsync(this IBillingManagementClient operations, string billingAccountName, string productName, UpdateAutoRenewRequest body, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.UpdateAutoRenewForBillingAccountWithHttpMessagesAsync(billingAccountName, productName, body, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// Cancel auto renew for product by product id
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// InvoiceSection Id.
- ///
- ///
- /// Invoice Id.
- ///
- ///
- /// Update auto renew request parameters.
- ///
- public static UpdateAutoRenewOperationSummary UpdateAutoRenewForInvoiceSection(this IBillingManagementClient operations, string billingAccountName, string invoiceSectionName, string productName, UpdateAutoRenewRequest body)
- {
- return operations.UpdateAutoRenewForInvoiceSectionAsync(billingAccountName, invoiceSectionName, productName, body).GetAwaiter().GetResult();
- }
-
- ///
- /// Cancel auto renew for product by product id
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// InvoiceSection Id.
- ///
- ///
- /// Invoice Id.
- ///
- ///
- /// Update auto renew request parameters.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task UpdateAutoRenewForInvoiceSectionAsync(this IBillingManagementClient operations, string billingAccountName, string invoiceSectionName, string productName, UpdateAutoRenewRequest body, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.UpdateAutoRenewForInvoiceSectionWithHttpMessagesAsync(billingAccountName, invoiceSectionName, productName, body, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- }
-}
diff --git a/src/SDKs/Billing/Management.Billing/Generated/InvoiceSectionbillingRoleAssignmentOperations.cs b/src/SDKs/Billing/Management.Billing/Generated/BillingPermissionsOperations.cs
similarity index 64%
rename from src/SDKs/Billing/Management.Billing/Generated/InvoiceSectionbillingRoleAssignmentOperations.cs
rename to src/SDKs/Billing/Management.Billing/Generated/BillingPermissionsOperations.cs
index 06b8c11c1bfd..1018381b8005 100644
--- a/src/SDKs/Billing/Management.Billing/Generated/InvoiceSectionbillingRoleAssignmentOperations.cs
+++ b/src/SDKs/Billing/Management.Billing/Generated/BillingPermissionsOperations.cs
@@ -23,12 +23,12 @@ namespace Microsoft.Azure.Management.Billing
using System.Threading.Tasks;
///
- /// InvoiceSectionBillingRoleAssignmentOperations operations.
+ /// BillingPermissionsOperations operations.
///
- internal partial class InvoiceSectionBillingRoleAssignmentOperations : IServiceOperations, IInvoiceSectionBillingRoleAssignmentOperations
+ internal partial class BillingPermissionsOperations : IServiceOperations, IBillingPermissionsOperations
{
///
- /// Initializes a new instance of the InvoiceSectionBillingRoleAssignmentOperations class.
+ /// Initializes a new instance of the BillingPermissionsOperations class.
///
///
/// Reference to the service client.
@@ -36,7 +36,7 @@ internal partial class InvoiceSectionBillingRoleAssignmentOperations : IServiceO
///
/// Thrown when a required parameter is null
///
- internal InvoiceSectionBillingRoleAssignmentOperations(BillingManagementClient client)
+ internal BillingPermissionsOperations(BillingManagementClient client)
{
if (client == null)
{
@@ -51,17 +51,11 @@ internal InvoiceSectionBillingRoleAssignmentOperations(BillingManagementClient c
public BillingManagementClient Client { get; private set; }
///
- /// Get the role assignment for the caller on the invoice Section
+ /// Lists all billing permissions for the caller under a billing account.
///
///
/// billing Account Id.
///
- ///
- /// InvoiceSection Id.
- ///
- ///
- /// role assignment id.
- ///
///
/// Headers that will be added to request.
///
@@ -83,7 +77,7 @@ internal InvoiceSectionBillingRoleAssignmentOperations(BillingManagementClient c
///
/// A response object containing the response body and response headers.
///
- public async Task> GetWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (Client.ApiVersion == null)
{
@@ -93,14 +87,6 @@ internal InvoiceSectionBillingRoleAssignmentOperations(BillingManagementClient c
{
throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName");
}
- if (invoiceSectionName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName");
- }
- if (billingRoleAssignmentName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "billingRoleAssignmentName");
- }
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -109,17 +95,13 @@ internal InvoiceSectionBillingRoleAssignmentOperations(BillingManagementClient c
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("billingAccountName", billingAccountName);
- tracingParameters.Add("invoiceSectionName", invoiceSectionName);
- tracingParameters.Add("billingRoleAssignmentName", billingRoleAssignmentName);
tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "Get", 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}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}").ToString();
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingPermissions").ToString();
_url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName));
- _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName));
- _url = _url.Replace("{billingRoleAssignmentName}", System.Uri.EscapeDataString(billingRoleAssignmentName));
List _queryParameters = new List();
if (Client.ApiVersion != null)
{
@@ -213,7 +195,7 @@ internal InvoiceSectionBillingRoleAssignmentOperations(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"))
@@ -226,7 +208,7 @@ internal InvoiceSectionBillingRoleAssignmentOperations(BillingManagementClient c
_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)
{
@@ -246,7 +228,7 @@ internal InvoiceSectionBillingRoleAssignmentOperations(BillingManagementClient c
}
///
- /// Delete the role assignment on this invoice Section
+ /// Lists all billing permissions for the caller under invoice section.
///
///
/// billing Account Id.
@@ -254,9 +236,6 @@ internal InvoiceSectionBillingRoleAssignmentOperations(BillingManagementClient c
///
/// InvoiceSection Id.
///
- ///
- /// role assignment id.
- ///
///
/// Headers that will be added to request.
///
@@ -278,7 +257,7 @@ internal InvoiceSectionBillingRoleAssignmentOperations(BillingManagementClient c
///
/// A response object containing the response body and response headers.
///
- public async Task> DeleteWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string billingRoleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> ListByInvoiceSectionsWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (Client.ApiVersion == null)
{
@@ -292,10 +271,6 @@ internal InvoiceSectionBillingRoleAssignmentOperations(BillingManagementClient c
{
throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName");
}
- if (billingRoleAssignmentName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "billingRoleAssignmentName");
- }
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -305,16 +280,14 @@ internal InvoiceSectionBillingRoleAssignmentOperations(BillingManagementClient c
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("billingAccountName", billingAccountName);
tracingParameters.Add("invoiceSectionName", invoiceSectionName);
- tracingParameters.Add("billingRoleAssignmentName", billingRoleAssignmentName);
tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters);
+ 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/billingRoleAssignments/{billingRoleAssignmentName}").ToString();
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingPermissions").ToString();
_url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName));
_url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName));
- _url = _url.Replace("{billingRoleAssignmentName}", System.Uri.EscapeDataString(billingRoleAssignmentName));
List _queryParameters = new List();
if (Client.ApiVersion != null)
{
@@ -327,7 +300,7 @@ internal InvoiceSectionBillingRoleAssignmentOperations(BillingManagementClient c
// Create HTTP transport objects
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("DELETE");
+ _httpRequest.Method = new HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
@@ -408,7 +381,7 @@ internal InvoiceSectionBillingRoleAssignmentOperations(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"))
@@ -421,7 +394,7 @@ internal InvoiceSectionBillingRoleAssignmentOperations(BillingManagementClient c
_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)
{
@@ -441,13 +414,13 @@ internal InvoiceSectionBillingRoleAssignmentOperations(BillingManagementClient c
}
///
- /// Get the role assignments on the invoice Section
+ /// Lists all billingPermissions for the caller has for a billing account.
///
///
/// billing Account Id.
///
- ///
- /// InvoiceSection Id.
+ ///
+ /// Billing Profile Id.
///
///
/// Headers that will be added to request.
@@ -470,7 +443,7 @@ internal InvoiceSectionBillingRoleAssignmentOperations(BillingManagementClient c
///
/// 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> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (Client.ApiVersion == null)
{
@@ -480,9 +453,9 @@ internal InvoiceSectionBillingRoleAssignmentOperations(BillingManagementClient c
{
throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName");
}
- if (invoiceSectionName == null)
+ if (billingProfileName == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName");
+ throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName");
}
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
@@ -492,15 +465,15 @@ internal InvoiceSectionBillingRoleAssignmentOperations(BillingManagementClient c
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("billingAccountName", billingAccountName);
- tracingParameters.Add("invoiceSectionName", invoiceSectionName);
+ tracingParameters.Add("billingProfileName", billingProfileName);
tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "List", 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}/providers/Microsoft.Billing/billingRoleAssignments").ToString();
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingPermissions").ToString();
_url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName));
- _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName));
+ _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName));
List _queryParameters = new List();
if (Client.ApiVersion != null)
{
@@ -594,7 +567,7 @@ internal InvoiceSectionBillingRoleAssignmentOperations(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"))
@@ -607,201 +580,7 @@ internal InvoiceSectionBillingRoleAssignmentOperations(BillingManagementClient c
_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 add a role assignment to a invoice Section.
- ///
- ///
- /// 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 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> AddWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, 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");
- }
- BillingRoleAssignmentPayload parameters = new BillingRoleAssignmentPayload();
- // 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("parameters", parameters);
- tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "Add", 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();
- _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 (_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 != 201)
- {
- 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 == 201)
- {
- _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/src/SDKs/Billing/Management.Billing/Generated/BillingPermissionsOperationsExtensions.cs b/src/SDKs/Billing/Management.Billing/Generated/BillingPermissionsOperationsExtensions.cs
new file mode 100644
index 000000000000..a6b04a53d5e7
--- /dev/null
+++ b/src/SDKs/Billing/Management.Billing/Generated/BillingPermissionsOperationsExtensions.cs
@@ -0,0 +1,139 @@
+//
+// 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 BillingPermissionsOperations.
+ ///
+ public static partial class BillingPermissionsOperationsExtensions
+ {
+ ///
+ /// Lists all billing permissions for the caller under a billing account.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ public static BillingPermissionsListResult ListByBillingAccount(this IBillingPermissionsOperations operations, string billingAccountName)
+ {
+ return operations.ListByBillingAccountAsync(billingAccountName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Lists all billing permissions for the caller under a billing account.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task ListByBillingAccountAsync(this IBillingPermissionsOperations operations, string billingAccountName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Lists all billing permissions for the caller under invoice section.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// InvoiceSection Id.
+ ///
+ public static BillingPermissionsListResult ListByInvoiceSections(this IBillingPermissionsOperations operations, string billingAccountName, string invoiceSectionName)
+ {
+ return operations.ListByInvoiceSectionsAsync(billingAccountName, invoiceSectionName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Lists all billing permissions for the caller under invoice section.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// InvoiceSection Id.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task ListByInvoiceSectionsAsync(this IBillingPermissionsOperations operations, string billingAccountName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListByInvoiceSectionsWithHttpMessagesAsync(billingAccountName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Lists all billingPermissions for the caller has for a billing account.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// Billing Profile Id.
+ ///
+ public static BillingPermissionsListResult ListByBillingProfile(this IBillingPermissionsOperations operations, string billingAccountName, string billingProfileName)
+ {
+ return operations.ListByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Lists all billingPermissions for the caller has for a billing account.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// Billing Profile Id.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task ListByBillingProfileAsync(this IBillingPermissionsOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ }
+}
diff --git a/src/SDKs/Billing/Management.Billing/Generated/BillingProfilebillingPermissionsOperations.cs b/src/SDKs/Billing/Management.Billing/Generated/BillingProfilebillingPermissionsOperations.cs
deleted file mode 100644
index 4c69b8c7dba1..000000000000
--- a/src/SDKs/Billing/Management.Billing/Generated/BillingProfilebillingPermissionsOperations.cs
+++ /dev/null
@@ -1,240 +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
-{
- 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;
-
- ///
- /// BillingProfileBillingPermissionsOperations operations.
- ///
- internal partial class BillingProfileBillingPermissionsOperations : IServiceOperations, IBillingProfileBillingPermissionsOperations
- {
- ///
- /// Initializes a new instance of the BillingProfileBillingPermissionsOperations class.
- ///
- ///
- /// Reference to the service client.
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- internal BillingProfileBillingPermissionsOperations(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 billingPermissions for the caller has for a billing account.
- ///
- ///
- /// 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> ListWithHttpMessagesAsync(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, "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}/providers/Microsoft.Billing/billingPermissions").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;
- }
-
- }
-}
diff --git a/src/SDKs/Billing/Management.Billing/Generated/BillingProfilebillingPermissionsOperationsExtensions.cs b/src/SDKs/Billing/Management.Billing/Generated/BillingProfilebillingPermissionsOperationsExtensions.cs
deleted file mode 100644
index e3a61bd24fc4..000000000000
--- a/src/SDKs/Billing/Management.Billing/Generated/BillingProfilebillingPermissionsOperationsExtensions.cs
+++ /dev/null
@@ -1,65 +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
-{
- using Microsoft.Rest;
- using Microsoft.Rest.Azure;
- using Models;
- using System.Threading;
- using System.Threading.Tasks;
-
- ///
- /// Extension methods for BillingProfileBillingPermissionsOperations.
- ///
- public static partial class BillingProfileBillingPermissionsOperationsExtensions
- {
- ///
- /// Lists all billingPermissions for the caller has for a billing account.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// Billing Profile Id.
- ///
- public static BillingPermissionsListResult List(this IBillingProfileBillingPermissionsOperations operations, string billingAccountName, string billingProfileName)
- {
- return operations.ListAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult();
- }
-
- ///
- /// Lists all billingPermissions for the caller has for a billing account.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// Billing Profile Id.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task ListAsync(this IBillingProfileBillingPermissionsOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.ListWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- }
-}
diff --git a/src/SDKs/Billing/Management.Billing/Generated/BillingProfilebillingRoleAssignmentOperationsExtensions.cs b/src/SDKs/Billing/Management.Billing/Generated/BillingProfilebillingRoleAssignmentOperationsExtensions.cs
deleted file mode 100644
index fa423fd5851b..000000000000
--- a/src/SDKs/Billing/Management.Billing/Generated/BillingProfilebillingRoleAssignmentOperationsExtensions.cs
+++ /dev/null
@@ -1,197 +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
-{
- using Microsoft.Rest;
- using Microsoft.Rest.Azure;
- using Models;
- using System.Threading;
- using System.Threading.Tasks;
-
- ///
- /// Extension methods for BillingProfileBillingRoleAssignmentOperations.
- ///
- public static partial class BillingProfileBillingRoleAssignmentOperationsExtensions
- {
- ///
- /// Get the role assignment for the caller on the Billing Profile
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// Billing Profile Id.
- ///
- ///
- /// role assignment id.
- ///
- public static BillingRoleAssignment Get(this IBillingProfileBillingRoleAssignmentOperations operations, string billingAccountName, string billingProfileName, string billingRoleAssignmentName)
- {
- return operations.GetAsync(billingAccountName, billingProfileName, billingRoleAssignmentName).GetAwaiter().GetResult();
- }
-
- ///
- /// Get the role assignment for the caller on the Billing Profile
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// Billing Profile Id.
- ///
- ///
- /// role assignment id.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task GetAsync(this IBillingProfileBillingRoleAssignmentOperations operations, string billingAccountName, string billingProfileName, string billingRoleAssignmentName, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, billingProfileName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// Delete the role assignment on this Billing Profile
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// Billing Profile Id.
- ///
- ///
- /// role assignment id.
- ///
- public static BillingRoleAssignment Delete(this IBillingProfileBillingRoleAssignmentOperations operations, string billingAccountName, string billingProfileName, string billingRoleAssignmentName)
- {
- return operations.DeleteAsync(billingAccountName, billingProfileName, billingRoleAssignmentName).GetAwaiter().GetResult();
- }
-
- ///
- /// Delete the role assignment on this Billing Profile
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// Billing Profile Id.
- ///
- ///
- /// role assignment id.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task DeleteAsync(this IBillingProfileBillingRoleAssignmentOperations operations, string billingAccountName, string billingProfileName, string billingRoleAssignmentName, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.DeleteWithHttpMessagesAsync(billingAccountName, billingProfileName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// Get the role assignments on the Billing Profile
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// Billing Profile Id.
- ///
- public static BillingRoleAssignmentListResult List(this IBillingProfileBillingRoleAssignmentOperations operations, string billingAccountName, string billingProfileName)
- {
- return operations.ListAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult();
- }
-
- ///
- /// Get the role assignments on the Billing Profile
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// Billing Profile Id.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task ListAsync(this IBillingProfileBillingRoleAssignmentOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.ListWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// The operation to add a role assignment to a billing profile.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// Billing Profile Id.
- ///
- public static BillingRoleAssignmentListResult Add(this IBillingProfileBillingRoleAssignmentOperations operations, string billingAccountName, string billingProfileName)
- {
- return operations.AddAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult();
- }
-
- ///
- /// The operation to add a role assignment to a billing profile.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// Billing Profile Id.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task AddAsync(this IBillingProfileBillingRoleAssignmentOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.AddWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- }
-}
diff --git a/src/SDKs/Billing/Management.Billing/Generated/BillingProfilebillingRoleDefinitionOperations.cs b/src/SDKs/Billing/Management.Billing/Generated/BillingProfilebillingRoleDefinitionOperations.cs
deleted file mode 100644
index e8618415b33c..000000000000
--- a/src/SDKs/Billing/Management.Billing/Generated/BillingProfilebillingRoleDefinitionOperations.cs
+++ /dev/null
@@ -1,435 +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
-{
- 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;
-
- ///
- /// BillingProfileBillingRoleDefinitionOperations operations.
- ///
- internal partial class BillingProfileBillingRoleDefinitionOperations : IServiceOperations, IBillingProfileBillingRoleDefinitionOperations
- {
- ///
- /// Initializes a new instance of the BillingProfileBillingRoleDefinitionOperations class.
- ///
- ///
- /// Reference to the service client.
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- internal BillingProfileBillingRoleDefinitionOperations(BillingManagementClient client)
- {
- if (client == null)
- {
- throw new System.ArgumentNullException("client");
- }
- Client = client;
- }
-
- ///
- /// Gets a reference to the BillingManagementClient
- ///
- public BillingManagementClient Client { get; private set; }
-
- ///
- /// Gets the role definition for a role
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// Billing Profile Id.
- ///
- ///
- /// role definition 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 billingRoleDefinitionName, 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 (billingRoleDefinitionName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "billingRoleDefinitionName");
- }
- // 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("billingRoleDefinitionName", billingRoleDefinitionName);
- 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}/providers/Microsoft.Billing/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));
- List _queryParameters = new List();
- if (Client.ApiVersion != null)
- {
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
- }
- if (_queryParameters.Count > 0)
- {
- _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
- }
- // Create HTTP transport objects
- var _httpRequest = new HttpRequestMessage();
- HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("GET");
- _httpRequest.RequestUri = new System.Uri(_url);
- // Set Headers
- if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
- {
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
- }
- if (Client.AcceptLanguage != null)
- {
- if (_httpRequest.Headers.Contains("accept-language"))
- {
- _httpRequest.Headers.Remove("accept-language");
- }
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
- }
-
-
- if (customHeaders != null)
- {
- foreach(var _header in customHeaders)
- {
- if (_httpRequest.Headers.Contains(_header.Key))
- {
- _httpRequest.Headers.Remove(_header.Key);
- }
- _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
- }
- }
-
- // Serialize Request
- string _requestContent = null;
- // Set Credentials
- if (Client.Credentials != null)
- {
- cancellationToken.ThrowIfCancellationRequested();
- await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- }
- // Send Request
- if (_shouldTrace)
- {
- ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
- }
- cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- if (_shouldTrace)
- {
- ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
- }
- HttpStatusCode _statusCode = _httpResponse.StatusCode;
- cancellationToken.ThrowIfCancellationRequested();
- string _responseContent = null;
- if ((int)_statusCode != 200)
- {
- var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- try
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- if (_errorBody != null)
- {
- ex.Body = _errorBody;
- }
- }
- catch (JsonException)
- {
- // Ignore the exception
- }
- ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
- if (_shouldTrace)
- {
- ServiceClientTracing.Error(_invocationId, ex);
- }
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw ex;
- }
- // Create Result
- var _result = new AzureOperationResponse();
- _result.Request = _httpRequest;
- _result.Response = _httpResponse;
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- // Deserialize Response
- if ((int)_statusCode == 200)
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- try
- {
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- }
- catch (JsonException ex)
- {
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
- }
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Exit(_invocationId, _result);
- }
- return _result;
- }
-
- ///
- /// Lists the role definition 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> ListWithHttpMessagesAsync(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, "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}/providers/Microsoft.Billing/billingRoleDefinitions").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;
- }
-
- }
-}
diff --git a/src/SDKs/Billing/Management.Billing/Generated/BillingProfilebillingRoleDefinitionOperationsExtensions.cs b/src/SDKs/Billing/Management.Billing/Generated/BillingProfilebillingRoleDefinitionOperationsExtensions.cs
deleted file mode 100644
index 7fddfc1defe2..000000000000
--- a/src/SDKs/Billing/Management.Billing/Generated/BillingProfilebillingRoleDefinitionOperationsExtensions.cs
+++ /dev/null
@@ -1,111 +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
-{
- using Microsoft.Rest;
- using Microsoft.Rest.Azure;
- using Models;
- using System.Threading;
- using System.Threading.Tasks;
-
- ///
- /// Extension methods for BillingProfileBillingRoleDefinitionOperations.
- ///
- public static partial class BillingProfileBillingRoleDefinitionOperationsExtensions
- {
- ///
- /// Gets the role definition for a role
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// Billing Profile Id.
- ///
- ///
- /// role definition id.
- ///
- public static BillingRoleDefinition Get(this IBillingProfileBillingRoleDefinitionOperations operations, string billingAccountName, string billingProfileName, string billingRoleDefinitionName)
- {
- return operations.GetAsync(billingAccountName, billingProfileName, billingRoleDefinitionName).GetAwaiter().GetResult();
- }
-
- ///
- /// Gets the role definition for a role
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// Billing Profile Id.
- ///
- ///
- /// role definition id.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task GetAsync(this IBillingProfileBillingRoleDefinitionOperations operations, string billingAccountName, string billingProfileName, string billingRoleDefinitionName, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, billingProfileName, billingRoleDefinitionName, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// Lists the role definition for a Billing Profile
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// Billing Profile Id.
- ///
- public static BillingRoleDefinitionListResult List(this IBillingProfileBillingRoleDefinitionOperations operations, string billingAccountName, string billingProfileName)
- {
- return operations.ListAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult();
- }
-
- ///
- /// Lists the role definition for a Billing Profile
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// Billing Profile Id.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task ListAsync(this IBillingProfileBillingRoleDefinitionOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.ListWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- }
-}
diff --git a/src/SDKs/Billing/Management.Billing/Generated/BillingProfilesByBillingAccountNameOperations.cs b/src/SDKs/Billing/Management.Billing/Generated/BillingProfilesByBillingAccountNameOperations.cs
deleted file mode 100644
index cf82722d2b9c..000000000000
--- a/src/SDKs/Billing/Management.Billing/Generated/BillingProfilesByBillingAccountNameOperations.cs
+++ /dev/null
@@ -1,239 +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
-{
- 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;
-
- ///
- /// BillingProfilesByBillingAccountNameOperations operations.
- ///
- internal partial class BillingProfilesByBillingAccountNameOperations : IServiceOperations, IBillingProfilesByBillingAccountNameOperations
- {
- ///
- /// Initializes a new instance of the BillingProfilesByBillingAccountNameOperations class.
- ///
- ///
- /// Reference to the service client.
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- internal BillingProfilesByBillingAccountNameOperations(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 billing profiles for a user which that user has access to.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// May be used to expand the invoiceSections.
- ///
- ///
- /// 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 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, "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").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;
- }
-
- }
-}
diff --git a/src/SDKs/Billing/Management.Billing/Generated/BillingProfilesByBillingAccountNameOperationsExtensions.cs b/src/SDKs/Billing/Management.Billing/Generated/BillingProfilesByBillingAccountNameOperationsExtensions.cs
deleted file mode 100644
index 64e0e2b630c6..000000000000
--- a/src/SDKs/Billing/Management.Billing/Generated/BillingProfilesByBillingAccountNameOperationsExtensions.cs
+++ /dev/null
@@ -1,65 +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
-{
- using Microsoft.Rest;
- using Microsoft.Rest.Azure;
- using Models;
- using System.Threading;
- using System.Threading.Tasks;
-
- ///
- /// Extension methods for BillingProfilesByBillingAccountNameOperations.
- ///
- public static partial class BillingProfilesByBillingAccountNameOperationsExtensions
- {
- ///
- /// Lists all billing profiles for a user which that user has access to.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// May be used to expand the invoiceSections.
- ///
- public static BillingProfileListResult List(this IBillingProfilesByBillingAccountNameOperations operations, string billingAccountName, string expand = default(string))
- {
- return operations.ListAsync(billingAccountName, expand).GetAwaiter().GetResult();
- }
-
- ///
- /// Lists all billing profiles for a user which that user has access to.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// May be used to expand the invoiceSections.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task ListAsync(this IBillingProfilesByBillingAccountNameOperations operations, string billingAccountName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.ListWithHttpMessagesAsync(billingAccountName, expand, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- }
-}
diff --git a/src/SDKs/Billing/Management.Billing/Generated/BillingProfilesOperations.cs b/src/SDKs/Billing/Management.Billing/Generated/BillingProfilesOperations.cs
index 5c719c9629ed..9eece86c0e50 100644
--- a/src/SDKs/Billing/Management.Billing/Generated/BillingProfilesOperations.cs
+++ b/src/SDKs/Billing/Management.Billing/Generated/BillingProfilesOperations.cs
@@ -50,6 +50,191 @@ internal BillingProfilesOperations(BillingManagementClient client)
///
public BillingManagementClient Client { get; private set; }
+ ///
+ /// Lists all billing profiles for a user which that user has access to.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// May be used to expand the invoiceSections.
+ ///
+ ///
+ /// 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}/billingProfiles").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;
+ }
+
///
/// Get the billing profile by id.
///
diff --git a/src/SDKs/Billing/Management.Billing/Generated/BillingProfilesOperationsExtensions.cs b/src/SDKs/Billing/Management.Billing/Generated/BillingProfilesOperationsExtensions.cs
index 3ebf8ff7a90f..7d9e353cfb46 100644
--- a/src/SDKs/Billing/Management.Billing/Generated/BillingProfilesOperationsExtensions.cs
+++ b/src/SDKs/Billing/Management.Billing/Generated/BillingProfilesOperationsExtensions.cs
@@ -21,6 +21,46 @@ namespace Microsoft.Azure.Management.Billing
///
public static partial class BillingProfilesOperationsExtensions
{
+ ///
+ /// Lists all billing profiles for a user which that user has access to.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// May be used to expand the invoiceSections.
+ ///
+ public static BillingProfileListResult ListByBillingAccountName(this IBillingProfilesOperations operations, string billingAccountName, string expand = default(string))
+ {
+ return operations.ListByBillingAccountNameAsync(billingAccountName, expand).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Lists all billing profiles for a user which that user has access to.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// May be used to expand the invoiceSections.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task ListByBillingAccountNameAsync(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))
+ {
+ return _result.Body;
+ }
+ }
+
///
/// Get the billing profile by id.
///
diff --git a/src/SDKs/Billing/Management.Billing/Generated/BillingRoleAssignmentsOperations.cs b/src/SDKs/Billing/Management.Billing/Generated/BillingRoleAssignmentsOperations.cs
new file mode 100644
index 000000000000..ad2df2ce0444
--- /dev/null
+++ b/src/SDKs/Billing/Management.Billing/Generated/BillingRoleAssignmentsOperations.cs
@@ -0,0 +1,2328 @@
+//
+// 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;
+
+ ///
+ /// BillingRoleAssignmentsOperations operations.
+ ///
+ internal partial class BillingRoleAssignmentsOperations : IServiceOperations, IBillingRoleAssignmentsOperations
+ {
+ ///
+ /// Initializes a new instance of the BillingRoleAssignmentsOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal BillingRoleAssignmentsOperations(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 role assignment for the caller
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// role assignment 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> GetByBillingAccountWithHttpMessagesAsync(string billingAccountName, string billingRoleAssignmentName, 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 (billingRoleAssignmentName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "billingRoleAssignmentName");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("billingAccountName", billingAccountName);
+ tracingParameters.Add("billingRoleAssignmentName", billingRoleAssignmentName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ 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/billingRoleAssignments/{billingRoleAssignmentName}").ToString();
+ _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName));
+ _url = _url.Replace("{billingRoleAssignmentName}", System.Uri.EscapeDataString(billingRoleAssignmentName));
+ 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;
+ }
+
+ ///
+ /// Delete the role assignment on this billing account
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// role assignment 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> DeleteByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, string billingRoleAssignmentName, 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 (billingRoleAssignmentName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "billingRoleAssignmentName");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("billingAccountName", billingAccountName);
+ tracingParameters.Add("billingRoleAssignmentName", billingRoleAssignmentName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "DeleteByBillingAccountName", 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();
+ _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName));
+ _url = _url.Replace("{billingRoleAssignmentName}", System.Uri.EscapeDataString(billingRoleAssignmentName));
+ 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("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;
+ }
+
+ ///
+ /// Get the role assignment for the caller on the invoice Section
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// InvoiceSection Id.
+ ///
+ ///
+ /// role assignment 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> GetByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string billingRoleAssignmentName, 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");
+ }
+ if (billingRoleAssignmentName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "billingRoleAssignmentName");
+ }
+ // 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("billingRoleAssignmentName", billingRoleAssignmentName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "GetByInvoiceSectionName", 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();
+ _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName));
+ _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName));
+ _url = _url.Replace("{billingRoleAssignmentName}", System.Uri.EscapeDataString(billingRoleAssignmentName));
+ 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;
+ }
+
+ ///
+ /// Delete the role assignment on the invoice Section
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// InvoiceSection Id.
+ ///
+ ///
+ /// role assignment 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> DeleteByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string billingRoleAssignmentName, 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");
+ }
+ if (billingRoleAssignmentName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "billingRoleAssignmentName");
+ }
+ // 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("billingRoleAssignmentName", billingRoleAssignmentName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "DeleteByInvoiceSectionName", 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();
+ _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName));
+ _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName));
+ _url = _url.Replace("{billingRoleAssignmentName}", System.Uri.EscapeDataString(billingRoleAssignmentName));
+ 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("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;
+ }
+
+ ///
+ /// Get the role assignment for the caller on the Billing Profile
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// Billing Profile Id.
+ ///
+ ///
+ /// role assignment 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> GetByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, 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 (billingRoleAssignmentName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "billingRoleAssignmentName");
+ }
+ // 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("billingRoleAssignmentName", billingRoleAssignmentName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "GetByBillingProfileName", 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();
+ _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName));
+ _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName));
+ _url = _url.Replace("{billingRoleAssignmentName}", System.Uri.EscapeDataString(billingRoleAssignmentName));
+ 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;
+ }
+
+ ///
+ /// Delete the role assignment on this Billing Profile
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// Billing Profile Id.
+ ///
+ ///
+ /// role assignment 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> DeleteByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, 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 (billingRoleAssignmentName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "billingRoleAssignmentName");
+ }
+ // 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("billingRoleAssignmentName", billingRoleAssignmentName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "DeleteByBillingProfileName", 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();
+ _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName));
+ _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName));
+ _url = _url.Replace("{billingRoleAssignmentName}", System.Uri.EscapeDataString(billingRoleAssignmentName));
+ 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("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;
+ }
+
+ ///
+ /// Get the role assignments on the Billing Account
+ ///
+ ///
+ /// billing Account 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> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, 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("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}/providers/Microsoft.Billing/billingRoleAssignments").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("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 add a role assignment to a billing account.
+ ///
+ ///
+ /// billing Account 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> AddByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, 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");
+ }
+ BillingRoleAssignmentPayload parameters = new BillingRoleAssignmentPayload();
+ // 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, "AddByBillingAccountName", 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();
+ _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("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 != 201)
+ {
+ 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 == 201)
+ {
+ _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 role assignments on the invoice Section
+ ///
+ ///
+ /// 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 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> ListByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, 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("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSectionName", 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();
+ _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 (_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 add a role assignment to a invoice Section.
+ ///
+ ///
+ /// 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 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> AddByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, 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");
+ }
+ BillingRoleAssignmentPayload parameters = new BillingRoleAssignmentPayload();
+ // 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("parameters", parameters);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "AddByInvoiceSectionName", 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();
+ _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 (_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 != 201)
+ {
+ 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 == 201)
+ {
+ _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 role assignments on the 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> 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}/providers/Microsoft.Billing/billingRoleAssignments").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;
+ }
+
+ ///
+ /// The operation to add a role assignment to 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> AddByBillingProfileNameWithHttpMessagesAsync(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");
+ }
+ BillingRoleAssignmentPayload parameters = new BillingRoleAssignmentPayload();
+ // 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, "AddByBillingProfileName", 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();
+ _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;
+ 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 != 201)
+ {
+ 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 == 201)
+ {
+ _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/src/SDKs/Billing/Management.Billing/Generated/BillingRoleAssignmentsOperationsExtensions.cs b/src/SDKs/Billing/Management.Billing/Generated/BillingRoleAssignmentsOperationsExtensions.cs
new file mode 100644
index 000000000000..c4067a9f8cd3
--- /dev/null
+++ b/src/SDKs/Billing/Management.Billing/Generated/BillingRoleAssignmentsOperationsExtensions.cs
@@ -0,0 +1,517 @@
+//
+// 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 BillingRoleAssignmentsOperations.
+ ///
+ public static partial class BillingRoleAssignmentsOperationsExtensions
+ {
+ ///
+ /// Get the role assignment for the caller
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// role assignment id.
+ ///
+ public static BillingRoleAssignment GetByBillingAccount(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingRoleAssignmentName)
+ {
+ return operations.GetByBillingAccountAsync(billingAccountName, billingRoleAssignmentName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Get the role assignment for the caller
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// role assignment id.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task GetByBillingAccountAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingRoleAssignmentName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.GetByBillingAccountWithHttpMessagesAsync(billingAccountName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Delete the role assignment on this billing account
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// role assignment id.
+ ///
+ public static BillingRoleAssignment DeleteByBillingAccountName(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingRoleAssignmentName)
+ {
+ return operations.DeleteByBillingAccountNameAsync(billingAccountName, billingRoleAssignmentName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Delete the role assignment on this billing account
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// role assignment id.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task DeleteByBillingAccountNameAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingRoleAssignmentName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.DeleteByBillingAccountNameWithHttpMessagesAsync(billingAccountName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Get the role assignment for the caller on the invoice Section
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// InvoiceSection Id.
+ ///
+ ///
+ /// role assignment id.
+ ///
+ public static BillingRoleAssignment GetByInvoiceSectionName(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string invoiceSectionName, string billingRoleAssignmentName)
+ {
+ return operations.GetByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName, billingRoleAssignmentName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Get the role assignment for the caller on the invoice Section
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// InvoiceSection Id.
+ ///
+ ///
+ /// role assignment id.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task GetByInvoiceSectionNameAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string invoiceSectionName, string billingRoleAssignmentName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.GetByInvoiceSectionNameWithHttpMessagesAsync(billingAccountName, invoiceSectionName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Delete the role assignment on the invoice Section
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// InvoiceSection Id.
+ ///
+ ///
+ /// role assignment id.
+ ///
+ public static BillingRoleAssignment DeleteByInvoiceSectionName(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string invoiceSectionName, string billingRoleAssignmentName)
+ {
+ return operations.DeleteByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName, billingRoleAssignmentName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Delete the role assignment on the invoice Section
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// InvoiceSection Id.
+ ///
+ ///
+ /// role assignment id.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task DeleteByInvoiceSectionNameAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string invoiceSectionName, string billingRoleAssignmentName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.DeleteByInvoiceSectionNameWithHttpMessagesAsync(billingAccountName, invoiceSectionName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Get the role assignment for the caller on the Billing Profile
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// Billing Profile Id.
+ ///
+ ///
+ /// role assignment id.
+ ///
+ public static BillingRoleAssignment GetByBillingProfileName(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string billingRoleAssignmentName)
+ {
+ return operations.GetByBillingProfileNameAsync(billingAccountName, billingProfileName, billingRoleAssignmentName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Get the role assignment for the caller on the Billing Profile
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// Billing Profile Id.
+ ///
+ ///
+ /// role assignment id.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task GetByBillingProfileNameAsync(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))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Delete the role assignment on this Billing Profile
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// Billing Profile Id.
+ ///
+ ///
+ /// role assignment id.
+ ///
+ public static BillingRoleAssignment DeleteByBillingProfileName(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string billingRoleAssignmentName)
+ {
+ return operations.DeleteByBillingProfileNameAsync(billingAccountName, billingProfileName, billingRoleAssignmentName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Delete the role assignment on this Billing Profile
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// Billing Profile Id.
+ ///
+ ///
+ /// role assignment id.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task DeleteByBillingProfileNameAsync(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))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Get the role assignments on the Billing Account
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ public static BillingRoleAssignmentListResult ListByBillingAccountName(this IBillingRoleAssignmentsOperations operations, string billingAccountName)
+ {
+ return operations.ListByBillingAccountNameAsync(billingAccountName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Get the role assignments on the Billing Account
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task ListByBillingAccountNameAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListByBillingAccountNameWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// The operation to add a role assignment to a billing account.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ public static BillingRoleAssignmentListResult AddByBillingAccountName(this IBillingRoleAssignmentsOperations operations, string billingAccountName)
+ {
+ return operations.AddByBillingAccountNameAsync(billingAccountName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// The operation to add a role assignment to a billing account.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task AddByBillingAccountNameAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.AddByBillingAccountNameWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Get the role assignments on the invoice Section
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// InvoiceSection Id.
+ ///
+ public static BillingRoleAssignmentListResult ListByInvoiceSectionName(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string invoiceSectionName)
+ {
+ return operations.ListByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Get the role assignments on the invoice Section
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// InvoiceSection Id.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task ListByInvoiceSectionNameAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListByInvoiceSectionNameWithHttpMessagesAsync(billingAccountName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// The operation to add a role assignment to a invoice Section.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// InvoiceSection Id.
+ ///
+ public static BillingRoleAssignmentListResult AddByInvoiceSectionName(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string invoiceSectionName)
+ {
+ return operations.AddByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// The operation to add a role assignment to a invoice Section.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// InvoiceSection Id.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task AddByInvoiceSectionNameAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.AddByInvoiceSectionNameWithHttpMessagesAsync(billingAccountName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Get the role assignments on the Billing Profile
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// Billing Profile Id.
+ ///
+ public static BillingRoleAssignmentListResult ListByBillingProfileName(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName)
+ {
+ return operations.ListByBillingProfileNameAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Get the role assignments on the Billing Profile
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// Billing Profile Id.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task ListByBillingProfileNameAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListByBillingProfileNameWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// The operation to add a role assignment to a billing profile.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// Billing Profile Id.
+ ///
+ public static BillingRoleAssignmentListResult AddByBillingProfileName(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName)
+ {
+ return operations.AddByBillingProfileNameAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// The operation to add a role assignment to a billing profile.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// Billing Profile Id.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task AddByBillingProfileNameAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.AddByBillingProfileNameWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ }
+}
diff --git a/src/SDKs/Billing/Management.Billing/Generated/BillingRoleDefinitionsOperations.cs b/src/SDKs/Billing/Management.Billing/Generated/BillingRoleDefinitionsOperations.cs
new file mode 100644
index 000000000000..3388eb2759da
--- /dev/null
+++ b/src/SDKs/Billing/Management.Billing/Generated/BillingRoleDefinitionsOperations.cs
@@ -0,0 +1,1179 @@
+//
+// 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;
+
+ ///
+ /// BillingRoleDefinitionsOperations operations.
+ ///
+ internal partial class BillingRoleDefinitionsOperations : IServiceOperations, IBillingRoleDefinitionsOperations
+ {
+ ///
+ /// Initializes a new instance of the BillingRoleDefinitionsOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal BillingRoleDefinitionsOperations(BillingManagementClient client)
+ {
+ if (client == null)
+ {
+ throw new System.ArgumentNullException("client");
+ }
+ Client = client;
+ }
+
+ ///
+ /// Gets a reference to the BillingManagementClient
+ ///
+ public BillingManagementClient Client { get; private set; }
+
+ ///
+ /// Gets the role definition for a role
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// role definition 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> GetByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, string billingRoleDefinitionName, 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 (billingRoleDefinitionName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "billingRoleDefinitionName");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("billingAccountName", billingAccountName);
+ tracingParameters.Add("billingRoleDefinitionName", billingRoleDefinitionName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "GetByBillingAccountName", 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();
+ _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName));
+ _url = _url.Replace("{billingRoleDefinitionName}", System.Uri.EscapeDataString(billingRoleDefinitionName));
+ 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;
+ }
+
+ ///
+ /// Gets the role definition for a role
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// InvoiceSection Id.
+ ///
+ ///
+ /// role definition 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> GetByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string billingRoleDefinitionName, 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");
+ }
+ if (billingRoleDefinitionName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "billingRoleDefinitionName");
+ }
+ // 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("billingRoleDefinitionName", billingRoleDefinitionName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "GetByInvoiceSectionName", 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();
+ _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName));
+ _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName));
+ _url = _url.Replace("{billingRoleDefinitionName}", System.Uri.EscapeDataString(billingRoleDefinitionName));
+ 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;
+ }
+
+ ///
+ /// Gets the role definition for a role
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// Billing Profile Id.
+ ///
+ ///
+ /// role definition 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> GetByBillingProfileNameWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleDefinitionName, 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 (billingRoleDefinitionName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "billingRoleDefinitionName");
+ }
+ // 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("billingRoleDefinitionName", billingRoleDefinitionName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "GetByBillingProfileName", 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();
+ _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName));
+ _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName));
+ _url = _url.Replace("{billingRoleDefinitionName}", System.Uri.EscapeDataString(billingRoleDefinitionName));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Lists the role definition for a billing account
+ ///
+ ///
+ /// billing Account 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> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, 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("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}/providers/Microsoft.Billing/billingRoleDefinitions").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("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 role definition for an invoice Section
+ ///
+ ///
+ /// 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 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> ListByInvoiceSectionNameWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, 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("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSectionName", 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();
+ _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 (_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 role definition 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> 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}/providers/Microsoft.Billing/billingRoleDefinitions").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;
+ }
+
+ }
+}
diff --git a/src/SDKs/Billing/Management.Billing/Generated/BillingRoleDefinitionsOperationsExtensions.cs b/src/SDKs/Billing/Management.Billing/Generated/BillingRoleDefinitionsOperationsExtensions.cs
new file mode 100644
index 000000000000..cb1c83e8c923
--- /dev/null
+++ b/src/SDKs/Billing/Management.Billing/Generated/BillingRoleDefinitionsOperationsExtensions.cs
@@ -0,0 +1,271 @@
+//
+// 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 BillingRoleDefinitionsOperations.
+ ///
+ public static partial class BillingRoleDefinitionsOperationsExtensions
+ {
+ ///
+ /// Gets the role definition for a role
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// role definition id.
+ ///
+ public static BillingRoleDefinition GetByBillingAccountName(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingRoleDefinitionName)
+ {
+ return operations.GetByBillingAccountNameAsync(billingAccountName, billingRoleDefinitionName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Gets the role definition for a role
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// role definition id.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task GetByBillingAccountNameAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingRoleDefinitionName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.GetByBillingAccountNameWithHttpMessagesAsync(billingAccountName, billingRoleDefinitionName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Gets the role definition for a role
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// InvoiceSection Id.
+ ///
+ ///
+ /// role definition id.
+ ///
+ public static BillingRoleDefinition GetByInvoiceSectionName(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string invoiceSectionName, string billingRoleDefinitionName)
+ {
+ return operations.GetByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName, billingRoleDefinitionName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Gets the role definition for a role
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// InvoiceSection Id.
+ ///
+ ///
+ /// role definition id.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task GetByInvoiceSectionNameAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string invoiceSectionName, string billingRoleDefinitionName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.GetByInvoiceSectionNameWithHttpMessagesAsync(billingAccountName, invoiceSectionName, billingRoleDefinitionName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Gets the role definition for a role
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// Billing Profile Id.
+ ///
+ ///
+ /// role definition id.
+ ///
+ public static BillingRoleDefinition GetByBillingProfileName(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, string billingRoleDefinitionName)
+ {
+ return operations.GetByBillingProfileNameAsync(billingAccountName, billingProfileName, billingRoleDefinitionName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Gets the role definition for a role
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// Billing Profile Id.
+ ///
+ ///
+ /// role definition id.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task GetByBillingProfileNameAsync(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))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Lists the role definition for a billing account
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ public static BillingRoleDefinitionListResult ListByBillingAccountName(this IBillingRoleDefinitionsOperations operations, string billingAccountName)
+ {
+ return operations.ListByBillingAccountNameAsync(billingAccountName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Lists the role definition for a billing account
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task ListByBillingAccountNameAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListByBillingAccountNameWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Lists the role definition for an invoice Section
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// InvoiceSection Id.
+ ///
+ public static BillingRoleDefinitionListResult ListByInvoiceSectionName(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string invoiceSectionName)
+ {
+ return operations.ListByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Lists the role definition for an invoice Section
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// InvoiceSection Id.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task ListByInvoiceSectionNameAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListByInvoiceSectionNameWithHttpMessagesAsync(billingAccountName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Lists the role definition for a Billing Profile
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// Billing Profile Id.
+ ///
+ public static BillingRoleDefinitionListResult ListByBillingProfileName(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName)
+ {
+ return operations.ListByBillingProfileNameAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Lists the role definition for a Billing Profile
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// billing Account Id.
+ ///
+ ///
+ /// Billing Profile Id.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task ListByBillingProfileNameAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListByBillingProfileNameWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ }
+}
diff --git a/src/SDKs/Billing/Management.Billing/Generated/BillingSubscriptionOperations.cs b/src/SDKs/Billing/Management.Billing/Generated/BillingSubscriptionOperations.cs
deleted file mode 100644
index f98ba425f71a..000000000000
--- a/src/SDKs/Billing/Management.Billing/Generated/BillingSubscriptionOperations.cs
+++ /dev/null
@@ -1,494 +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
-{
- 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;
-
- ///
- /// BillingSubscriptionOperations operations.
- ///
- internal partial class BillingSubscriptionOperations : IServiceOperations, IBillingSubscriptionOperations
- {
- ///
- /// Initializes a new instance of the BillingSubscriptionOperations class.
- ///
- ///
- /// Reference to the service client.
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- internal BillingSubscriptionOperations(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 a single billing subscription by name.
- ///
- ///
- ///
- /// billing Account 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 invoiceSectionName, string billingSubscriptionName, 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)
- {
- 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("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}/invoiceSections/{invoiceSectionName}/billingSubscriptions/{billingSubscriptionName}").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));
- 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 GTM subscription from one invoice section to another within a
- /// billing account.
- ///
- ///
- /// 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 GTM subscription from one invoice section to another within a
- /// billing account.
- ///
- ///
- /// billing Account 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> BeginTransferWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, 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)
- {
- 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("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}/invoiceSections/{invoiceSectionName}/billingSubscriptions/{billingSubscriptionName}/transfer").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));
- 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;
- }
-
- }
-}
diff --git a/src/SDKs/Billing/Management.Billing/Generated/BillingSubscriptionOperationsExtensions.cs b/src/SDKs/Billing/Management.Billing/Generated/BillingSubscriptionOperationsExtensions.cs
deleted file mode 100644
index dc2b575d3c3a..000000000000
--- a/src/SDKs/Billing/Management.Billing/Generated/BillingSubscriptionOperationsExtensions.cs
+++ /dev/null
@@ -1,181 +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
-{
- using Microsoft.Rest;
- using Microsoft.Rest.Azure;
- using Models;
- using System.Threading;
- using System.Threading.Tasks;
-
- ///
- /// Extension methods for BillingSubscriptionOperations.
- ///
- public static partial class BillingSubscriptionOperationsExtensions
- {
- ///
- /// Get a single billing subscription by name.
- ///
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// InvoiceSection Id.
- ///
- ///
- /// Billing Subscription Id.
- ///
- public static BillingSubscriptionSummary Get(this IBillingSubscriptionOperations operations, string billingAccountName, string invoiceSectionName, string billingSubscriptionName)
- {
- return operations.GetAsync(billingAccountName, invoiceSectionName, billingSubscriptionName).GetAwaiter().GetResult();
- }
-
- ///
- /// Get a single billing subscription by name.
- ///
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// InvoiceSection Id.
- ///
- ///
- /// Billing Subscription Id.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task GetAsync(this IBillingSubscriptionOperations operations, string billingAccountName, string invoiceSectionName, string billingSubscriptionName, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// Transfers the GTM subscription from one invoice section to another within a
- /// billing account.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// InvoiceSection Id.
- ///
- ///
- /// Billing Subscription Id.
- ///
- ///
- /// Parameters supplied to the Transfer Billing Subscription operation.
- ///
- public static TransferBillingSubscriptionResult Transfer(this IBillingSubscriptionOperations operations, string billingAccountName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters)
- {
- return operations.TransferAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, parameters).GetAwaiter().GetResult();
- }
-
- ///
- /// Transfers the GTM subscription from one invoice section to another within a
- /// billing account.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// InvoiceSection Id.
- ///
- ///
- /// Billing Subscription Id.
- ///
- ///
- /// Parameters supplied to the Transfer Billing Subscription operation.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task TransferAsync(this IBillingSubscriptionOperations operations, string billingAccountName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.TransferWithHttpMessagesAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, parameters, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// Transfers the GTM subscription from one invoice section to another within a
- /// billing account.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// InvoiceSection Id.
- ///
- ///
- /// Billing Subscription Id.
- ///
- ///
- /// Parameters supplied to the Transfer Billing Subscription operation.
- ///
- public static TransferBillingSubscriptionResult BeginTransfer(this IBillingSubscriptionOperations operations, string billingAccountName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters)
- {
- return operations.BeginTransferAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, parameters).GetAwaiter().GetResult();
- }
-
- ///
- /// Transfers the GTM subscription from one invoice section to another within a
- /// billing account.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// InvoiceSection Id.
- ///
- ///
- /// Billing Subscription Id.
- ///
- ///
- /// Parameters supplied to the Transfer Billing Subscription operation.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task BeginTransferAsync(this IBillingSubscriptionOperations operations, string billingAccountName, string invoiceSectionName, string billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.BeginTransferWithHttpMessagesAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, parameters, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- }
-}
diff --git a/src/SDKs/Billing/Management.Billing/Generated/BillingSubscriptionsByBillingProfileOperations.cs b/src/SDKs/Billing/Management.Billing/Generated/BillingSubscriptionsByBillingProfileOperations.cs
deleted file mode 100644
index ec2791460617..000000000000
--- a/src/SDKs/Billing/Management.Billing/Generated/BillingSubscriptionsByBillingProfileOperations.cs
+++ /dev/null
@@ -1,241 +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
-{
- 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;
-
- ///
- /// BillingSubscriptionsByBillingProfileOperations operations.
- ///
- internal partial class BillingSubscriptionsByBillingProfileOperations : IServiceOperations, IBillingSubscriptionsByBillingProfileOperations
- {
- ///
- /// Initializes a new instance of the BillingSubscriptionsByBillingProfileOperations class.
- ///
- ///
- /// Reference to the service client.
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- internal BillingSubscriptionsByBillingProfileOperations(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 billing subscriptions by billingProfileName.
- ///
- ///
- ///
- /// 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> ListWithHttpMessagesAsync(string billingAccountName, string billingProfileName, 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 (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("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}/billingSubscriptions").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;
- }
-
- }
-}
diff --git a/src/SDKs/Billing/Management.Billing/Generated/BillingSubscriptionsByBillingProfileOperationsExtensions.cs b/src/SDKs/Billing/Management.Billing/Generated/BillingSubscriptionsByBillingProfileOperationsExtensions.cs
deleted file mode 100644
index 29dcbde82795..000000000000
--- a/src/SDKs/Billing/Management.Billing/Generated/BillingSubscriptionsByBillingProfileOperationsExtensions.cs
+++ /dev/null
@@ -1,67 +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
-{
- using Microsoft.Rest;
- using Microsoft.Rest.Azure;
- using Models;
- using System.Threading;
- using System.Threading.Tasks;
-
- ///
- /// Extension methods for BillingSubscriptionsByBillingProfileOperations.
- ///
- public static partial class BillingSubscriptionsByBillingProfileOperationsExtensions
- {
- ///
- /// Lists billing subscriptions by billingProfileName.
- ///
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// Billing Profile Id.
- ///
- public static BillingSubscriptionsListResult List(this IBillingSubscriptionsByBillingProfileOperations operations, string billingAccountName, string billingProfileName)
- {
- return operations.ListAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult();
- }
-
- ///
- /// Lists billing subscriptions by billingProfileName.
- ///
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// Billing Profile Id.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task ListAsync(this IBillingSubscriptionsByBillingProfileOperations operations, string billingAccountName, string billingProfileName, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.ListWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- }
-}
diff --git a/src/SDKs/Billing/Management.Billing/Generated/BillingSubscriptionsByInvoiceSectionOperations.cs b/src/SDKs/Billing/Management.Billing/Generated/BillingSubscriptionsByInvoiceSectionOperations.cs
deleted file mode 100644
index ae2f23c0aa88..000000000000
--- a/src/SDKs/Billing/Management.Billing/Generated/BillingSubscriptionsByInvoiceSectionOperations.cs
+++ /dev/null
@@ -1,241 +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
-{
- 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;
-
- ///
- /// BillingSubscriptionsByInvoiceSectionOperations operations.
- ///
- internal partial class BillingSubscriptionsByInvoiceSectionOperations : IServiceOperations, IBillingSubscriptionsByInvoiceSectionOperations
- {
- ///
- /// Initializes a new instance of the BillingSubscriptionsByInvoiceSectionOperations class.
- ///
- ///
- /// Reference to the service client.
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- internal BillingSubscriptionsByInvoiceSectionOperations(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 billing subscription by invoiceSectionName.
- ///
- ///
- ///
- /// 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 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 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");
- }
- 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("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}/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)
- {
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
- }
- if (_queryParameters.Count > 0)
- {
- _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
- }
- // Create HTTP transport objects
- var _httpRequest = new HttpRequestMessage();
- HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("GET");
- _httpRequest.RequestUri = new System.Uri(_url);
- // Set Headers
- if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
- {
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
- }
- if (Client.AcceptLanguage != null)
- {
- if (_httpRequest.Headers.Contains("accept-language"))
- {
- _httpRequest.Headers.Remove("accept-language");
- }
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
- }
-
-
- if (customHeaders != null)
- {
- foreach(var _header in customHeaders)
- {
- if (_httpRequest.Headers.Contains(_header.Key))
- {
- _httpRequest.Headers.Remove(_header.Key);
- }
- _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
- }
- }
-
- // Serialize Request
- string _requestContent = null;
- // Set Credentials
- if (Client.Credentials != null)
- {
- cancellationToken.ThrowIfCancellationRequested();
- await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- }
- // Send Request
- if (_shouldTrace)
- {
- ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
- }
- cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- if (_shouldTrace)
- {
- ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
- }
- HttpStatusCode _statusCode = _httpResponse.StatusCode;
- cancellationToken.ThrowIfCancellationRequested();
- string _responseContent = null;
- if ((int)_statusCode != 200)
- {
- var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- try
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- if (_errorBody != null)
- {
- ex.Body = _errorBody;
- }
- }
- catch (JsonException)
- {
- // Ignore the exception
- }
- ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
- if (_shouldTrace)
- {
- ServiceClientTracing.Error(_invocationId, ex);
- }
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw ex;
- }
- // Create Result
- var _result = new AzureOperationResponse();
- _result.Request = _httpRequest;
- _result.Response = _httpResponse;
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- // Deserialize Response
- if ((int)_statusCode == 200)
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- try
- {
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- }
- catch (JsonException ex)
- {
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
- }
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Exit(_invocationId, _result);
- }
- return _result;
- }
-
- }
-}
diff --git a/src/SDKs/Billing/Management.Billing/Generated/BillingSubscriptionsByInvoiceSectionOperationsExtensions.cs b/src/SDKs/Billing/Management.Billing/Generated/BillingSubscriptionsByInvoiceSectionOperationsExtensions.cs
deleted file mode 100644
index 6e96f63d0abe..000000000000
--- a/src/SDKs/Billing/Management.Billing/Generated/BillingSubscriptionsByInvoiceSectionOperationsExtensions.cs
+++ /dev/null
@@ -1,67 +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
-{
- using Microsoft.Rest;
- using Microsoft.Rest.Azure;
- using Models;
- using System.Threading;
- using System.Threading.Tasks;
-
- ///
- /// Extension methods for BillingSubscriptionsByInvoiceSectionOperations.
- ///
- public static partial class BillingSubscriptionsByInvoiceSectionOperationsExtensions
- {
- ///
- /// Lists billing subscription by invoiceSectionName.
- ///
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// InvoiceSection Id.
- ///
- public static BillingSubscriptionsListResult List(this IBillingSubscriptionsByInvoiceSectionOperations operations, string billingAccountName, string invoiceSectionName)
- {
- return operations.ListAsync(billingAccountName, invoiceSectionName).GetAwaiter().GetResult();
- }
-
- ///
- /// Lists billing subscription by invoiceSectionName.
- ///
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// billing Account Id.
- ///
- ///
- /// InvoiceSection Id.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task ListAsync(this IBillingSubscriptionsByInvoiceSectionOperations operations, string billingAccountName, string invoiceSectionName, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.ListWithHttpMessagesAsync(billingAccountName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- }
-}
diff --git a/src/SDKs/Billing/Management.Billing/Generated/BillingSubscriptionsOperations.cs b/src/SDKs/Billing/Management.Billing/Generated/BillingSubscriptionsOperations.cs
new file mode 100644
index 000000000000..08090ecc3117
--- /dev/null
+++ b/src/SDKs/Billing/Management.Billing/Generated/BillingSubscriptionsOperations.cs
@@ -0,0 +1,1215 @@
+//
+// 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;
+
+ ///
+ /// BillingSubscriptionsOperations operations.
+ ///
+ internal partial class BillingSubscriptionsOperations : IServiceOperations, IBillingSubscriptionsOperations
+ {
+ ///
+ /// Initializes a new instance of the BillingSubscriptionsOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal BillingSubscriptionsOperations(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 billing subscriptions by billing account name.
+ ///
+ ///
+ ///
+ /// billing Account 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>> ListByBillingAccountNameWithHttpMessagesAsync(string billingAccountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (billingAccountName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName");
+ }
+ 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("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}/billingSubscriptions").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("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 profile name.
+ ///
+ ///
+ ///
+ /// 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 (billingAccountName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName");
+ }
+ if (billingProfileName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName");
+ }
+ 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("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}/billingSubscriptions").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