diff --git a/src/Billing/Billing.Management.Sdk/Billing.Management.Sdk.csproj b/src/Billing/Billing.Management.Sdk/Billing.Management.Sdk.csproj new file mode 100644 index 000000000000..f01a79c2fc4e --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Billing.Management.Sdk.csproj @@ -0,0 +1,13 @@ + + + Billing + + + + netstandard2.0 + Microsoft.Azure.PowerShell.Billing.Management.Sdk + Microsoft.Azure.Management.Billing + $(NoWarn);CS0108;CS1573 + + + \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/AddressOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/AddressOperations.cs new file mode 100644 index 000000000000..7835d50a5a1e --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/AddressOperations.cs @@ -0,0 +1,240 @@ +// 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 System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// AddressOperations operations. + /// + internal partial class AddressOperations : Microsoft.Rest.IServiceOperations, IAddressOperations + { + /// + /// Initializes a new instance of the AddressOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal AddressOperations (BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// Validates an address. Use the operation to validate an address before using + /// it as soldTo or a billTo address. + /// + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> ValidateWithHttpMessagesAsync(AddressDetails address, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (address == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "address"); + } + if (address != null) + { + address.Validate(); + } + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("address", address); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Validate", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/validateAddress").ToString(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); + } + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + // Serialize Request + string _requestContent = null; + if(address != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(address, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/AddressOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/AddressOperationsExtensions.cs new file mode 100644 index 000000000000..3d38e4dffcda --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/AddressOperationsExtensions.cs @@ -0,0 +1,45 @@ +// 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.Azure; + using Models; + + /// + /// Extension methods for AddressOperations + /// + public static partial class AddressOperationsExtensions + { + /// + /// Validates an address. Use the operation to validate an address before using + /// it as soldTo or a billTo address. + /// + /// + /// The operations group for this extension method. + /// + public static ValidateAddressResponse Validate(this IAddressOperations operations, AddressDetails address) + { + return ((IAddressOperations)operations).ValidateAsync(address).GetAwaiter().GetResult(); + } + + /// + /// Validates an address. Use the operation to validate an address before using + /// it as soldTo or a billTo address. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task ValidateAsync(this IAddressOperations operations, AddressDetails address, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ValidateWithHttpMessagesAsync(address, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/AgreementsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/AgreementsOperations.cs new file mode 100644 index 000000000000..853b3eed1c88 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/AgreementsOperations.cs @@ -0,0 +1,625 @@ +// 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 System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// AgreementsOperations operations. + /// + internal partial class AgreementsOperations : Microsoft.Rest.IServiceOperations, IAgreementsOperations + { + /// + /// Initializes a new instance of the AgreementsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal AgreementsOperations (BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// Lists the agreements for a billing account. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// May be used to expand the participants. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("expand", expand); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/agreements").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Gets an agreement by ID. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an agreement. + /// + /// + /// May be used to expand the participants. + /// + /// + /// 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 System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingAccountName, string agreementName, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (agreementName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "agreementName"); + } + + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("agreementName", agreementName); + tracingParameters.Add("expand", expand); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/agreements/{agreementName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{agreementName}", System.Uri.EscapeDataString(agreementName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the agreements for a billing account. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/AgreementsOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/AgreementsOperationsExtensions.cs new file mode 100644 index 000000000000..cd31a703652a --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/AgreementsOperationsExtensions.cs @@ -0,0 +1,133 @@ +// 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.Azure; + using Models; + + /// + /// Extension methods for AgreementsOperations + /// + public static partial class AgreementsOperationsExtensions + { + /// + /// Lists the agreements for a billing account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// May be used to expand the participants. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingAccount(this IAgreementsOperations operations, string billingAccountName, string expand = default(string)) + { + return ((IAgreementsOperations)operations).ListByBillingAccountAsync(billingAccountName, expand).GetAwaiter().GetResult(); + } + + /// + /// Lists the agreements for a billing account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// May be used to expand the participants. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingAccountAsync(this IAgreementsOperations operations, string billingAccountName, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Gets an agreement by ID. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an agreement. + /// + /// + /// May be used to expand the participants. + /// + public static Agreement Get(this IAgreementsOperations operations, string billingAccountName, string agreementName, string expand = default(string)) + { + return ((IAgreementsOperations)operations).GetAsync(billingAccountName, agreementName, expand).GetAwaiter().GetResult(); + } + + /// + /// Gets an agreement by ID. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an agreement. + /// + /// + /// May be used to expand the participants. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IAgreementsOperations operations, string billingAccountName, string agreementName, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, agreementName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the agreements for a billing account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingAccountNext(this IAgreementsOperations operations, string nextPageLink) + { + return ((IAgreementsOperations)operations).ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the agreements for a billing account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingAccountNextAsync(this IAgreementsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/AvailableBalancesOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/AvailableBalancesOperations.cs new file mode 100644 index 000000000000..be16479e3fb0 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/AvailableBalancesOperations.cs @@ -0,0 +1,244 @@ +// 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 System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// AvailableBalancesOperations operations. + /// + internal partial class AvailableBalancesOperations : Microsoft.Rest.IServiceOperations, IAvailableBalancesOperations + { + /// + /// Initializes a new instance of the AvailableBalancesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal AvailableBalancesOperations (BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// The available credit balance for a billing profile. This is the balance + /// that can be used for pay now to settle due or past due invoices. The + /// operation is supported only for billing accounts with agreement type + /// Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (billingProfileName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("apiVersion", apiVersion); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/availableBalance/default").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/AvailableBalancesOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/AvailableBalancesOperationsExtensions.cs new file mode 100644 index 000000000000..d42e6f55aab0 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/AvailableBalancesOperationsExtensions.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for AvailableBalancesOperations + /// + public static partial class AvailableBalancesOperationsExtensions + { + /// + /// The available credit balance for a billing profile. This is the balance + /// that can be used for pay now to settle due or past due invoices. The + /// operation is supported only for billing accounts with agreement type + /// Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + public static AvailableBalance Get(this IAvailableBalancesOperations operations, string billingAccountName, string billingProfileName) + { + return ((IAvailableBalancesOperations)operations).GetAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + } + + /// + /// The available credit balance for a billing profile. This is the balance + /// that can be used for pay now to settle due or past due invoices. The + /// operation is supported only for billing accounts with agreement type + /// Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IAvailableBalancesOperations operations, string billingAccountName, string billingProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingAccountsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingAccountsOperations.cs new file mode 100644 index 000000000000..009f3a4b6d0b --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingAccountsOperations.cs @@ -0,0 +1,1206 @@ +// 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 System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// BillingAccountsOperations operations. + /// + internal partial class BillingAccountsOperations : Microsoft.Rest.IServiceOperations, IBillingAccountsOperations + { + /// + /// Initializes a new instance of the BillingAccountsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal BillingAccountsOperations (BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// Lists the billing accounts that a user has access to. + /// + /// + /// May be used to expand the soldTo, invoice sections and billing profiles. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("expand", expand); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts").ToString(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Gets a billing account by its ID. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// May be used to expand the soldTo, invoice sections and billing profiles. + /// + /// + /// 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 System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingAccountName, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("expand", expand); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Updates the properties of a billing account. Currently, displayName and + /// address can be updated. The operation is supported only for billing + /// accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// Request parameters that are provided to the update billing account + /// operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string billingAccountName, BillingAccountUpdateRequest parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(billingAccountName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Lists the invoice sections for which the user has permission to create + /// Azure subscriptions. The operation is supported only for billing accounts + /// with agreement type Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListInvoiceSectionsByCreateSubscriptionPermissionWithHttpMessagesAsync(string billingAccountName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingAccountName", billingAccountName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListInvoiceSectionsByCreateSubscriptionPermission", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/listInvoiceSectionsWithCreateSubscriptionPermission").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Updates the properties of a billing account. Currently, displayName and + /// address can be updated. The operation is supported only for billing + /// accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// Request parameters that are provided to the update billing account + /// operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> BeginUpdateWithHttpMessagesAsync(string billingAccountName, BillingAccountUpdateRequest parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + } + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingAccountName", billingAccountName); + + tracingParameters.Add("parameters", parameters); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the billing accounts that a user has access to. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the invoice sections for which the user has permission to create + /// Azure subscriptions. The operation is supported only for billing accounts + /// with agreement type Microsoft Customer Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListInvoiceSectionsByCreateSubscriptionPermissionNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListInvoiceSectionsByCreateSubscriptionPermissionNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingAccountsOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingAccountsOperationsExtensions.cs new file mode 100644 index 000000000000..9eaadf9a5c8e --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingAccountsOperationsExtensions.cs @@ -0,0 +1,269 @@ +// 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.Azure; + using Models; + + /// + /// Extension methods for BillingAccountsOperations + /// + public static partial class BillingAccountsOperationsExtensions + { + /// + /// Lists the billing accounts that a user has access to. + /// + /// + /// The operations group for this extension method. + /// + /// + /// May be used to expand the soldTo, invoice sections and billing profiles. + /// + public static Microsoft.Rest.Azure.IPage List(this IBillingAccountsOperations operations, string expand = default(string)) + { + return ((IBillingAccountsOperations)operations).ListAsync(expand).GetAwaiter().GetResult(); + } + + /// + /// Lists the billing accounts that a user has access to. + /// + /// + /// The operations group for this extension method. + /// + /// + /// May be used to expand the soldTo, invoice sections and billing profiles. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IBillingAccountsOperations operations, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Gets a billing account by its ID. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// May be used to expand the soldTo, invoice sections and billing profiles. + /// + public static BillingAccount Get(this IBillingAccountsOperations operations, string billingAccountName, string expand = default(string)) + { + return ((IBillingAccountsOperations)operations).GetAsync(billingAccountName, expand).GetAwaiter().GetResult(); + } + + /// + /// Gets a billing account by its ID. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// May be used to expand the soldTo, invoice sections and billing profiles. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IBillingAccountsOperations operations, string billingAccountName, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Updates the properties of a billing account. Currently, displayName and + /// address can be updated. The operation is supported only for billing + /// accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + public static BillingAccount Update(this IBillingAccountsOperations operations, string billingAccountName, BillingAccountUpdateRequest parameters) + { + return ((IBillingAccountsOperations)operations).UpdateAsync(billingAccountName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates the properties of a billing account. Currently, displayName and + /// address can be updated. The operation is supported only for billing + /// accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this IBillingAccountsOperations operations, string billingAccountName, BillingAccountUpdateRequest parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(billingAccountName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the invoice sections for which the user has permission to create + /// Azure subscriptions. The operation is supported only for billing accounts + /// with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + public static Microsoft.Rest.Azure.IPage ListInvoiceSectionsByCreateSubscriptionPermission(this IBillingAccountsOperations operations, string billingAccountName) + { + return ((IBillingAccountsOperations)operations).ListInvoiceSectionsByCreateSubscriptionPermissionAsync(billingAccountName).GetAwaiter().GetResult(); + } + + /// + /// Lists the invoice sections for which the user has permission to create + /// Azure subscriptions. The operation is supported only for billing accounts + /// with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListInvoiceSectionsByCreateSubscriptionPermissionAsync(this IBillingAccountsOperations operations, string billingAccountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListInvoiceSectionsByCreateSubscriptionPermissionWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Updates the properties of a billing account. Currently, displayName and + /// address can be updated. The operation is supported only for billing + /// accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + public static BillingAccount BeginUpdate(this IBillingAccountsOperations operations, string billingAccountName, BillingAccountUpdateRequest parameters) + { + return ((IBillingAccountsOperations)operations).BeginUpdateAsync(billingAccountName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates the properties of a billing account. Currently, displayName and + /// address can be updated. The operation is supported only for billing + /// accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginUpdateAsync(this IBillingAccountsOperations operations, string billingAccountName, BillingAccountUpdateRequest parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(billingAccountName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the billing accounts that a user has access to. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IBillingAccountsOperations operations, string nextPageLink) + { + return ((IBillingAccountsOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the billing accounts that a user has access to. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IBillingAccountsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the invoice sections for which the user has permission to create + /// Azure subscriptions. The operation is supported only for billing accounts + /// with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListInvoiceSectionsByCreateSubscriptionPermissionNext(this IBillingAccountsOperations operations, string nextPageLink) + { + return ((IBillingAccountsOperations)operations).ListInvoiceSectionsByCreateSubscriptionPermissionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the invoice sections for which the user has permission to create + /// Azure subscriptions. The operation is supported only for billing accounts + /// with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListInvoiceSectionsByCreateSubscriptionPermissionNextAsync(this IBillingAccountsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListInvoiceSectionsByCreateSubscriptionPermissionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingManagementClient.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingManagementClient.cs new file mode 100644 index 000000000000..4a44e21251ca --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingManagementClient.cs @@ -0,0 +1,432 @@ +// 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 System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// Billing client provides access to billing resources for Azure + /// subscriptions. + /// + public partial class BillingManagementClient : Microsoft.Rest.ServiceClient, IBillingManagementClient, IAzureClient + { + /// + /// The base URI of the service. + /// + public System.Uri BaseUri { get; set; } + /// + /// Gets or sets json serialization settings. + /// + public Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; private set; } + /// + /// Gets or sets json deserialization settings. + /// + public Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; private set; } + /// + /// Credentials needed for the client to connect to Azure. + /// + public Microsoft.Rest.ServiceClientCredentials Credentials { get; private set; } + + /// + /// The ID that uniquely identifies an Azure subscription. + /// + public string SubscriptionId { get; set;} + + /// + /// The preferred language for the response. + /// + public string AcceptLanguage { get; set;} + + /// + /// The retry timeout in seconds for Long Running Operations. Default + /// /// value is 30. + /// + public int? LongRunningOperationRetryTimeout { get; set;} + + /// + /// Whether a unique x-ms-client-request-id should be generated. When + /// /// set to true a unique x-ms-client-request-id value is generated and + /// /// included in each request. Default is true. + /// + public bool? GenerateClientRequestId { get; set;} + + /// + /// Gets the IBillingAccountsOperations + /// + public virtual IBillingAccountsOperations BillingAccounts { get; private set; } + /// + /// Gets the IAddressOperations + /// + public virtual IAddressOperations Address { get; private set; } + /// + /// Gets the IAvailableBalancesOperations + /// + public virtual IAvailableBalancesOperations AvailableBalances { get; private set; } + /// + /// Gets the IInstructionsOperations + /// + public virtual IInstructionsOperations Instructions { get; private set; } + /// + /// Gets the IBillingProfilesOperations + /// + public virtual IBillingProfilesOperations BillingProfiles { get; private set; } + /// + /// Gets the ICustomersOperations + /// + public virtual ICustomersOperations Customers { get; private set; } + /// + /// Gets the IInvoiceSectionsOperations + /// + public virtual IInvoiceSectionsOperations InvoiceSections { get; private set; } + /// + /// Gets the IBillingPermissionsOperations + /// + public virtual IBillingPermissionsOperations BillingPermissions { get; private set; } + /// + /// Gets the IBillingSubscriptionsOperations + /// + public virtual IBillingSubscriptionsOperations BillingSubscriptions { get; private set; } + /// + /// Gets the IProductsOperations + /// + public virtual IProductsOperations Products { get; private set; } + /// + /// Gets the IInvoicesOperations + /// + public virtual IInvoicesOperations Invoices { get; private set; } + /// + /// Gets the ITransactionsOperations + /// + public virtual ITransactionsOperations Transactions { get; private set; } + /// + /// Gets the IPoliciesOperations + /// + public virtual IPoliciesOperations Policies { get; private set; } + /// + /// Gets the IBillingPropertyOperations + /// + public virtual IBillingPropertyOperations BillingProperty { get; private set; } + /// + /// Gets the IOperations + /// + public virtual IOperations Operations { get; private set; } + /// + /// Gets the IBillingRoleDefinitionsOperations + /// + public virtual IBillingRoleDefinitionsOperations BillingRoleDefinitions { get; private set; } + /// + /// Gets the IBillingRoleAssignmentsOperations + /// + public virtual IBillingRoleAssignmentsOperations BillingRoleAssignments { get; private set; } + /// + /// Gets the IAgreementsOperations + /// + public virtual IAgreementsOperations Agreements { get; private set; } + /// + /// Gets the IEnrollmentAccountsOperations + /// + public virtual IEnrollmentAccountsOperations EnrollmentAccounts { get; private set; } + /// + /// Gets the IBillingPeriodsOperations + /// + public virtual IBillingPeriodsOperations BillingPeriods { get; private set; } + /// + /// Initializes a new instance of the BillingManagementClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling BillingManagementClient.Dispose(). False: will not dispose provided httpClient + protected BillingManagementClient(System.Net.Http.HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + this.Initialize(); + } + /// + /// Initializes a new instance of the BillingManagementClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected BillingManagementClient(params System.Net.Http.DelegatingHandler[] handlers) : base(handlers) + { + this.Initialize(); + } + /// + /// Initializes a new instance of the BillingManagementClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected BillingManagementClient(System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + this.Initialize(); + } + /// + /// Initializes a new instance of the BillingManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected BillingManagementClient(System.Uri baseUri, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + this.BaseUri = baseUri; + } + /// + /// Initializes a new instance of the BillingManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected BillingManagementClient(System.Uri baseUri, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + + this.BaseUri = baseUri; + } + /// + /// Initializes a new instance of the BillingManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public BillingManagementClient(Microsoft.Rest.ServiceClientCredentials credentials, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + this.Credentials = credentials; + if (this.Credentials != null) + { + this.Credentials.InitializeServiceClient(this); + } + + } + /// + /// Initializes a new instance of the BillingManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling BillingManagementClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public BillingManagementClient(Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + this.Credentials = credentials; + if (this.Credentials != null) + { + this.Credentials.InitializeServiceClient(this); + } + + } + /// + /// Initializes a new instance of the BillingManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public BillingManagementClient(Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + this.Credentials = credentials; + if (this.Credentials != null) + { + this.Credentials.InitializeServiceClient(this); + } + + } + /// + /// Initializes a new instance of the BillingManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public BillingManagementClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials credentials, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + this.BaseUri = baseUri; + this.Credentials = credentials; + if (this.Credentials != null) + { + this.Credentials.InitializeServiceClient(this); + } + + } + /// + /// Initializes a new instance of the BillingManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public BillingManagementClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + this.BaseUri = baseUri; + this.Credentials = credentials; + if (this.Credentials != null) + { + this.Credentials.InitializeServiceClient(this); + } + + } + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); + + /// + /// Initializes client properties. + /// + private void Initialize() + { + this.BillingAccounts = new BillingAccountsOperations(this); + this.Address = new AddressOperations(this); + this.AvailableBalances = new AvailableBalancesOperations(this); + this.Instructions = new InstructionsOperations(this); + this.BillingProfiles = new BillingProfilesOperations(this); + this.Customers = new CustomersOperations(this); + this.InvoiceSections = new InvoiceSectionsOperations(this); + this.BillingPermissions = new BillingPermissionsOperations(this); + this.BillingSubscriptions = new BillingSubscriptionsOperations(this); + this.Products = new ProductsOperations(this); + this.Invoices = new InvoicesOperations(this); + this.Transactions = new TransactionsOperations(this); + this.Policies = new PoliciesOperations(this); + this.BillingProperty = new BillingPropertyOperations(this); + this.Operations = new Operations(this); + this.BillingRoleDefinitions = new BillingRoleDefinitionsOperations(this); + this.BillingRoleAssignments = new BillingRoleAssignmentsOperations(this); + this.Agreements = new AgreementsOperations(this); + this.EnrollmentAccounts = new EnrollmentAccountsOperations(this); + this.BillingPeriods = new BillingPeriodsOperations(this); + this.BaseUri = new System.Uri("https://management.azure.com"); + this.AcceptLanguage = "en-US"; + this.LongRunningOperationRetryTimeout = 30; + this.GenerateClientRequestId = true; + SerializationSettings = new Newtonsoft.Json.JsonSerializerSettings + { + Formatting = Newtonsoft.Json.Formatting.Indented, + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new Microsoft.Rest.Serialization.ReadOnlyJsonContractResolver(), + Converters = new System.Collections.Generic.List + { + new Microsoft.Rest.Serialization.Iso8601TimeSpanConverter() + } + }; + SerializationSettings.Converters.Add(new Microsoft.Rest.Serialization.TransformationJsonConverter()); + DeserializationSettings = new Newtonsoft.Json.JsonSerializerSettings + { + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new Microsoft.Rest.Serialization.ReadOnlyJsonContractResolver(), + Converters = new System.Collections.Generic.List + { + new Microsoft.Rest.Serialization.Iso8601TimeSpanConverter() + } + }; + CustomInitialize(); + DeserializationSettings.Converters.Add(new Microsoft.Rest.Serialization.TransformationJsonConverter()); + DeserializationSettings.Converters.Add(new Microsoft.Rest.Azure.CloudErrorJsonConverter()); + } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingPeriodsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingPeriodsOperations.cs new file mode 100644 index 000000000000..f8409a2c5419 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingPeriodsOperations.cs @@ -0,0 +1,650 @@ +// 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 System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// BillingPeriodsOperations operations. + /// + internal partial class BillingPeriodsOperations : Microsoft.Rest.IServiceOperations, IBillingPeriodsOperations + { + /// + /// Initializes a new instance of the BillingPeriodsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal BillingPeriodsOperations (BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// Lists the available billing periods for a subscription in reverse + /// chronological order. This is only supported for Azure Web-Direct + /// subscriptions. Other subscription types which were not purchased directly + /// through the Azure web portal are not supported through this preview API. + /// + /// + /// May be used to filter billing periods by billingPeriodEndDate. The filter + /// supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently + /// support 'ne', 'or', or 'not'. + /// + /// + /// Skiptoken is only used if a previous operation returned a partial result. + /// If a previous response contains a nextLink element, the value of the + /// nextLink element will include a skiptoken parameter that specifies a + /// starting point to use for subsequent calls. + /// + /// + /// May be used to limit the number of results to the most recent N billing + /// periods. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string filter = default(string), string skiptoken = default(string), int? top = default(int?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + + + if (top != null) + { + if (top > 100) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.InclusiveMaximum, "top", 100); + } + if (top < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.InclusiveMinimum, "top", 1); + } + } + string apiVersion = "2018-03-01-preview"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("filter", filter); + tracingParameters.Add("skiptoken", skiptoken); + tracingParameters.Add("top", top); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (skiptoken != null) + { + _queryParameters.Add(string.Format("$skiptoken={0}", System.Uri.EscapeDataString(skiptoken))); + } + if (top != null) + { + _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(top, this.Client.SerializationSettings).Trim('"')))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Gets a named billing period. This is only supported for Azure Web-Direct + /// subscriptions. Other subscription types which were not purchased directly + /// through the Azure web portal are not supported through this preview API. + /// + /// + /// The name of a BillingPeriod resource. + /// + /// + /// 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 System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingPeriodName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (billingPeriodName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingPeriodName"); + } + + string apiVersion = "2018-03-01-preview"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingPeriodName", billingPeriodName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{billingPeriodName}", System.Uri.EscapeDataString(billingPeriodName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the available billing periods for a subscription in reverse + /// chronological order. This is only supported for Azure Web-Direct + /// subscriptions. Other subscription types which were not purchased directly + /// through the Azure web portal are not supported through this preview API. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingPeriodsOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingPeriodsOperationsExtensions.cs new file mode 100644 index 000000000000..cc4ee512f7b1 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingPeriodsOperationsExtensions.cs @@ -0,0 +1,155 @@ +// 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.Azure; + using Models; + + /// + /// Extension methods for BillingPeriodsOperations + /// + public static partial class BillingPeriodsOperationsExtensions + { + /// + /// Lists the available billing periods for a subscription in reverse + /// chronological order. This is only supported for Azure Web-Direct + /// subscriptions. Other subscription types which were not purchased directly + /// through the Azure web portal are not supported through this preview API. + /// + /// + /// The operations group for this extension method. + /// + /// + /// May be used to filter billing periods by billingPeriodEndDate. The filter + /// supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently + /// support 'ne', 'or', or 'not'. + /// + /// + /// Skiptoken is only used if a previous operation returned a partial result. + /// If a previous response contains a nextLink element, the value of the + /// nextLink element will include a skiptoken parameter that specifies a + /// starting point to use for subsequent calls. + /// + /// + /// May be used to limit the number of results to the most recent N billing + /// periods. + /// + public static Microsoft.Rest.Azure.IPage List(this IBillingPeriodsOperations operations, string filter = default(string), string skiptoken = default(string), int? top = default(int?)) + { + return ((IBillingPeriodsOperations)operations).ListAsync(filter, skiptoken, top).GetAwaiter().GetResult(); + } + + /// + /// Lists the available billing periods for a subscription in reverse + /// chronological order. This is only supported for Azure Web-Direct + /// subscriptions. Other subscription types which were not purchased directly + /// through the Azure web portal are not supported through this preview API. + /// + /// + /// The operations group for this extension method. + /// + /// + /// May be used to filter billing periods by billingPeriodEndDate. The filter + /// supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently + /// support 'ne', 'or', or 'not'. + /// + /// + /// Skiptoken is only used if a previous operation returned a partial result. + /// If a previous response contains a nextLink element, the value of the + /// nextLink element will include a skiptoken parameter that specifies a + /// starting point to use for subsequent calls. + /// + /// + /// May be used to limit the number of results to the most recent N billing + /// periods. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IBillingPeriodsOperations operations, string filter = default(string), string skiptoken = default(string), int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(filter, skiptoken, top, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Gets a named billing period. This is only supported for Azure Web-Direct + /// subscriptions. Other subscription types which were not purchased directly + /// through the Azure web portal are not supported through this preview API. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a BillingPeriod resource. + /// + public static BillingPeriod Get(this IBillingPeriodsOperations operations, string billingPeriodName) + { + return ((IBillingPeriodsOperations)operations).GetAsync(billingPeriodName).GetAwaiter().GetResult(); + } + + /// + /// Gets a named billing period. This is only supported for Azure Web-Direct + /// subscriptions. Other subscription types which were not purchased directly + /// through the Azure web portal are not supported through this preview API. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of a BillingPeriod resource. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IBillingPeriodsOperations operations, string billingPeriodName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(billingPeriodName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the available billing periods for a subscription in reverse + /// chronological order. This is only supported for Azure Web-Direct + /// subscriptions. Other subscription types which were not purchased directly + /// through the Azure web portal are not supported through this preview API. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IBillingPeriodsOperations operations, string nextPageLink) + { + return ((IBillingPeriodsOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the available billing periods for a subscription in reverse + /// chronological order. This is only supported for Azure Web-Direct + /// subscriptions. Other subscription types which were not purchased directly + /// through the Azure web portal are not supported through this preview API. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IBillingPeriodsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingPermissionsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingPermissionsOperations.cs new file mode 100644 index 000000000000..f6f8957e98c4 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingPermissionsOperations.cs @@ -0,0 +1,1546 @@ +// 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 System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// BillingPermissionsOperations operations. + /// + internal partial class BillingPermissionsOperations : Microsoft.Rest.IServiceOperations, IBillingPermissionsOperations + { + /// + /// Initializes a new instance of the BillingPermissionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal BillingPermissionsOperations (BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// Lists the billing permissions the caller has for a customer. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (customerName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "customerName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("customerName", customerName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByCustomer", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/billingPermissions").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the billing permissions the caller has on a billing account. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingAccountName", billingAccountName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingPermissions").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the billing permissions the caller has on an invoice section. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListByInvoiceSectionsWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (billingProfileName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); + } + + if (invoiceSectionName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "invoiceSectionName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("invoiceSectionName", invoiceSectionName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSections", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingPermissions").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the billing permissions the caller has on a billing profile. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (billingProfileName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingPermissions").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the billing permissions the caller has for a customer. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByCustomerNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByCustomerNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the billing permissions the caller has on a billing account. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the billing permissions the caller has on an invoice section. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByInvoiceSectionsNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSectionsNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the billing permissions the caller has on a billing profile. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingPermissionsOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingPermissionsOperationsExtensions.cs new file mode 100644 index 000000000000..a7f469491752 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingPermissionsOperationsExtensions.cs @@ -0,0 +1,304 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for BillingPermissionsOperations + /// + public static partial class BillingPermissionsOperationsExtensions + { + /// + /// Lists the billing permissions the caller has for a customer. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + public static Microsoft.Rest.Azure.IPage ListByCustomer(this IBillingPermissionsOperations operations, string billingAccountName, string customerName) + { + return ((IBillingPermissionsOperations)operations).ListByCustomerAsync(billingAccountName, customerName).GetAwaiter().GetResult(); + } + + /// + /// Lists the billing permissions the caller has for a customer. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByCustomerAsync(this IBillingPermissionsOperations operations, string billingAccountName, string customerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByCustomerWithHttpMessagesAsync(billingAccountName, customerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the billing permissions the caller has on a billing account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingAccount(this IBillingPermissionsOperations operations, string billingAccountName) + { + return ((IBillingPermissionsOperations)operations).ListByBillingAccountAsync(billingAccountName).GetAwaiter().GetResult(); + } + + /// + /// Lists the billing permissions the caller has on a billing account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingAccountAsync(this IBillingPermissionsOperations operations, string billingAccountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the billing permissions the caller has on an invoice section. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + public static Microsoft.Rest.Azure.IPage ListByInvoiceSections(this IBillingPermissionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName) + { + return ((IBillingPermissionsOperations)operations).ListByInvoiceSectionsAsync(billingAccountName, billingProfileName, invoiceSectionName).GetAwaiter().GetResult(); + } + + /// + /// Lists the billing permissions the caller has on an invoice section. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByInvoiceSectionsAsync(this IBillingPermissionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByInvoiceSectionsWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the billing permissions the caller has on a billing profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingProfile(this IBillingPermissionsOperations operations, string billingAccountName, string billingProfileName) + { + return ((IBillingPermissionsOperations)operations).ListByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + } + + /// + /// Lists the billing permissions the caller has on a billing profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingProfileAsync(this IBillingPermissionsOperations operations, string billingAccountName, string billingProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the billing permissions the caller has for a customer. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByCustomerNext(this IBillingPermissionsOperations operations, string nextPageLink) + { + return ((IBillingPermissionsOperations)operations).ListByCustomerNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the billing permissions the caller has for a customer. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByCustomerNextAsync(this IBillingPermissionsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByCustomerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the billing permissions the caller has on a billing account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingAccountNext(this IBillingPermissionsOperations operations, string nextPageLink) + { + return ((IBillingPermissionsOperations)operations).ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the billing permissions the caller has on a billing account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingAccountNextAsync(this IBillingPermissionsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the billing permissions the caller has on an invoice section. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByInvoiceSectionsNext(this IBillingPermissionsOperations operations, string nextPageLink) + { + return ((IBillingPermissionsOperations)operations).ListByInvoiceSectionsNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the billing permissions the caller has on an invoice section. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByInvoiceSectionsNextAsync(this IBillingPermissionsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByInvoiceSectionsNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the billing permissions the caller has on a billing profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingProfileNext(this IBillingPermissionsOperations operations, string nextPageLink) + { + return ((IBillingPermissionsOperations)operations).ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the billing permissions the caller has on a billing profile. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingProfileNextAsync(this IBillingPermissionsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingProfilesOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingProfilesOperations.cs new file mode 100644 index 000000000000..71d33a45e258 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingProfilesOperations.cs @@ -0,0 +1,890 @@ +// 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 System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// BillingProfilesOperations operations. + /// + internal partial class BillingProfilesOperations : Microsoft.Rest.IServiceOperations, IBillingProfilesOperations + { + /// + /// Initializes a new instance of the BillingProfilesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal BillingProfilesOperations (BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// Lists the billing profiles that a user has access to. The operation is + /// supported for billing accounts with agreement type Microsoft Customer + /// Agreement or Microsoft Partner Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// May be used to expand the invoice sections. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("expand", expand); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); + } + // Construct URL + + var _baseUrl = this.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)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Gets a billing profile by its ID. The operation is supported for billing + /// accounts with agreement type Microsoft Customer Agreement or Microsoft + /// Partner Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// May be used to expand the invoice sections. + /// + /// + /// 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 System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (billingProfileName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); + } + + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("expand", expand); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Creates or updates a billing profile. The operation is supported for + /// billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The new or updated billing profile. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, BillingProfile parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(billingAccountName, billingProfileName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates or updates a billing profile. The operation is supported for + /// billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The new or updated billing profile. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, BillingProfile parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (billingProfileName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + + tracingParameters.Add("parameters", parameters); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the billing profiles that a user has access to. The operation is + /// supported for billing accounts with agreement type Microsoft Customer + /// Agreement or Microsoft Partner Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingProfilesOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingProfilesOperationsExtensions.cs new file mode 100644 index 000000000000..02aa89243b84 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingProfilesOperationsExtensions.cs @@ -0,0 +1,231 @@ +// 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.Azure; + using Models; + + /// + /// Extension methods for BillingProfilesOperations + /// + public static partial class BillingProfilesOperationsExtensions + { + /// + /// Lists the billing profiles that a user has access to. The operation is + /// supported for billing accounts with agreement type Microsoft Customer + /// Agreement or Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// May be used to expand the invoice sections. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingAccount(this IBillingProfilesOperations operations, string billingAccountName, string expand = default(string)) + { + return ((IBillingProfilesOperations)operations).ListByBillingAccountAsync(billingAccountName, expand).GetAwaiter().GetResult(); + } + + /// + /// Lists the billing profiles that a user has access to. The operation is + /// supported for billing accounts with agreement type Microsoft Customer + /// Agreement or Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// May be used to expand the invoice sections. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingAccountAsync(this IBillingProfilesOperations operations, string billingAccountName, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Gets a billing profile by its ID. The operation is supported for billing + /// accounts with agreement type Microsoft Customer Agreement or Microsoft + /// Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// May be used to expand the invoice sections. + /// + public static BillingProfile Get(this IBillingProfilesOperations operations, string billingAccountName, string billingProfileName, string expand = default(string)) + { + return ((IBillingProfilesOperations)operations).GetAsync(billingAccountName, billingProfileName, expand).GetAwaiter().GetResult(); + } + + /// + /// Gets a billing profile by its ID. The operation is supported for billing + /// accounts with agreement type Microsoft Customer Agreement or Microsoft + /// Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// May be used to expand the invoice sections. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IBillingProfilesOperations operations, string billingAccountName, string billingProfileName, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, billingProfileName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Creates or updates a billing profile. The operation is supported for + /// billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + public static BillingProfile CreateOrUpdate(this IBillingProfilesOperations operations, string billingAccountName, string billingProfileName, BillingProfile parameters) + { + return ((IBillingProfilesOperations)operations).CreateOrUpdateAsync(billingAccountName, billingProfileName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a billing profile. The operation is supported for + /// billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IBillingProfilesOperations operations, string billingAccountName, string billingProfileName, BillingProfile parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(billingAccountName, billingProfileName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Creates or updates a billing profile. The operation is supported for + /// billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + public static BillingProfile BeginCreateOrUpdate(this IBillingProfilesOperations operations, string billingAccountName, string billingProfileName, BillingProfile parameters) + { + return ((IBillingProfilesOperations)operations).BeginCreateOrUpdateAsync(billingAccountName, billingProfileName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a billing profile. The operation is supported for + /// billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginCreateOrUpdateAsync(this IBillingProfilesOperations operations, string billingAccountName, string billingProfileName, BillingProfile parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(billingAccountName, billingProfileName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the billing profiles that a user has access to. The operation is + /// supported for billing accounts with agreement type Microsoft Customer + /// Agreement or Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingAccountNext(this IBillingProfilesOperations operations, string nextPageLink) + { + return ((IBillingProfilesOperations)operations).ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the billing profiles that a user has access to. The operation is + /// supported for billing accounts with agreement type Microsoft Customer + /// Agreement or Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingAccountNextAsync(this IBillingProfilesOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingPropertyOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingPropertyOperations.cs new file mode 100644 index 000000000000..9200d74de6c9 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingPropertyOperations.cs @@ -0,0 +1,430 @@ +// 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 System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// BillingPropertyOperations operations. + /// + internal partial class BillingPropertyOperations : Microsoft.Rest.IServiceOperations, IBillingPropertyOperations + { + /// + /// Initializes a new instance of the BillingPropertyOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal BillingPropertyOperations (BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// Get the billing properties for a subscription. This operation is not + /// supported for billing accounts with agreement type Enterprise Agreement. + /// + /// + /// 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 System.Threading.Tasks.Task> GetWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingProperty/default").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Updates the billing property of a subscription. Currently, cost center can + /// be updated. The operation is supported only for billing accounts with + /// agreement type Microsoft Customer Agreement. + /// + /// + /// Request parameters that are provided to the update billing property + /// 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 System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(BillingProperty parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + } + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("parameters", parameters); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingProperty/default").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingPropertyOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingPropertyOperationsExtensions.cs new file mode 100644 index 000000000000..fbd2bf27a20c --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingPropertyOperationsExtensions.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for BillingPropertyOperations + /// + public static partial class BillingPropertyOperationsExtensions + { + /// + /// Get the billing properties for a subscription. This operation is not + /// supported for billing accounts with agreement type Enterprise Agreement. + /// + /// + /// The operations group for this extension method. + /// + public static BillingProperty Get(this IBillingPropertyOperations operations) + { + return ((IBillingPropertyOperations)operations).GetAsync().GetAwaiter().GetResult(); + } + + /// + /// Get the billing properties for a subscription. This operation is not + /// supported for billing accounts with agreement type Enterprise Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IBillingPropertyOperations operations, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Updates the billing property of a subscription. Currently, cost center can + /// be updated. The operation is supported only for billing accounts with + /// agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + public static BillingProperty Update(this IBillingPropertyOperations operations, BillingProperty parameters) + { + return ((IBillingPropertyOperations)operations).UpdateAsync(parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates the billing property of a subscription. Currently, cost center can + /// be updated. The operation is supported only for billing accounts with + /// agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this IBillingPropertyOperations operations, BillingProperty parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingRoleAssignmentsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingRoleAssignmentsOperations.cs new file mode 100644 index 000000000000..71f970b97d1d --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingRoleAssignmentsOperations.cs @@ -0,0 +1,2448 @@ +// 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 System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// BillingRoleAssignmentsOperations operations. + /// + internal partial class BillingRoleAssignmentsOperations : Microsoft.Rest.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"); + } + this.Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// Gets a role assignment for the caller on a billing account. The operation + /// is supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// 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 System.Threading.Tasks.Task> GetByBillingAccountWithHttpMessagesAsync(string billingAccountName, string billingRoleAssignmentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (billingRoleAssignmentName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingRoleAssignmentName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingRoleAssignmentName", billingRoleAssignmentName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetByBillingAccount", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments/{billingRoleAssignmentName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingRoleAssignmentName}", System.Uri.EscapeDataString(billingRoleAssignmentName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Deletes a role assignment for the caller on a billing account. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// 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 System.Threading.Tasks.Task> DeleteByBillingAccountWithHttpMessagesAsync(string billingAccountName, string billingRoleAssignmentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (billingRoleAssignmentName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingRoleAssignmentName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingRoleAssignmentName", billingRoleAssignmentName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "DeleteByBillingAccount", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments/{billingRoleAssignmentName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingRoleAssignmentName}", System.Uri.EscapeDataString(billingRoleAssignmentName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Gets a role assignment for the caller on an invoice section. The operation + /// is supported for billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// 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 System.Threading.Tasks.Task> GetByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (billingProfileName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); + } + + if (invoiceSectionName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "invoiceSectionName"); + } + + if (billingRoleAssignmentName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingRoleAssignmentName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("invoiceSectionName", invoiceSectionName); + tracingParameters.Add("billingRoleAssignmentName", billingRoleAssignmentName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetByInvoiceSection", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleAssignments/{billingRoleAssignmentName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); + _url = _url.Replace("{billingRoleAssignmentName}", System.Uri.EscapeDataString(billingRoleAssignmentName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Deletes a role assignment for the caller on an invoice section. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// 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 System.Threading.Tasks.Task> DeleteByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (billingProfileName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); + } + + if (invoiceSectionName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "invoiceSectionName"); + } + + if (billingRoleAssignmentName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingRoleAssignmentName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("invoiceSectionName", invoiceSectionName); + tracingParameters.Add("billingRoleAssignmentName", billingRoleAssignmentName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "DeleteByInvoiceSection", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleAssignments/{billingRoleAssignmentName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); + _url = _url.Replace("{billingRoleAssignmentName}", System.Uri.EscapeDataString(billingRoleAssignmentName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Gets a role assignment for the caller on a billing profile. The operation + /// is supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// 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 System.Threading.Tasks.Task> GetByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (billingProfileName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); + } + + if (billingRoleAssignmentName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingRoleAssignmentName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("billingRoleAssignmentName", billingRoleAssignmentName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetByBillingProfile", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/{billingRoleAssignmentName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{billingRoleAssignmentName}", System.Uri.EscapeDataString(billingRoleAssignmentName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Deletes a role assignment for the caller on a billing profile. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// 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 System.Threading.Tasks.Task> DeleteByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (billingProfileName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); + } + + if (billingRoleAssignmentName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingRoleAssignmentName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("billingRoleAssignmentName", billingRoleAssignmentName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "DeleteByBillingProfile", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/{billingRoleAssignmentName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{billingRoleAssignmentName}", System.Uri.EscapeDataString(billingRoleAssignmentName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the role assignments for the caller on a billing account. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingAccountName", billingAccountName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the role assignments for the caller on an invoice section. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (billingProfileName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); + } + + if (invoiceSectionName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "invoiceSectionName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("invoiceSectionName", invoiceSectionName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSection", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleAssignments").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the role assignments for the caller on a billing profile. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (billingProfileName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the role assignments for the caller on a billing account. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the role assignments for the caller on an invoice section. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByInvoiceSectionNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSectionNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the role assignments for the caller on a billing profile. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingRoleAssignmentsOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingRoleAssignmentsOperationsExtensions.cs new file mode 100644 index 000000000000..56ed16eac072 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingRoleAssignmentsOperationsExtensions.cs @@ -0,0 +1,550 @@ +// 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.Azure; + using Models; + + /// + /// Extension methods for BillingRoleAssignmentsOperations + /// + public static partial class BillingRoleAssignmentsOperationsExtensions + { + /// + /// Gets a role assignment for the caller on a billing account. The operation + /// is supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + public static BillingRoleAssignment GetByBillingAccount(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingRoleAssignmentName) + { + return ((IBillingRoleAssignmentsOperations)operations).GetByBillingAccountAsync(billingAccountName, billingRoleAssignmentName).GetAwaiter().GetResult(); + } + + /// + /// Gets a role assignment for the caller on a billing account. The operation + /// is supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetByBillingAccountAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingRoleAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetByBillingAccountWithHttpMessagesAsync(billingAccountName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Deletes a role assignment for the caller on a billing account. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + public static BillingRoleAssignment DeleteByBillingAccount(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingRoleAssignmentName) + { + return ((IBillingRoleAssignmentsOperations)operations).DeleteByBillingAccountAsync(billingAccountName, billingRoleAssignmentName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a role assignment for the caller on a billing account. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteByBillingAccountAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingRoleAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.DeleteByBillingAccountWithHttpMessagesAsync(billingAccountName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Gets a role assignment for the caller on an invoice section. The operation + /// is supported for billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + public static BillingRoleAssignment GetByInvoiceSection(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName) + { + return ((IBillingRoleAssignmentsOperations)operations).GetByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName).GetAwaiter().GetResult(); + } + + /// + /// Gets a role assignment for the caller on an invoice section. The operation + /// is supported for billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetByInvoiceSectionAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Deletes a role assignment for the caller on an invoice section. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + public static BillingRoleAssignment DeleteByInvoiceSection(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName) + { + return ((IBillingRoleAssignmentsOperations)operations).DeleteByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a role assignment for the caller on an invoice section. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteByInvoiceSectionAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.DeleteByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Gets a role assignment for the caller on a billing profile. The operation + /// is supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + public static BillingRoleAssignment GetByBillingProfile(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string billingRoleAssignmentName) + { + return ((IBillingRoleAssignmentsOperations)operations).GetByBillingProfileAsync(billingAccountName, billingProfileName, billingRoleAssignmentName).GetAwaiter().GetResult(); + } + + /// + /// Gets a role assignment for the caller on a billing profile. The operation + /// is supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetByBillingProfileAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string billingRoleAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Deletes a role assignment for the caller on a billing profile. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + public static BillingRoleAssignment DeleteByBillingProfile(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string billingRoleAssignmentName) + { + return ((IBillingRoleAssignmentsOperations)operations).DeleteByBillingProfileAsync(billingAccountName, billingProfileName, billingRoleAssignmentName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a role assignment for the caller on a billing profile. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteByBillingProfileAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string billingRoleAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.DeleteByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, billingRoleAssignmentName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the role assignments for the caller on a billing account. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingAccount(this IBillingRoleAssignmentsOperations operations, string billingAccountName) + { + return ((IBillingRoleAssignmentsOperations)operations).ListByBillingAccountAsync(billingAccountName).GetAwaiter().GetResult(); + } + + /// + /// Lists the role assignments for the caller on a billing account. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingAccountAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the role assignments for the caller on an invoice section. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + public static Microsoft.Rest.Azure.IPage ListByInvoiceSection(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName) + { + return ((IBillingRoleAssignmentsOperations)operations).ListByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName).GetAwaiter().GetResult(); + } + + /// + /// Lists the role assignments for the caller on an invoice section. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByInvoiceSectionAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the role assignments for the caller on a billing profile. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingProfile(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName) + { + return ((IBillingRoleAssignmentsOperations)operations).ListByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + } + + /// + /// Lists the role assignments for the caller on a billing profile. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingProfileAsync(this IBillingRoleAssignmentsOperations operations, string billingAccountName, string billingProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the role assignments for the caller on a billing account. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingAccountNext(this IBillingRoleAssignmentsOperations operations, string nextPageLink) + { + return ((IBillingRoleAssignmentsOperations)operations).ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the role assignments for the caller on a billing account. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingAccountNextAsync(this IBillingRoleAssignmentsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the role assignments for the caller on an invoice section. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByInvoiceSectionNext(this IBillingRoleAssignmentsOperations operations, string nextPageLink) + { + return ((IBillingRoleAssignmentsOperations)operations).ListByInvoiceSectionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the role assignments for the caller on an invoice section. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByInvoiceSectionNextAsync(this IBillingRoleAssignmentsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByInvoiceSectionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the role assignments for the caller on a billing profile. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingProfileNext(this IBillingRoleAssignmentsOperations operations, string nextPageLink) + { + return ((IBillingRoleAssignmentsOperations)operations).ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the role assignments for the caller on a billing profile. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingProfileNextAsync(this IBillingRoleAssignmentsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingRoleDefinitionsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingRoleDefinitionsOperations.cs new file mode 100644 index 000000000000..81ad3b431df7 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingRoleDefinitionsOperations.cs @@ -0,0 +1,1815 @@ +// 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 System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// BillingRoleDefinitionsOperations operations. + /// + internal partial class BillingRoleDefinitionsOperations : Microsoft.Rest.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"); + } + this.Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// Gets the definition for a role on a billing account. The operation is + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a role definition. + /// + /// + /// 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 System.Threading.Tasks.Task> GetByBillingAccountWithHttpMessagesAsync(string billingAccountName, string billingRoleDefinitionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (billingRoleDefinitionName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingRoleDefinitionName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingRoleDefinitionName", billingRoleDefinitionName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetByBillingAccount", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleDefinitions/{billingRoleDefinitionName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingRoleDefinitionName}", System.Uri.EscapeDataString(billingRoleDefinitionName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Gets the definition for a role on an invoice section. The operation is + /// supported only for billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The ID that uniquely identifies a role definition. + /// + /// + /// 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 System.Threading.Tasks.Task> GetByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleDefinitionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (billingProfileName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); + } + + if (invoiceSectionName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "invoiceSectionName"); + } + + if (billingRoleDefinitionName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingRoleDefinitionName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("invoiceSectionName", invoiceSectionName); + tracingParameters.Add("billingRoleDefinitionName", billingRoleDefinitionName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetByInvoiceSection", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleDefinitions/{billingRoleDefinitionName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); + _url = _url.Replace("{billingRoleDefinitionName}", System.Uri.EscapeDataString(billingRoleDefinitionName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Gets the definition for a role on a billing profile. The operation is + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies a role definition. + /// + /// + /// 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 System.Threading.Tasks.Task> GetByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleDefinitionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (billingProfileName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); + } + + if (billingRoleDefinitionName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingRoleDefinitionName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("billingRoleDefinitionName", billingRoleDefinitionName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetByBillingProfile", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions/{billingRoleDefinitionName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{billingRoleDefinitionName}", System.Uri.EscapeDataString(billingRoleDefinitionName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the role definitions for a billing account. The operation is + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingAccountName", billingAccountName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleDefinitions").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the role definitions for an invoice section. The operation is + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (billingProfileName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); + } + + if (invoiceSectionName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "invoiceSectionName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("invoiceSectionName", invoiceSectionName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSection", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleDefinitions").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the role definitions for a billing profile. The operation is + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (billingProfileName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the role definitions for a billing account. The operation is + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the role definitions for an invoice section. The operation is + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByInvoiceSectionNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSectionNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the role definitions for a billing profile. The operation is + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingRoleDefinitionsOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingRoleDefinitionsOperationsExtensions.cs new file mode 100644 index 000000000000..24b40eee97e3 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingRoleDefinitionsOperationsExtensions.cs @@ -0,0 +1,403 @@ +// 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.Azure; + using Models; + + /// + /// Extension methods for BillingRoleDefinitionsOperations + /// + public static partial class BillingRoleDefinitionsOperationsExtensions + { + /// + /// Gets the definition for a role on a billing account. The operation is + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a role definition. + /// + public static BillingRoleDefinition GetByBillingAccount(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingRoleDefinitionName) + { + return ((IBillingRoleDefinitionsOperations)operations).GetByBillingAccountAsync(billingAccountName, billingRoleDefinitionName).GetAwaiter().GetResult(); + } + + /// + /// Gets the definition for a role on a billing account. The operation is + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a role definition. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetByBillingAccountAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingRoleDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetByBillingAccountWithHttpMessagesAsync(billingAccountName, billingRoleDefinitionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Gets the definition for a role on an invoice section. The operation is + /// supported only for billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The ID that uniquely identifies a role definition. + /// + public static BillingRoleDefinition GetByInvoiceSection(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleDefinitionName) + { + return ((IBillingRoleDefinitionsOperations)operations).GetByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleDefinitionName).GetAwaiter().GetResult(); + } + + /// + /// Gets the definition for a role on an invoice section. The operation is + /// supported only for billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The ID that uniquely identifies a role definition. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetByInvoiceSectionAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleDefinitionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Gets the definition for a role on a billing profile. The operation is + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies a role definition. + /// + public static BillingRoleDefinition GetByBillingProfile(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, string billingRoleDefinitionName) + { + return ((IBillingRoleDefinitionsOperations)operations).GetByBillingProfileAsync(billingAccountName, billingProfileName, billingRoleDefinitionName).GetAwaiter().GetResult(); + } + + /// + /// Gets the definition for a role on a billing profile. The operation is + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies a role definition. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetByBillingProfileAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, string billingRoleDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, billingRoleDefinitionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the role definitions for a billing account. The operation is + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingAccount(this IBillingRoleDefinitionsOperations operations, string billingAccountName) + { + return ((IBillingRoleDefinitionsOperations)operations).ListByBillingAccountAsync(billingAccountName).GetAwaiter().GetResult(); + } + + /// + /// Lists the role definitions for a billing account. The operation is + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingAccountAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the role definitions for an invoice section. The operation is + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + public static Microsoft.Rest.Azure.IPage ListByInvoiceSection(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName) + { + return ((IBillingRoleDefinitionsOperations)operations).ListByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName).GetAwaiter().GetResult(); + } + + /// + /// Lists the role definitions for an invoice section. The operation is + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByInvoiceSectionAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the role definitions for a billing profile. The operation is + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingProfile(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName) + { + return ((IBillingRoleDefinitionsOperations)operations).ListByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + } + + /// + /// Lists the role definitions for a billing profile. The operation is + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingProfileAsync(this IBillingRoleDefinitionsOperations operations, string billingAccountName, string billingProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the role definitions for a billing account. The operation is + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingAccountNext(this IBillingRoleDefinitionsOperations operations, string nextPageLink) + { + return ((IBillingRoleDefinitionsOperations)operations).ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the role definitions for a billing account. The operation is + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingAccountNextAsync(this IBillingRoleDefinitionsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the role definitions for an invoice section. The operation is + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByInvoiceSectionNext(this IBillingRoleDefinitionsOperations operations, string nextPageLink) + { + return ((IBillingRoleDefinitionsOperations)operations).ListByInvoiceSectionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the role definitions for an invoice section. The operation is + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByInvoiceSectionNextAsync(this IBillingRoleDefinitionsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByInvoiceSectionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the role definitions for a billing profile. The operation is + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingProfileNext(this IBillingRoleDefinitionsOperations operations, string nextPageLink) + { + return ((IBillingRoleDefinitionsOperations)operations).ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the role definitions for a billing profile. The operation is + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingProfileNextAsync(this IBillingRoleDefinitionsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingSubscriptionsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingSubscriptionsOperations.cs new file mode 100644 index 000000000000..f0e61919610d --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingSubscriptionsOperations.cs @@ -0,0 +1,2439 @@ +// 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 System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// BillingSubscriptionsOperations operations. + /// + internal partial class BillingSubscriptionsOperations : Microsoft.Rest.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"); + } + this.Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// Lists the subscriptions for a customer. The operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (customerName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "customerName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("customerName", customerName); + tracingParameters.Add("apiVersion", apiVersion); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByCustomer", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/billingSubscriptions").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the subscriptions for a billing account. The operation is supported + /// for billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("apiVersion", apiVersion); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); + } + // Construct URL + + var _baseUrl = this.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)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the subscriptions that are billed to a billing profile. The operation + /// is supported for billing accounts with agreement type Microsoft Customer + /// Agreement or Microsoft Partner Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (billingProfileName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("apiVersion", apiVersion); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); + } + // Construct URL + + var _baseUrl = this.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)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the subscriptions that are billed to an invoice section. The + /// operation is supported only for billing accounts with agreement type + /// Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (billingProfileName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); + } + + if (invoiceSectionName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "invoiceSectionName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("invoiceSectionName", invoiceSectionName); + tracingParameters.Add("apiVersion", apiVersion); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSection", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingSubscriptions").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Gets a subscription by its ID. The operation is supported for billing + /// accounts with agreement type Microsoft Customer Agreement and Microsoft + /// Partner Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// 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 System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingAccountName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("apiVersion", apiVersion); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Updates the properties of a billing subscription. Currently, cost center + /// can be updated. The operation is supported only for billing accounts with + /// agreement type Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// Request parameters that are provided to the update 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 System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string billingAccountName, BillingSubscription parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + } + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("parameters", parameters); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Moves a subscription's charges to a new invoice section. The new invoice + /// section must belong to the same billing profile as the existing invoice + /// section. This operation is supported for billing accounts with agreement + /// type Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// Request parameters that are provided to the move subscription operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> MoveWithHttpMessagesAsync(string billingAccountName, TransferBillingSubscriptionRequestProperties parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginMoveWithHttpMessagesAsync(billingAccountName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Validates if a subscription's charges can be moved to a new invoice + /// section. This operation is supported for billing accounts with agreement + /// type Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// Request parameters that are provided to the validate move eligibility + /// 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 System.Threading.Tasks.Task> ValidateMoveWithHttpMessagesAsync(string billingAccountName, TransferBillingSubscriptionRequestProperties parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("parameters", parameters); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ValidateMove", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}/validateMoveEligibility").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Moves a subscription's charges to a new invoice section. The new invoice + /// section must belong to the same billing profile as the existing invoice + /// section. This operation is supported for billing accounts with agreement + /// type Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// Request parameters that are provided to the move 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 System.Threading.Tasks.Task> BeginMoveWithHttpMessagesAsync(string billingAccountName, TransferBillingSubscriptionRequestProperties parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("parameters", parameters); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginMove", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}/move").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the subscriptions for a customer. The operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByCustomerNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByCustomerNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the subscriptions for a billing account. The operation is supported + /// for billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the subscriptions that are billed to a billing profile. The operation + /// is supported for billing accounts with agreement type Microsoft Customer + /// Agreement or Microsoft Partner Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the subscriptions that are billed to an invoice section. The + /// operation is supported only for billing accounts with agreement type + /// Microsoft Customer Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByInvoiceSectionNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSectionNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/BillingSubscriptionsOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/BillingSubscriptionsOperationsExtensions.cs new file mode 100644 index 000000000000..38ba9968e7ad --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/BillingSubscriptionsOperationsExtensions.cs @@ -0,0 +1,521 @@ +// 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.Azure; + using Models; + + /// + /// Extension methods for BillingSubscriptionsOperations + /// + public static partial class BillingSubscriptionsOperationsExtensions + { + /// + /// Lists the subscriptions for a customer. The operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + public static Microsoft.Rest.Azure.IPage ListByCustomer(this IBillingSubscriptionsOperations operations, string billingAccountName, string customerName) + { + return ((IBillingSubscriptionsOperations)operations).ListByCustomerAsync(billingAccountName, customerName).GetAwaiter().GetResult(); + } + + /// + /// Lists the subscriptions for a customer. The operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByCustomerAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string customerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByCustomerWithHttpMessagesAsync(billingAccountName, customerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the subscriptions for a billing account. The operation is supported + /// for billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingAccount(this IBillingSubscriptionsOperations operations, string billingAccountName) + { + return ((IBillingSubscriptionsOperations)operations).ListByBillingAccountAsync(billingAccountName).GetAwaiter().GetResult(); + } + + /// + /// Lists the subscriptions for a billing account. The operation is supported + /// for billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingAccountAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the subscriptions that are billed to a billing profile. The operation + /// is supported for billing accounts with agreement type Microsoft Customer + /// Agreement or Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingProfile(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName) + { + return ((IBillingSubscriptionsOperations)operations).ListByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + } + + /// + /// Lists the subscriptions that are billed to a billing profile. The operation + /// is supported for billing accounts with agreement type Microsoft Customer + /// Agreement or Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingProfileAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the subscriptions that are billed to an invoice section. The + /// operation is supported only for billing accounts with agreement type + /// Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + public static Microsoft.Rest.Azure.IPage ListByInvoiceSection(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName) + { + return ((IBillingSubscriptionsOperations)operations).ListByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName).GetAwaiter().GetResult(); + } + + /// + /// Lists the subscriptions that are billed to an invoice section. The + /// operation is supported only for billing accounts with agreement type + /// Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByInvoiceSectionAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Gets a subscription by its ID. The operation is supported for billing + /// accounts with agreement type Microsoft Customer Agreement and Microsoft + /// Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + public static BillingSubscription Get(this IBillingSubscriptionsOperations operations, string billingAccountName) + { + return ((IBillingSubscriptionsOperations)operations).GetAsync(billingAccountName).GetAwaiter().GetResult(); + } + + /// + /// Gets a subscription by its ID. The operation is supported for billing + /// accounts with agreement type Microsoft Customer Agreement and Microsoft + /// Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Updates the properties of a billing subscription. Currently, cost center + /// can be updated. The operation is supported only for billing accounts with + /// agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + public static BillingSubscription Update(this IBillingSubscriptionsOperations operations, string billingAccountName, BillingSubscription parameters) + { + return ((IBillingSubscriptionsOperations)operations).UpdateAsync(billingAccountName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates the properties of a billing subscription. Currently, cost center + /// can be updated. The operation is supported only for billing accounts with + /// agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, BillingSubscription parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(billingAccountName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Moves a subscription's charges to a new invoice section. The new invoice + /// section must belong to the same billing profile as the existing invoice + /// section. This operation is supported for billing accounts with agreement + /// type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + public static BillingSubscription Move(this IBillingSubscriptionsOperations operations, string billingAccountName, TransferBillingSubscriptionRequestProperties parameters) + { + return ((IBillingSubscriptionsOperations)operations).MoveAsync(billingAccountName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Moves a subscription's charges to a new invoice section. The new invoice + /// section must belong to the same billing profile as the existing invoice + /// section. This operation is supported for billing accounts with agreement + /// type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task MoveAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, TransferBillingSubscriptionRequestProperties parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.MoveWithHttpMessagesAsync(billingAccountName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Validates if a subscription's charges can be moved to a new invoice + /// section. This operation is supported for billing accounts with agreement + /// type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + public static ValidateSubscriptionTransferEligibilityResult ValidateMove(this IBillingSubscriptionsOperations operations, string billingAccountName, TransferBillingSubscriptionRequestProperties parameters) + { + return ((IBillingSubscriptionsOperations)operations).ValidateMoveAsync(billingAccountName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Validates if a subscription's charges can be moved to a new invoice + /// section. This operation is supported for billing accounts with agreement + /// type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task ValidateMoveAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, TransferBillingSubscriptionRequestProperties parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ValidateMoveWithHttpMessagesAsync(billingAccountName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Moves a subscription's charges to a new invoice section. The new invoice + /// section must belong to the same billing profile as the existing invoice + /// section. This operation is supported for billing accounts with agreement + /// type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + public static BillingSubscription BeginMove(this IBillingSubscriptionsOperations operations, string billingAccountName, TransferBillingSubscriptionRequestProperties parameters) + { + return ((IBillingSubscriptionsOperations)operations).BeginMoveAsync(billingAccountName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Moves a subscription's charges to a new invoice section. The new invoice + /// section must belong to the same billing profile as the existing invoice + /// section. This operation is supported for billing accounts with agreement + /// type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginMoveAsync(this IBillingSubscriptionsOperations operations, string billingAccountName, TransferBillingSubscriptionRequestProperties parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginMoveWithHttpMessagesAsync(billingAccountName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the subscriptions for a customer. The operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByCustomerNext(this IBillingSubscriptionsOperations operations, string nextPageLink) + { + return ((IBillingSubscriptionsOperations)operations).ListByCustomerNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the subscriptions for a customer. The operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByCustomerNextAsync(this IBillingSubscriptionsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByCustomerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the subscriptions for a billing account. The operation is supported + /// for billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingAccountNext(this IBillingSubscriptionsOperations operations, string nextPageLink) + { + return ((IBillingSubscriptionsOperations)operations).ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the subscriptions for a billing account. The operation is supported + /// for billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingAccountNextAsync(this IBillingSubscriptionsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the subscriptions that are billed to a billing profile. The operation + /// is supported for billing accounts with agreement type Microsoft Customer + /// Agreement or Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingProfileNext(this IBillingSubscriptionsOperations operations, string nextPageLink) + { + return ((IBillingSubscriptionsOperations)operations).ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the subscriptions that are billed to a billing profile. The operation + /// is supported for billing accounts with agreement type Microsoft Customer + /// Agreement or Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingProfileNextAsync(this IBillingSubscriptionsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the subscriptions that are billed to an invoice section. The + /// operation is supported only for billing accounts with agreement type + /// Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByInvoiceSectionNext(this IBillingSubscriptionsOperations operations, string nextPageLink) + { + return ((IBillingSubscriptionsOperations)operations).ListByInvoiceSectionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the subscriptions that are billed to an invoice section. The + /// operation is supported only for billing accounts with agreement type + /// Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByInvoiceSectionNextAsync(this IBillingSubscriptionsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByInvoiceSectionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/CustomersOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/CustomersOperations.cs new file mode 100644 index 000000000000..cebe2432f220 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/CustomersOperations.cs @@ -0,0 +1,1039 @@ +// 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 System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// CustomersOperations operations. + /// + internal partial class CustomersOperations : Microsoft.Rest.IServiceOperations, ICustomersOperations + { + /// + /// Initializes a new instance of the CustomersOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CustomersOperations (BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// Lists the customers that are billed to a billing profile. The operation is + /// supported only for billing accounts with agreement type Microsoft Partner + /// Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Used for searching customers by their name. Any customer with name + /// containing the search text will be included in the response + /// + /// + /// May be used to filter the list of customers. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string search = default(string), string filter = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (billingProfileName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); + } + + + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("search", search); + tracingParameters.Add("filter", filter); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (search != null) + { + _queryParameters.Add(string.Format("$search={0}", System.Uri.EscapeDataString(search))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the customers that are billed to a billing account. The operation is + /// supported only for billing accounts with agreement type Microsoft Partner + /// Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// Used for searching customers by their name. Any customer with name + /// containing the search text will be included in the response + /// + /// + /// May be used to filter the list of customers. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string search = default(string), string filter = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("search", search); + tracingParameters.Add("filter", filter); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (search != null) + { + _queryParameters.Add(string.Format("$search={0}", System.Uri.EscapeDataString(search))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Gets a customer by its ID. The operation is supported only for billing + /// accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// May be used to expand enabledAzurePlans and resellers + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingAccountName, string customerName, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (customerName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "customerName"); + } + + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("customerName", customerName); + tracingParameters.Add("expand", expand); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the customers that are billed to a billing profile. The operation is + /// supported only for billing accounts with agreement type Microsoft Partner + /// Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the customers that are billed to a billing account. The operation is + /// supported only for billing accounts with agreement type Microsoft Partner + /// Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/CustomersOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/CustomersOperationsExtensions.cs new file mode 100644 index 000000000000..452aebfb8362 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/CustomersOperationsExtensions.cs @@ -0,0 +1,245 @@ +// 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.Azure; + using Models; + + /// + /// Extension methods for CustomersOperations + /// + public static partial class CustomersOperationsExtensions + { + /// + /// Lists the customers that are billed to a billing profile. The operation is + /// supported only for billing accounts with agreement type Microsoft Partner + /// Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Used for searching customers by their name. Any customer with name + /// containing the search text will be included in the response + /// + /// + /// May be used to filter the list of customers. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingProfile(this ICustomersOperations operations, string billingAccountName, string billingProfileName, string search = default(string), string filter = default(string)) + { + return ((ICustomersOperations)operations).ListByBillingProfileAsync(billingAccountName, billingProfileName, search, filter).GetAwaiter().GetResult(); + } + + /// + /// Lists the customers that are billed to a billing profile. The operation is + /// supported only for billing accounts with agreement type Microsoft Partner + /// Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Used for searching customers by their name. Any customer with name + /// containing the search text will be included in the response + /// + /// + /// May be used to filter the list of customers. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingProfileAsync(this ICustomersOperations operations, string billingAccountName, string billingProfileName, string search = default(string), string filter = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, search, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the customers that are billed to a billing account. The operation is + /// supported only for billing accounts with agreement type Microsoft Partner + /// Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// Used for searching customers by their name. Any customer with name + /// containing the search text will be included in the response + /// + /// + /// May be used to filter the list of customers. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingAccount(this ICustomersOperations operations, string billingAccountName, string search = default(string), string filter = default(string)) + { + return ((ICustomersOperations)operations).ListByBillingAccountAsync(billingAccountName, search, filter).GetAwaiter().GetResult(); + } + + /// + /// Lists the customers that are billed to a billing account. The operation is + /// supported only for billing accounts with agreement type Microsoft Partner + /// Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// Used for searching customers by their name. Any customer with name + /// containing the search text will be included in the response + /// + /// + /// May be used to filter the list of customers. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingAccountAsync(this ICustomersOperations operations, string billingAccountName, string search = default(string), string filter = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, search, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Gets a customer by its ID. The operation is supported only for billing + /// accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// May be used to expand enabledAzurePlans and resellers + /// + public static Customer Get(this ICustomersOperations operations, string billingAccountName, string customerName, string expand = default(string)) + { + return ((ICustomersOperations)operations).GetAsync(billingAccountName, customerName, expand).GetAwaiter().GetResult(); + } + + /// + /// Gets a customer by its ID. The operation is supported only for billing + /// accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// May be used to expand enabledAzurePlans and resellers + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this ICustomersOperations operations, string billingAccountName, string customerName, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, customerName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the customers that are billed to a billing profile. The operation is + /// supported only for billing accounts with agreement type Microsoft Partner + /// Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingProfileNext(this ICustomersOperations operations, string nextPageLink) + { + return ((ICustomersOperations)operations).ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the customers that are billed to a billing profile. The operation is + /// supported only for billing accounts with agreement type Microsoft Partner + /// Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingProfileNextAsync(this ICustomersOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the customers that are billed to a billing account. The operation is + /// supported only for billing accounts with agreement type Microsoft Partner + /// Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingAccountNext(this ICustomersOperations operations, string nextPageLink) + { + return ((ICustomersOperations)operations).ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the customers that are billed to a billing account. The operation is + /// supported only for billing accounts with agreement type Microsoft Partner + /// Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingAccountNextAsync(this ICustomersOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/EnrollmentAccountsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/EnrollmentAccountsOperations.cs new file mode 100644 index 000000000000..6d7e060fddac --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/EnrollmentAccountsOperations.cs @@ -0,0 +1,587 @@ +// 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 System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// EnrollmentAccountsOperations operations. + /// + internal partial class EnrollmentAccountsOperations : Microsoft.Rest.IServiceOperations, IEnrollmentAccountsOperations + { + /// + /// Initializes a new instance of the EnrollmentAccountsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal EnrollmentAccountsOperations (BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// Lists the enrollment accounts the caller has access to. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + string apiVersion = "2018-03-01-preview"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/enrollmentAccounts").ToString(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Gets a enrollment account by name. + /// + /// + /// Enrollment Account name. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "name"); + } + + string apiVersion = "2018-03-01-preview"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("apiVersion", apiVersion); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/enrollmentAccounts/{name}").ToString(); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the enrollment accounts the caller has access to. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/EnrollmentAccountsOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/EnrollmentAccountsOperationsExtensions.cs new file mode 100644 index 000000000000..53f005d9edd5 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/EnrollmentAccountsOperationsExtensions.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for EnrollmentAccountsOperations + /// + public static partial class EnrollmentAccountsOperationsExtensions + { + /// + /// Lists the enrollment accounts the caller has access to. + /// + /// + /// The operations group for this extension method. + /// + public static Microsoft.Rest.Azure.IPage List(this IEnrollmentAccountsOperations operations) + { + return ((IEnrollmentAccountsOperations)operations).ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists the enrollment accounts the caller has access to. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IEnrollmentAccountsOperations operations, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Gets a enrollment account by name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Enrollment Account name. + /// + public static EnrollmentAccountSummary Get(this IEnrollmentAccountsOperations operations, string name) + { + return ((IEnrollmentAccountsOperations)operations).GetAsync(name).GetAwaiter().GetResult(); + } + + /// + /// Gets a enrollment account by name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Enrollment Account name. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IEnrollmentAccountsOperations operations, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the enrollment accounts the caller has access to. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IEnrollmentAccountsOperations operations, string nextPageLink) + { + return ((IEnrollmentAccountsOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the enrollment accounts the caller has access to. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IEnrollmentAccountsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/IAddressOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IAddressOperations.cs new file mode 100644 index 000000000000..f342356b39a5 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/IAddressOperations.cs @@ -0,0 +1,42 @@ +// 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.Azure; + using Models; + + /// + /// AddressOperations operations. + /// + public partial interface IAddressOperations + { + /// + /// Validates an address. Use the operation to validate an address before using + /// it as soldTo or a billTo address. + /// + /// + /// Validates an address. Use the operation to validate an address before using + /// it as soldTo or a billTo address. + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> ValidateWithHttpMessagesAsync(AddressDetails address, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/IAgreementsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IAgreementsOperations.cs new file mode 100644 index 000000000000..9fc82a9cb1ac --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/IAgreementsOperations.cs @@ -0,0 +1,95 @@ +// 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.Azure; + using Models; + + /// + /// AgreementsOperations operations. + /// + public partial interface IAgreementsOperations + { + /// + /// Lists the agreements for a billing account. + /// + /// + /// Lists the agreements for a billing account. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// May be used to expand the participants. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets an agreement by ID. + /// + /// + /// Gets an agreement by ID. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an agreement. + /// + /// + /// May be used to expand the participants. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingAccountName, string agreementName, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the agreements for a billing account. + /// + /// + /// Lists the agreements for a billing account. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/IAvailableBalancesOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IAvailableBalancesOperations.cs new file mode 100644 index 000000000000..0994578947ba --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/IAvailableBalancesOperations.cs @@ -0,0 +1,49 @@ +// 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.Azure; + using Models; + + /// + /// AvailableBalancesOperations operations. + /// + public partial interface IAvailableBalancesOperations + { + /// + /// The available credit balance for a billing profile. This is the balance + /// that can be used for pay now to settle due or past due invoices. The + /// operation is supported only for billing accounts with agreement type + /// Microsoft Customer Agreement. + /// + /// + /// The available credit balance for a billing profile. This is the balance + /// that can be used for pay now to settle due or past due invoices. The + /// operation is supported only for billing accounts with agreement type + /// Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/IBillingAccountsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IBillingAccountsOperations.cs new file mode 100644 index 000000000000..d198a1a10dd7 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/IBillingAccountsOperations.cs @@ -0,0 +1,205 @@ +// 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.Azure; + using Models; + + /// + /// BillingAccountsOperations operations. + /// + public partial interface IBillingAccountsOperations + { + /// + /// Lists the billing accounts that a user has access to. + /// + /// + /// Lists the billing accounts that a user has access to. + /// + /// + /// May be used to expand the soldTo, invoice sections and billing profiles. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets a billing account by its ID. + /// + /// + /// Gets a billing account by its ID. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// May be used to expand the soldTo, invoice sections and billing profiles. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingAccountName, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Updates the properties of a billing account. Currently, displayName and + /// address can be updated. The operation is supported only for billing + /// accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// Updates the properties of a billing account. Currently, displayName and + /// address can be updated. The operation is supported only for billing + /// accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// Request parameters that are provided to the update billing account + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string billingAccountName, BillingAccountUpdateRequest parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the invoice sections for which the user has permission to create + /// Azure subscriptions. The operation is supported only for billing accounts + /// with agreement type Microsoft Customer Agreement. + /// + /// + /// Lists the invoice sections for which the user has permission to create + /// Azure subscriptions. The operation is supported only for billing accounts + /// with agreement type Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListInvoiceSectionsByCreateSubscriptionPermissionWithHttpMessagesAsync(string billingAccountName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Updates the properties of a billing account. Currently, displayName and + /// address can be updated. The operation is supported only for billing + /// accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// Updates the properties of a billing account. Currently, displayName and + /// address can be updated. The operation is supported only for billing + /// accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// Request parameters that are provided to the update billing account + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> BeginUpdateWithHttpMessagesAsync(string billingAccountName, BillingAccountUpdateRequest parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the billing accounts that a user has access to. + /// + /// + /// Lists the billing accounts that a user has access to. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the invoice sections for which the user has permission to create + /// Azure subscriptions. The operation is supported only for billing accounts + /// with agreement type Microsoft Customer Agreement. + /// + /// + /// Lists the invoice sections for which the user has permission to create + /// Azure subscriptions. The operation is supported only for billing accounts + /// with agreement type Microsoft Customer Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListInvoiceSectionsByCreateSubscriptionPermissionNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/IBillingManagementClient.cs b/src/Billing/Billing.Management.Sdk/Generated/IBillingManagementClient.cs new file mode 100644 index 000000000000..57b24aab88ef --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/IBillingManagementClient.cs @@ -0,0 +1,167 @@ +// 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; + + /// + /// Billing client provides access to billing resources for Azure + /// subscriptions. + /// + public partial interface IBillingManagementClient : System.IDisposable + { + /// + /// The base URI of the service. + /// + System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; } + + /// + /// Gets or sets json deserialization settings. + /// + Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + Microsoft.Rest.ServiceClientCredentials Credentials { get;} + + + /// + /// The ID that uniquely identifies an Azure subscription. + /// + string SubscriptionId { get; set;} + + + /// + /// The preferred language for the response. + /// + string AcceptLanguage { get; set;} + + + /// + /// The retry timeout in seconds for Long Running Operations. Default + /// /// value is 30. + /// + int? LongRunningOperationRetryTimeout { get; set;} + + + /// + /// Whether a unique x-ms-client-request-id should be generated. When + /// /// set to true a unique x-ms-client-request-id value is generated and + /// /// included in each request. Default is true. + /// + bool? GenerateClientRequestId { get; set;} + + + /// + /// Gets the IBillingAccountsOperations + /// + IBillingAccountsOperations BillingAccounts { get; } + + /// + /// Gets the IAddressOperations + /// + IAddressOperations Address { get; } + + /// + /// Gets the IAvailableBalancesOperations + /// + IAvailableBalancesOperations AvailableBalances { get; } + + /// + /// Gets the IInstructionsOperations + /// + IInstructionsOperations Instructions { get; } + + /// + /// Gets the IBillingProfilesOperations + /// + IBillingProfilesOperations BillingProfiles { get; } + + /// + /// Gets the ICustomersOperations + /// + ICustomersOperations Customers { get; } + + /// + /// Gets the IInvoiceSectionsOperations + /// + IInvoiceSectionsOperations InvoiceSections { get; } + + /// + /// Gets the IBillingPermissionsOperations + /// + IBillingPermissionsOperations BillingPermissions { get; } + + /// + /// Gets the IBillingSubscriptionsOperations + /// + IBillingSubscriptionsOperations BillingSubscriptions { get; } + + /// + /// Gets the IProductsOperations + /// + IProductsOperations Products { get; } + + /// + /// Gets the IInvoicesOperations + /// + IInvoicesOperations Invoices { get; } + + /// + /// Gets the ITransactionsOperations + /// + ITransactionsOperations Transactions { get; } + + /// + /// Gets the IPoliciesOperations + /// + IPoliciesOperations Policies { get; } + + /// + /// Gets the IBillingPropertyOperations + /// + IBillingPropertyOperations BillingProperty { get; } + + /// + /// Gets the IOperations + /// + IOperations Operations { get; } + + /// + /// Gets the IBillingRoleDefinitionsOperations + /// + IBillingRoleDefinitionsOperations BillingRoleDefinitions { get; } + + /// + /// Gets the IBillingRoleAssignmentsOperations + /// + IBillingRoleAssignmentsOperations BillingRoleAssignments { get; } + + /// + /// Gets the IAgreementsOperations + /// + IAgreementsOperations Agreements { get; } + + /// + /// Gets the IEnrollmentAccountsOperations + /// + IEnrollmentAccountsOperations EnrollmentAccounts { get; } + + /// + /// Gets the IBillingPeriodsOperations + /// + IBillingPeriodsOperations BillingPeriods { get; } + + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/IBillingPeriodsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IBillingPeriodsOperations.cs new file mode 100644 index 000000000000..56ac242bf84d --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/IBillingPeriodsOperations.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// BillingPeriodsOperations operations. + /// + public partial interface IBillingPeriodsOperations + { + /// + /// Lists the available billing periods for a subscription in reverse + /// chronological order. This is only supported for Azure Web-Direct + /// subscriptions. Other subscription types which were not purchased directly + /// through the Azure web portal are not supported through this preview API. + /// + /// + /// Lists the available billing periods for a subscription in reverse + /// chronological order. This is only supported for Azure Web-Direct + /// subscriptions. Other subscription types which were not purchased directly + /// through the Azure web portal are not supported through this preview API. + /// + /// + /// May be used to filter billing periods by billingPeriodEndDate. The filter + /// supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently + /// support 'ne', 'or', or 'not'. + /// + /// + /// Skiptoken is only used if a previous operation returned a partial result. + /// If a previous response contains a nextLink element, the value of the + /// nextLink element will include a skiptoken parameter that specifies a + /// starting point to use for subsequent calls. + /// + /// + /// May be used to limit the number of results to the most recent N billing + /// periods. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string filter = default(string), string skiptoken = default(string), int? top = default(int?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets a named billing period. This is only supported for Azure Web-Direct + /// subscriptions. Other subscription types which were not purchased directly + /// through the Azure web portal are not supported through this preview API. + /// + /// + /// Gets a named billing period. This is only supported for Azure Web-Direct + /// subscriptions. Other subscription types which were not purchased directly + /// through the Azure web portal are not supported through this preview API. + /// + /// + /// The name of a BillingPeriod resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingPeriodName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the available billing periods for a subscription in reverse + /// chronological order. This is only supported for Azure Web-Direct + /// subscriptions. Other subscription types which were not purchased directly + /// through the Azure web portal are not supported through this preview API. + /// + /// + /// Lists the available billing periods for a subscription in reverse + /// chronological order. This is only supported for Azure Web-Direct + /// subscriptions. Other subscription types which were not purchased directly + /// through the Azure web portal are not supported through this preview API. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/IBillingPermissionsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IBillingPermissionsOperations.cs new file mode 100644 index 000000000000..187ccff3aa05 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/IBillingPermissionsOperations.cs @@ -0,0 +1,213 @@ +// 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.Azure; + using Models; + + /// + /// BillingPermissionsOperations operations. + /// + public partial interface IBillingPermissionsOperations + { + /// + /// Lists the billing permissions the caller has for a customer. + /// + /// + /// Lists the billing permissions the caller has for a customer. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the billing permissions the caller has on a billing account. + /// + /// + /// Lists the billing permissions the caller has on a billing account. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the billing permissions the caller has on an invoice section. + /// + /// + /// Lists the billing permissions the caller has on an invoice section. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByInvoiceSectionsWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the billing permissions the caller has on a billing profile. + /// + /// + /// Lists the billing permissions the caller has on a billing profile. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the billing permissions the caller has for a customer. + /// + /// + /// Lists the billing permissions the caller has for a customer. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByCustomerNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the billing permissions the caller has on a billing account. + /// + /// + /// Lists the billing permissions the caller has on a billing account. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the billing permissions the caller has on an invoice section. + /// + /// + /// Lists the billing permissions the caller has on an invoice section. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByInvoiceSectionsNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the billing permissions the caller has on a billing profile. + /// + /// + /// Lists the billing permissions the caller has on a billing profile. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/IBillingProfilesOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IBillingProfilesOperations.cs new file mode 100644 index 000000000000..c68695a3a2a4 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/IBillingProfilesOperations.cs @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// BillingProfilesOperations operations. + /// + public partial interface IBillingProfilesOperations + { + /// + /// Lists the billing profiles that a user has access to. The operation is + /// supported for billing accounts with agreement type Microsoft Customer + /// Agreement or Microsoft Partner Agreement. + /// + /// + /// Lists the billing profiles that a user has access to. The operation is + /// supported for billing accounts with agreement type Microsoft Customer + /// Agreement or Microsoft Partner Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// May be used to expand the invoice sections. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets a billing profile by its ID. The operation is supported for billing + /// accounts with agreement type Microsoft Customer Agreement or Microsoft + /// Partner Agreement. + /// + /// + /// Gets a billing profile by its ID. The operation is supported for billing + /// accounts with agreement type Microsoft Customer Agreement or Microsoft + /// Partner Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// May be used to expand the invoice sections. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Creates or updates a billing profile. The operation is supported for + /// billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. + /// + /// + /// Creates or updates a billing profile. The operation is supported for + /// billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The new or updated billing profile. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, BillingProfile parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Creates or updates a billing profile. The operation is supported for + /// billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. + /// + /// + /// Creates or updates a billing profile. The operation is supported for + /// billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The new or updated billing profile. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, BillingProfile parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the billing profiles that a user has access to. The operation is + /// supported for billing accounts with agreement type Microsoft Customer + /// Agreement or Microsoft Partner Agreement. + /// + /// + /// Lists the billing profiles that a user has access to. The operation is + /// supported for billing accounts with agreement type Microsoft Customer + /// Agreement or Microsoft Partner Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/IBillingPropertyOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IBillingPropertyOperations.cs new file mode 100644 index 000000000000..003590b9f70b --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/IBillingPropertyOperations.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// BillingPropertyOperations operations. + /// + public partial interface IBillingPropertyOperations + { + /// + /// Get the billing properties for a subscription. This operation is not + /// supported for billing accounts with agreement type Enterprise Agreement. + /// + /// + /// Get the billing properties for a subscription. This operation is not + /// supported for billing accounts with agreement type Enterprise Agreement. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Updates the billing property of a subscription. Currently, cost center can + /// be updated. The operation is supported only for billing accounts with + /// agreement type Microsoft Customer Agreement. + /// + /// + /// Updates the billing property of a subscription. Currently, cost center can + /// be updated. The operation is supported only for billing accounts with + /// agreement type Microsoft Customer Agreement. + /// + /// + /// Request parameters that are provided to the update billing property + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(BillingProperty parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/IBillingRoleAssignmentsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IBillingRoleAssignmentsOperations.cs new file mode 100644 index 000000000000..3e053b42fc2a --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/IBillingRoleAssignmentsOperations.cs @@ -0,0 +1,386 @@ +// 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.Azure; + using Models; + + /// + /// BillingRoleAssignmentsOperations operations. + /// + public partial interface IBillingRoleAssignmentsOperations + { + /// + /// Gets a role assignment for the caller on a billing account. The operation + /// is supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// Gets a role assignment for the caller on a billing account. The operation + /// is supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetByBillingAccountWithHttpMessagesAsync(string billingAccountName, string billingRoleAssignmentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Deletes a role assignment for the caller on a billing account. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// Deletes a role assignment for the caller on a billing account. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> DeleteByBillingAccountWithHttpMessagesAsync(string billingAccountName, string billingRoleAssignmentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets a role assignment for the caller on an invoice section. The operation + /// is supported for billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + /// + /// Gets a role assignment for the caller on an invoice section. The operation + /// is supported for billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Deletes a role assignment for the caller on an invoice section. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// Deletes a role assignment for the caller on an invoice section. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> DeleteByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleAssignmentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets a role assignment for the caller on a billing profile. The operation + /// is supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// Gets a role assignment for the caller on a billing profile. The operation + /// is supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Deletes a role assignment for the caller on a billing profile. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// Deletes a role assignment for the caller on a billing profile. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies a role assignment. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> DeleteByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the role assignments for the caller on a billing account. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// Lists the role assignments for the caller on a billing account. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the role assignments for the caller on an invoice section. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// Lists the role assignments for the caller on an invoice section. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the role assignments for the caller on a billing profile. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// Lists the role assignments for the caller on a billing profile. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the role assignments for the caller on a billing account. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// Lists the role assignments for the caller on a billing account. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the role assignments for the caller on an invoice section. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// Lists the role assignments for the caller on an invoice section. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByInvoiceSectionNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the role assignments for the caller on a billing profile. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// Lists the role assignments for the caller on a billing profile. The + /// operation is supported for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/IBillingRoleDefinitionsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IBillingRoleDefinitionsOperations.cs new file mode 100644 index 000000000000..df1c6a0af4bc --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/IBillingRoleDefinitionsOperations.cs @@ -0,0 +1,287 @@ +// 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.Azure; + using Models; + + /// + /// BillingRoleDefinitionsOperations operations. + /// + public partial interface IBillingRoleDefinitionsOperations + { + /// + /// Gets the definition for a role on a billing account. The operation is + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// Gets the definition for a role on a billing account. The operation is + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a role definition. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetByBillingAccountWithHttpMessagesAsync(string billingAccountName, string billingRoleDefinitionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets the definition for a role on an invoice section. The operation is + /// supported only for billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + /// + /// Gets the definition for a role on an invoice section. The operation is + /// supported only for billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The ID that uniquely identifies a role definition. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string billingRoleDefinitionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets the definition for a role on a billing profile. The operation is + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// Gets the definition for a role on a billing profile. The operation is + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies a role definition. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string billingRoleDefinitionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the role definitions for a billing account. The operation is + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// Lists the role definitions for a billing account. The operation is + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the role definitions for an invoice section. The operation is + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// Lists the role definitions for an invoice section. The operation is + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the role definitions for a billing profile. The operation is + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// Lists the role definitions for a billing profile. The operation is + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the role definitions for a billing account. The operation is + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// Lists the role definitions for a billing account. The operation is + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the role definitions for an invoice section. The operation is + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// Lists the role definitions for an invoice section. The operation is + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByInvoiceSectionNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the role definitions for a billing profile. The operation is + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// Lists the role definitions for a billing profile. The operation is + /// supported for billing accounts with agreement type Microsoft Partner + /// Agreement or Microsoft Customer Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/IBillingSubscriptionsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IBillingSubscriptionsOperations.cs new file mode 100644 index 000000000000..e477fb25dc0f --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/IBillingSubscriptionsOperations.cs @@ -0,0 +1,394 @@ +// 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.Azure; + using Models; + + /// + /// BillingSubscriptionsOperations operations. + /// + public partial interface IBillingSubscriptionsOperations + { + /// + /// Lists the subscriptions for a customer. The operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// Lists the subscriptions for a customer. The operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the subscriptions for a billing account. The operation is supported + /// for billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. + /// + /// + /// Lists the subscriptions for a billing account. The operation is supported + /// for billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the subscriptions that are billed to a billing profile. The operation + /// is supported for billing accounts with agreement type Microsoft Customer + /// Agreement or Microsoft Partner Agreement. + /// + /// + /// Lists the subscriptions that are billed to a billing profile. The operation + /// is supported for billing accounts with agreement type Microsoft Customer + /// Agreement or Microsoft Partner Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the subscriptions that are billed to an invoice section. The + /// operation is supported only for billing accounts with agreement type + /// Microsoft Customer Agreement. + /// + /// + /// Lists the subscriptions that are billed to an invoice section. The + /// operation is supported only for billing accounts with agreement type + /// Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets a subscription by its ID. The operation is supported for billing + /// accounts with agreement type Microsoft Customer Agreement and Microsoft + /// Partner Agreement. + /// + /// + /// Gets a subscription by its ID. The operation is supported for billing + /// accounts with agreement type Microsoft Customer Agreement and Microsoft + /// Partner Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingAccountName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Updates the properties of a billing subscription. Currently, cost center + /// can be updated. The operation is supported only for billing accounts with + /// agreement type Microsoft Customer Agreement. + /// + /// + /// Updates the properties of a billing subscription. Currently, cost center + /// can be updated. The operation is supported only for billing accounts with + /// agreement type Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// Request parameters that are provided to the update billing subscription + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string billingAccountName, BillingSubscription parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Moves a subscription's charges to a new invoice section. The new invoice + /// section must belong to the same billing profile as the existing invoice + /// section. This operation is supported for billing accounts with agreement + /// type Microsoft Customer Agreement. + /// + /// + /// Moves a subscription's charges to a new invoice section. The new invoice + /// section must belong to the same billing profile as the existing invoice + /// section. This operation is supported for billing accounts with agreement + /// type Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// Request parameters that are provided to the move subscription operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> MoveWithHttpMessagesAsync(string billingAccountName, TransferBillingSubscriptionRequestProperties parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Validates if a subscription's charges can be moved to a new invoice + /// section. This operation is supported for billing accounts with agreement + /// type Microsoft Customer Agreement. + /// + /// + /// Validates if a subscription's charges can be moved to a new invoice + /// section. This operation is supported for billing accounts with agreement + /// type Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// Request parameters that are provided to the validate move eligibility + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> ValidateMoveWithHttpMessagesAsync(string billingAccountName, TransferBillingSubscriptionRequestProperties parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Moves a subscription's charges to a new invoice section. The new invoice + /// section must belong to the same billing profile as the existing invoice + /// section. This operation is supported for billing accounts with agreement + /// type Microsoft Customer Agreement. + /// + /// + /// Moves a subscription's charges to a new invoice section. The new invoice + /// section must belong to the same billing profile as the existing invoice + /// section. This operation is supported for billing accounts with agreement + /// type Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// Request parameters that are provided to the move subscription operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> BeginMoveWithHttpMessagesAsync(string billingAccountName, TransferBillingSubscriptionRequestProperties parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the subscriptions for a customer. The operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// Lists the subscriptions for a customer. The operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByCustomerNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the subscriptions for a billing account. The operation is supported + /// for billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. + /// + /// + /// Lists the subscriptions for a billing account. The operation is supported + /// for billing accounts with agreement type Microsoft Customer Agreement or + /// Microsoft Partner Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the subscriptions that are billed to a billing profile. The operation + /// is supported for billing accounts with agreement type Microsoft Customer + /// Agreement or Microsoft Partner Agreement. + /// + /// + /// Lists the subscriptions that are billed to a billing profile. The operation + /// is supported for billing accounts with agreement type Microsoft Customer + /// Agreement or Microsoft Partner Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the subscriptions that are billed to an invoice section. The + /// operation is supported only for billing accounts with agreement type + /// Microsoft Customer Agreement. + /// + /// + /// Lists the subscriptions that are billed to an invoice section. The + /// operation is supported only for billing accounts with agreement type + /// Microsoft Customer Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByInvoiceSectionNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/ICustomersOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/ICustomersOperations.cs new file mode 100644 index 000000000000..7c1effa82d06 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/ICustomersOperations.cs @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// CustomersOperations operations. + /// + public partial interface ICustomersOperations + { + /// + /// Lists the customers that are billed to a billing profile. The operation is + /// supported only for billing accounts with agreement type Microsoft Partner + /// Agreement. + /// + /// + /// Lists the customers that are billed to a billing profile. The operation is + /// supported only for billing accounts with agreement type Microsoft Partner + /// Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Used for searching customers by their name. Any customer with name + /// containing the search text will be included in the response + /// + /// + /// May be used to filter the list of customers. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string search = default(string), string filter = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the customers that are billed to a billing account. The operation is + /// supported only for billing accounts with agreement type Microsoft Partner + /// Agreement. + /// + /// + /// Lists the customers that are billed to a billing account. The operation is + /// supported only for billing accounts with agreement type Microsoft Partner + /// Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// Used for searching customers by their name. Any customer with name + /// containing the search text will be included in the response + /// + /// + /// May be used to filter the list of customers. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string search = default(string), string filter = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets a customer by its ID. The operation is supported only for billing + /// accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// Gets a customer by its ID. The operation is supported only for billing + /// accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// May be used to expand enabledAzurePlans and resellers + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingAccountName, string customerName, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the customers that are billed to a billing profile. The operation is + /// supported only for billing accounts with agreement type Microsoft Partner + /// Agreement. + /// + /// + /// Lists the customers that are billed to a billing profile. The operation is + /// supported only for billing accounts with agreement type Microsoft Partner + /// Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the customers that are billed to a billing account. The operation is + /// supported only for billing accounts with agreement type Microsoft Partner + /// Agreement. + /// + /// + /// Lists the customers that are billed to a billing account. The operation is + /// supported only for billing accounts with agreement type Microsoft Partner + /// Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/IEnrollmentAccountsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IEnrollmentAccountsOperations.cs new file mode 100644 index 000000000000..42f80bd6d16e --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/IEnrollmentAccountsOperations.cs @@ -0,0 +1,83 @@ +// 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.Azure; + using Models; + + /// + /// EnrollmentAccountsOperations operations. + /// + public partial interface IEnrollmentAccountsOperations + { + /// + /// Lists the enrollment accounts the caller has access to. + /// + /// + /// Lists the enrollment accounts the caller has access to. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets a enrollment account by name. + /// + /// + /// Gets a enrollment account by name. + /// + /// + /// Enrollment Account name. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string name, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the enrollment accounts the caller has access to. + /// + /// + /// Lists the enrollment accounts the caller has access to. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/IInstructionsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IInstructionsOperations.cs new file mode 100644 index 000000000000..bb112f5336a2 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/IInstructionsOperations.cs @@ -0,0 +1,131 @@ +// 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.Azure; + using Models; + + /// + /// InstructionsOperations operations. + /// + public partial interface IInstructionsOperations + { + /// + /// Lists the instructions by billing profile id. + /// + /// + /// Lists the instructions by billing profile id. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get the instruction by name. These are custom billing instructions and are + /// only applicable for certain customers. + /// + /// + /// Get the instruction by name. These are custom billing instructions and are + /// only applicable for certain customers. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Instruction Name. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string instructionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Creates or updates an instruction. These are custom billing instructions + /// and are only applicable for certain customers. + /// + /// + /// Creates or updates an instruction. These are custom billing instructions + /// and are only applicable for certain customers. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Instruction Name. + /// + /// + /// The new instruction. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> PutWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string instructionName, Instruction parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the instructions by billing profile id. + /// + /// + /// Lists the instructions by billing profile id. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/IInvoiceSectionsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IInvoiceSectionsOperations.cs new file mode 100644 index 000000000000..a28ddc74947f --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/IInvoiceSectionsOperations.cs @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// InvoiceSectionsOperations operations. + /// + public partial interface IInvoiceSectionsOperations + { + /// + /// Lists the invoice sections that a user has access to. The operation is + /// supported only for billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + /// + /// Lists the invoice sections that a user has access to. The operation is + /// supported only for billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets an invoice section by its ID. The operation is supported only for + /// billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// Gets an invoice section by its ID. The operation is supported only for + /// billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Creates or updates an invoice section. The operation is supported only for + /// billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// Creates or updates an invoice section. The operation is supported only for + /// billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The new or updated invoice section. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSection parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Creates or updates an invoice section. The operation is supported only for + /// billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// Creates or updates an invoice section. The operation is supported only for + /// billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The new or updated invoice section. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSection parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the invoice sections that a user has access to. The operation is + /// supported only for billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + /// + /// Lists the invoice sections that a user has access to. The operation is + /// supported only for billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/IInvoicesOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IInvoicesOperations.cs new file mode 100644 index 000000000000..9a557b28134d --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/IInvoicesOperations.cs @@ -0,0 +1,389 @@ +// 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.Azure; + using Models; + + /// + /// InvoicesOperations operations. + /// + public partial interface IInvoicesOperations + { + /// + /// Lists the invoices for a billing account for a given start date and end + /// date. The operation is supported for billing accounts with agreement type + /// Microsoft Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// Lists the invoices for a billing account for a given start date and end + /// date. The operation is supported for billing accounts with agreement type + /// Microsoft Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The start date to fetch the invoices. The date should be specified in + /// MM-DD-YYYY format. + /// + /// + /// The end date to fetch the invoices. The date should be specified in + /// MM-DD-YYYY format. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string periodStartDate, string periodEndDate, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the invoices for a billing profile for a given start date and end + /// date. The operation is supported for billing accounts with agreement type + /// Microsoft Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// Lists the invoices for a billing profile for a given start date and end + /// date. The operation is supported for billing accounts with agreement type + /// Microsoft Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The start date to fetch the invoices. The date should be specified in + /// MM-DD-YYYY format. + /// + /// + /// The end date to fetch the invoices. The date should be specified in + /// MM-DD-YYYY format. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string periodStartDate, string periodEndDate, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets an invoice by billing account name and ID. The operation is supported + /// for billing accounts with agreement type Microsoft Partner Agreement or + /// Microsoft Customer Agreement. + /// + /// + /// Gets an invoice by billing account name and ID. The operation is supported + /// for billing accounts with agreement type Microsoft Partner Agreement or + /// Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingAccountName, string invoiceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets an invoice by ID. The operation is supported for billing accounts with + /// agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// Gets an invoice by ID. The operation is supported for billing accounts with + /// agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetByIdWithHttpMessagesAsync(string invoiceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets a URL to download an invoice. The operation is supported for billing + /// accounts with agreement type Microsoft Partner Agreement or Microsoft + /// Customer Agreement. + /// + /// + /// Gets a URL to download an invoice. The operation is supported for billing + /// accounts with agreement type Microsoft Partner Agreement or Microsoft + /// Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Download token with document source and document ID. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> DownloadInvoiceWithHttpMessagesAsync(string billingAccountName, string invoiceName, string downloadToken, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the invoices for a subscription. + /// + /// + /// Lists the invoices for a subscription. + /// + /// + /// Invoice period start date. + /// + /// + /// Invoice period end date. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBillingSubscriptionWithHttpMessagesAsync(string periodStartDate, string periodEndDate, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets an invoice by subscription ID and invoice ID. + /// + /// + /// Gets an invoice by subscription ID and invoice ID. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetBySubscriptionAndInvoiceIdWithHttpMessagesAsync(string invoiceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets a URL to download an invoice. + /// + /// + /// Gets a URL to download an invoice. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Download token with document source and document ID. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> DownloadBillingSubscriptionInvoiceWithHttpMessagesAsync(string invoiceName, string downloadToken, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets a URL to download an invoice. The operation is supported for billing + /// accounts with agreement type Microsoft Partner Agreement or Microsoft + /// Customer Agreement. + /// + /// + /// Gets a URL to download an invoice. The operation is supported for billing + /// accounts with agreement type Microsoft Partner Agreement or Microsoft + /// Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Download token with document source and document ID. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> BeginDownloadInvoiceWithHttpMessagesAsync(string billingAccountName, string invoiceName, string downloadToken, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets a URL to download an invoice. + /// + /// + /// Gets a URL to download an invoice. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Download token with document source and document ID. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> BeginDownloadBillingSubscriptionInvoiceWithHttpMessagesAsync(string invoiceName, string downloadToken, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the invoices for a billing account for a given start date and end + /// date. The operation is supported for billing accounts with agreement type + /// Microsoft Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// Lists the invoices for a billing account for a given start date and end + /// date. The operation is supported for billing accounts with agreement type + /// Microsoft Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the invoices for a billing profile for a given start date and end + /// date. The operation is supported for billing accounts with agreement type + /// Microsoft Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// Lists the invoices for a billing profile for a given start date and end + /// date. The operation is supported for billing accounts with agreement type + /// Microsoft Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the invoices for a subscription. + /// + /// + /// Lists the invoices for a subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBillingSubscriptionNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/IOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IOperations.cs new file mode 100644 index 000000000000..f1d3f4feade8 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/IOperations.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Operations operations. + /// + public partial interface IOperations + { + /// + /// Lists the available billing REST API operations. + /// + /// + /// Lists the available billing REST API operations. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the available billing REST API operations. + /// + /// + /// Lists the available billing REST API operations. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/IPoliciesOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IPoliciesOperations.cs new file mode 100644 index 000000000000..3ef5c91514ee --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/IPoliciesOperations.cs @@ -0,0 +1,135 @@ +// 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.Azure; + using Models; + + /// + /// PoliciesOperations operations. + /// + public partial interface IPoliciesOperations + { + /// + /// Lists the policies for a billing profile. This operation is supported only + /// for billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// Lists the policies for a billing profile. This operation is supported only + /// for billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Updates the policies for a billing profile. This operation is supported + /// only for billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// Updates the policies for a billing profile. This operation is supported + /// only for billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Request parameters that are provided to the update policies operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Policy parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the policies for a customer. This operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// Lists the policies for a customer. This operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Updates the policies for a customer. This operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// Updates the policies for a customer. This operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// Request parameters that are provided to the update policies operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> UpdateCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, CustomerPolicy parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/IProductsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/IProductsOperations.cs new file mode 100644 index 000000000000..3511047027e3 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/IProductsOperations.cs @@ -0,0 +1,397 @@ +// 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.Azure; + using Models; + + /// + /// ProductsOperations operations. + /// + public partial interface IProductsOperations + { + /// + /// Lists the products for a customer. These don't include products billed + /// based on usage.The operation is supported only for billing accounts with + /// agreement type Microsoft Partner Agreement. + /// + /// + /// Lists the products for a customer. These don't include products billed + /// based on usage.The operation is supported only for billing accounts with + /// agreement type Microsoft Partner Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the products for a billing account. These don't include products + /// billed based on usage. The operation is supported for billing accounts with + /// agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + /// + /// + /// Lists the products for a billing account. These don't include products + /// billed based on usage. The operation is supported for billing accounts with + /// agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// May be used to filter by product type. The filter supports 'eq', 'lt', + /// 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or + /// 'not'. Tag filter is a key value pair string where key and value are + /// separated by a colon (:). + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string filter = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the products for a billing profile. These don't include products + /// billed based on usage. The operation is supported for billing accounts with + /// agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + /// + /// + /// Lists the products for a billing profile. These don't include products + /// billed based on usage. The operation is supported for billing accounts with + /// agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// May be used to filter by product type. The filter supports 'eq', 'lt', + /// 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or + /// 'not'. Tag filter is a key value pair string where key and value are + /// separated by a colon (:). + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string filter = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the products for an invoice section. These don't include products + /// billed based on usage. The operation is supported only for billing accounts + /// with agreement type Microsoft Customer Agreement. + /// + /// + /// Lists the products for an invoice section. These don't include products + /// billed based on usage. The operation is supported only for billing accounts + /// with agreement type Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// May be used to filter by product type. The filter supports 'eq', 'lt', + /// 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or + /// 'not'. Tag filter is a key value pair string where key and value are + /// separated by a colon (:). + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string filter = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets a product by ID. The operation is supported only for billing accounts + /// with agreement type Microsoft Customer Agreement. + /// + /// + /// Gets a product by ID. The operation is supported only for billing accounts + /// with agreement type Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a product. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingAccountName, string productName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Updates the properties of a Product. Currently, auto renew can be updated. + /// The operation is supported only for billing accounts with agreement type + /// Microsoft Customer Agreement. + /// + /// + /// Updates the properties of a Product. Currently, auto renew can be updated. + /// The operation is supported only for billing accounts with agreement type + /// Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a product. + /// + /// + /// Request parameters that are provided to the update product operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string billingAccountName, string productName, Product parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Moves a product's charges to a new invoice section. The new invoice section + /// must belong to the same billing profile as the existing invoice section. + /// This operation is supported only for products that are purchased with a + /// recurring charge and for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// Moves a product's charges to a new invoice section. The new invoice section + /// must belong to the same billing profile as the existing invoice section. + /// This operation is supported only for products that are purchased with a + /// recurring charge and for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a product. + /// + /// + /// Request parameters that are provided to the move product operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> MoveWithHttpMessagesAsync(string billingAccountName, string productName, TransferProductRequestProperties parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Validates if a product's charges can be moved to a new invoice section. + /// This operation is supported only for products that are purchased with a + /// recurring charge and for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// Validates if a product's charges can be moved to a new invoice section. + /// This operation is supported only for products that are purchased with a + /// recurring charge and for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a product. + /// + /// + /// Request parameters that are provided to the validate move eligibility + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task> ValidateMoveWithHttpMessagesAsync(string billingAccountName, string productName, TransferProductRequestProperties parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the products for a customer. These don't include products billed + /// based on usage.The operation is supported only for billing accounts with + /// agreement type Microsoft Partner Agreement. + /// + /// + /// Lists the products for a customer. These don't include products billed + /// based on usage.The operation is supported only for billing accounts with + /// agreement type Microsoft Partner Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByCustomerNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the products for a billing account. These don't include products + /// billed based on usage. The operation is supported for billing accounts with + /// agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + /// + /// + /// Lists the products for a billing account. These don't include products + /// billed based on usage. The operation is supported for billing accounts with + /// agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the products for a billing profile. These don't include products + /// billed based on usage. The operation is supported for billing accounts with + /// agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + /// + /// + /// Lists the products for a billing profile. These don't include products + /// billed based on usage. The operation is supported for billing accounts with + /// agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the products for an invoice section. These don't include products + /// billed based on usage. The operation is supported only for billing accounts + /// with agreement type Microsoft Customer Agreement. + /// + /// + /// Lists the products for an invoice section. These don't include products + /// billed based on usage. The operation is supported only for billing accounts + /// with agreement type Microsoft Customer Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByInvoiceSectionNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/ITransactionsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/ITransactionsOperations.cs new file mode 100644 index 000000000000..e5511f4f6166 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/ITransactionsOperations.cs @@ -0,0 +1,70 @@ +// 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.Azure; + using Models; + + /// + /// TransactionsOperations operations. + /// + public partial interface ITransactionsOperations + { + /// + /// Lists the transactions for an invoice. Transactions include purchases, + /// refunds and Azure usage charges. + /// + /// + /// Lists the transactions for an invoice. Transactions include purchases, + /// refunds and Azure usage charges. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByInvoiceWithHttpMessagesAsync(string billingAccountName, string invoiceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists the transactions for an invoice. Transactions include purchases, + /// refunds and Azure usage charges. + /// + /// + /// Lists the transactions for an invoice. Transactions include purchases, + /// refunds and Azure usage charges. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + System.Threading.Tasks.Task>> ListByInvoiceNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/InstructionsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/InstructionsOperations.cs new file mode 100644 index 000000000000..4901a73d7b7b --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/InstructionsOperations.cs @@ -0,0 +1,853 @@ +// 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 System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// InstructionsOperations operations. + /// + internal partial class InstructionsOperations : Microsoft.Rest.IServiceOperations, IInstructionsOperations + { + /// + /// Initializes a new instance of the InstructionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal InstructionsOperations (BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// Lists the instructions by billing profile id. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (billingProfileName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("apiVersion", apiVersion); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/instructions").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Get the instruction by name. These are custom billing instructions and are + /// only applicable for certain customers. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Instruction Name. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string instructionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (billingProfileName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); + } + + if (instructionName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "instructionName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("instructionName", instructionName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/instructions/{instructionName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{instructionName}", System.Uri.EscapeDataString(instructionName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Creates or updates an instruction. These are custom billing instructions + /// and are only applicable for certain customers. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Instruction Name. + /// + /// + /// The new instruction. + /// + /// + /// 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 System.Threading.Tasks.Task> PutWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string instructionName, Instruction parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + } + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (billingProfileName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); + } + + if (instructionName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "instructionName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("instructionName", instructionName); + + tracingParameters.Add("parameters", parameters); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Put", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/instructions/{instructionName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{instructionName}", System.Uri.EscapeDataString(instructionName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the instructions by billing profile id. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/InstructionsOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/InstructionsOperationsExtensions.cs new file mode 100644 index 000000000000..3cda8a3d522e --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/InstructionsOperationsExtensions.cs @@ -0,0 +1,182 @@ +// 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.Azure; + using Models; + + /// + /// Extension methods for InstructionsOperations + /// + public static partial class InstructionsOperationsExtensions + { + /// + /// Lists the instructions by billing profile id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingProfile(this IInstructionsOperations operations, string billingAccountName, string billingProfileName) + { + return ((IInstructionsOperations)operations).ListByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + } + + /// + /// Lists the instructions by billing profile id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingProfileAsync(this IInstructionsOperations operations, string billingAccountName, string billingProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Get the instruction by name. These are custom billing instructions and are + /// only applicable for certain customers. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Instruction Name. + /// + public static Instruction Get(this IInstructionsOperations operations, string billingAccountName, string billingProfileName, string instructionName) + { + return ((IInstructionsOperations)operations).GetAsync(billingAccountName, billingProfileName, instructionName).GetAwaiter().GetResult(); + } + + /// + /// Get the instruction by name. These are custom billing instructions and are + /// only applicable for certain customers. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Instruction Name. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IInstructionsOperations operations, string billingAccountName, string billingProfileName, string instructionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, billingProfileName, instructionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Creates or updates an instruction. These are custom billing instructions + /// and are only applicable for certain customers. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Instruction Name. + /// + public static Instruction Put(this IInstructionsOperations operations, string billingAccountName, string billingProfileName, string instructionName, Instruction parameters) + { + return ((IInstructionsOperations)operations).PutAsync(billingAccountName, billingProfileName, instructionName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates an instruction. These are custom billing instructions + /// and are only applicable for certain customers. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Instruction Name. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task PutAsync(this IInstructionsOperations operations, string billingAccountName, string billingProfileName, string instructionName, Instruction parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.PutWithHttpMessagesAsync(billingAccountName, billingProfileName, instructionName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the instructions by billing profile id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingProfileNext(this IInstructionsOperations operations, string nextPageLink) + { + return ((IInstructionsOperations)operations).ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the instructions by billing profile id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingProfileNextAsync(this IInstructionsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/InvoiceSectionsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/InvoiceSectionsOperations.cs new file mode 100644 index 000000000000..afaff8c13870 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/InvoiceSectionsOperations.cs @@ -0,0 +1,899 @@ +// 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 System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// InvoiceSectionsOperations operations. + /// + internal partial class InvoiceSectionsOperations : Microsoft.Rest.IServiceOperations, IInvoiceSectionsOperations + { + /// + /// Initializes a new instance of the InvoiceSectionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal InvoiceSectionsOperations (BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// Lists the invoice sections that a user has access to. The operation is + /// supported only for billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (billingProfileName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Gets an invoice section by its ID. The operation is supported only for + /// billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// 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 System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (billingProfileName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); + } + + if (invoiceSectionName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "invoiceSectionName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("invoiceSectionName", invoiceSectionName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Creates or updates an invoice section. The operation is supported only for + /// billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The new or updated invoice section. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSection parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates or updates an invoice section. The operation is supported only for + /// billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The new or updated invoice section. + /// + /// + /// 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 System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSection parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + } + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (billingProfileName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); + } + + if (invoiceSectionName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "invoiceSectionName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("invoiceSectionName", invoiceSectionName); + + tracingParameters.Add("parameters", parameters); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the invoice sections that a user has access to. The operation is + /// supported only for billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/InvoiceSectionsOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/InvoiceSectionsOperationsExtensions.cs new file mode 100644 index 000000000000..d51b73f6c992 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/InvoiceSectionsOperationsExtensions.cs @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for InvoiceSectionsOperations + /// + public static partial class InvoiceSectionsOperationsExtensions + { + /// + /// Lists the invoice sections that a user has access to. The operation is + /// supported only for billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingProfile(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName) + { + return ((IInvoiceSectionsOperations)operations).ListByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + } + + /// + /// Lists the invoice sections that a user has access to. The operation is + /// supported only for billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingProfileAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Gets an invoice section by its ID. The operation is supported only for + /// billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + public static InvoiceSection Get(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName) + { + return ((IInvoiceSectionsOperations)operations).GetAsync(billingAccountName, billingProfileName, invoiceSectionName).GetAwaiter().GetResult(); + } + + /// + /// Gets an invoice section by its ID. The operation is supported only for + /// billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Creates or updates an invoice section. The operation is supported only for + /// billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + public static InvoiceSection CreateOrUpdate(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSection parameters) + { + return ((IInvoiceSectionsOperations)operations).CreateOrUpdateAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates an invoice section. The operation is supported only for + /// billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSection parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Creates or updates an invoice section. The operation is supported only for + /// billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + public static InvoiceSection BeginCreateOrUpdate(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSection parameters) + { + return ((IInvoiceSectionsOperations)operations).BeginCreateOrUpdateAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates an invoice section. The operation is supported only for + /// billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginCreateOrUpdateAsync(this IInvoiceSectionsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, InvoiceSection parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the invoice sections that a user has access to. The operation is + /// supported only for billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingProfileNext(this IInvoiceSectionsOperations operations, string nextPageLink) + { + return ((IInvoiceSectionsOperations)operations).ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the invoice sections that a user has access to. The operation is + /// supported only for billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingProfileNextAsync(this IInvoiceSectionsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/InvoicesOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/InvoicesOperations.cs new file mode 100644 index 000000000000..a8d87658d0e8 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/InvoicesOperations.cs @@ -0,0 +1,2319 @@ +// 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 System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// InvoicesOperations operations. + /// + internal partial class InvoicesOperations : Microsoft.Rest.IServiceOperations, IInvoicesOperations + { + /// + /// Initializes a new instance of the InvoicesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal InvoicesOperations (BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// Lists the invoices for a billing account for a given start date and end + /// date. The operation is supported for billing accounts with agreement type + /// Microsoft Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The start date to fetch the invoices. The date should be specified in + /// MM-DD-YYYY format. + /// + /// + /// The end date to fetch the invoices. The date should be specified in + /// MM-DD-YYYY format. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string periodStartDate, string periodEndDate, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (periodStartDate == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "periodStartDate"); + } + + if (periodEndDate == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "periodEndDate"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("periodStartDate", periodStartDate); + tracingParameters.Add("periodEndDate", periodEndDate); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (periodStartDate != null) + { + _queryParameters.Add(string.Format("periodStartDate={0}", System.Uri.EscapeDataString(periodStartDate))); + } + if (periodEndDate != null) + { + _queryParameters.Add(string.Format("periodEndDate={0}", System.Uri.EscapeDataString(periodEndDate))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the invoices for a billing profile for a given start date and end + /// date. The operation is supported for billing accounts with agreement type + /// Microsoft Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The start date to fetch the invoices. The date should be specified in + /// MM-DD-YYYY format. + /// + /// + /// The end date to fetch the invoices. The date should be specified in + /// MM-DD-YYYY format. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string periodStartDate, string periodEndDate, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (billingProfileName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); + } + + if (periodStartDate == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "periodStartDate"); + } + + if (periodEndDate == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "periodEndDate"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("periodStartDate", periodStartDate); + tracingParameters.Add("periodEndDate", periodEndDate); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (periodStartDate != null) + { + _queryParameters.Add(string.Format("periodStartDate={0}", System.Uri.EscapeDataString(periodStartDate))); + } + if (periodEndDate != null) + { + _queryParameters.Add(string.Format("periodEndDate={0}", System.Uri.EscapeDataString(periodEndDate))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Gets an invoice by billing account name and ID. The operation is supported + /// for billing accounts with agreement type Microsoft Partner Agreement or + /// Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// 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 System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingAccountName, string invoiceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (invoiceName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "invoiceName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("invoiceName", invoiceName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{invoiceName}", System.Uri.EscapeDataString(invoiceName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Gets an invoice by ID. The operation is supported for billing accounts with + /// agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// 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 System.Threading.Tasks.Task> GetByIdWithHttpMessagesAsync(string invoiceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (invoiceName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "invoiceName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("invoiceName", invoiceName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetById", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/default/invoices/{invoiceName}").ToString(); + _url = _url.Replace("{invoiceName}", System.Uri.EscapeDataString(invoiceName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Gets a URL to download an invoice. The operation is supported for billing + /// accounts with agreement type Microsoft Partner Agreement or Microsoft + /// Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Download token with document source and document ID. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> DownloadInvoiceWithHttpMessagesAsync(string billingAccountName, string invoiceName, string downloadToken, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginDownloadInvoiceWithHttpMessagesAsync(billingAccountName, invoiceName, downloadToken, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Lists the invoices for a subscription. + /// + /// + /// Invoice period start date. + /// + /// + /// Invoice period end date. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByBillingSubscriptionWithHttpMessagesAsync(string periodStartDate, string periodEndDate, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (periodStartDate == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "periodStartDate"); + } + + if (periodEndDate == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "periodEndDate"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("periodStartDate", periodStartDate); + tracingParameters.Add("periodEndDate", periodEndDate); + tracingParameters.Add("apiVersion", apiVersion); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingSubscription", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (periodStartDate != null) + { + _queryParameters.Add(string.Format("periodStartDate={0}", System.Uri.EscapeDataString(periodStartDate))); + } + if (periodEndDate != null) + { + _queryParameters.Add(string.Format("periodEndDate={0}", System.Uri.EscapeDataString(periodEndDate))); + } + 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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Gets an invoice by subscription ID and invoice ID. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// 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 System.Threading.Tasks.Task> GetBySubscriptionAndInvoiceIdWithHttpMessagesAsync(string invoiceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (invoiceName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "invoiceName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("invoiceName", invoiceName); + tracingParameters.Add("apiVersion", apiVersion); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetBySubscriptionAndInvoiceId", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices/{invoiceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{invoiceName}", System.Uri.EscapeDataString(invoiceName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Gets a URL to download an invoice. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Download token with document source and document ID. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> DownloadBillingSubscriptionInvoiceWithHttpMessagesAsync(string invoiceName, string downloadToken, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginDownloadBillingSubscriptionInvoiceWithHttpMessagesAsync(invoiceName, downloadToken, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a URL to download an invoice. The operation is supported for billing + /// accounts with agreement type Microsoft Partner Agreement or Microsoft + /// Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Download token with document source and document 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 System.Threading.Tasks.Task> BeginDownloadInvoiceWithHttpMessagesAsync(string billingAccountName, string invoiceName, string downloadToken, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (invoiceName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "invoiceName"); + } + + if (downloadToken == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "downloadToken"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("invoiceName", invoiceName); + tracingParameters.Add("downloadToken", downloadToken); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDownloadInvoice", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/download").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{invoiceName}", System.Uri.EscapeDataString(invoiceName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (downloadToken != null) + { + _queryParameters.Add(string.Format("downloadToken={0}", System.Uri.EscapeDataString(downloadToken))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Gets a URL to download an invoice. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Download token with document source and document 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 System.Threading.Tasks.Task> BeginDownloadBillingSubscriptionInvoiceWithHttpMessagesAsync(string invoiceName, string downloadToken, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (invoiceName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "invoiceName"); + } + + if (downloadToken == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "downloadToken"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("invoiceName", invoiceName); + tracingParameters.Add("downloadToken", downloadToken); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDownloadBillingSubscriptionInvoice", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices/{invoiceName}/download").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{invoiceName}", System.Uri.EscapeDataString(invoiceName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (downloadToken != null) + { + _queryParameters.Add(string.Format("downloadToken={0}", System.Uri.EscapeDataString(downloadToken))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the invoices for a billing account for a given start date and end + /// date. The operation is supported for billing accounts with agreement type + /// Microsoft Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the invoices for a billing profile for a given start date and end + /// date. The operation is supported for billing accounts with agreement type + /// Microsoft Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the invoices for a subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByBillingSubscriptionNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingSubscriptionNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/InvoicesOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/InvoicesOperationsExtensions.cs new file mode 100644 index 000000000000..365810e84ae9 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/InvoicesOperationsExtensions.cs @@ -0,0 +1,561 @@ +// 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.Azure; + using Models; + + /// + /// Extension methods for InvoicesOperations + /// + public static partial class InvoicesOperationsExtensions + { + /// + /// Lists the invoices for a billing account for a given start date and end + /// date. The operation is supported for billing accounts with agreement type + /// Microsoft Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The start date to fetch the invoices. The date should be specified in + /// MM-DD-YYYY format. + /// + /// + /// The end date to fetch the invoices. The date should be specified in + /// MM-DD-YYYY format. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingAccount(this IInvoicesOperations operations, string billingAccountName, string periodStartDate, string periodEndDate) + { + return ((IInvoicesOperations)operations).ListByBillingAccountAsync(billingAccountName, periodStartDate, periodEndDate).GetAwaiter().GetResult(); + } + + /// + /// Lists the invoices for a billing account for a given start date and end + /// date. The operation is supported for billing accounts with agreement type + /// Microsoft Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The start date to fetch the invoices. The date should be specified in + /// MM-DD-YYYY format. + /// + /// + /// The end date to fetch the invoices. The date should be specified in + /// MM-DD-YYYY format. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingAccountAsync(this IInvoicesOperations operations, string billingAccountName, string periodStartDate, string periodEndDate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, periodStartDate, periodEndDate, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the invoices for a billing profile for a given start date and end + /// date. The operation is supported for billing accounts with agreement type + /// Microsoft Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The start date to fetch the invoices. The date should be specified in + /// MM-DD-YYYY format. + /// + /// + /// The end date to fetch the invoices. The date should be specified in + /// MM-DD-YYYY format. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingProfile(this IInvoicesOperations operations, string billingAccountName, string billingProfileName, string periodStartDate, string periodEndDate) + { + return ((IInvoicesOperations)operations).ListByBillingProfileAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate).GetAwaiter().GetResult(); + } + + /// + /// Lists the invoices for a billing profile for a given start date and end + /// date. The operation is supported for billing accounts with agreement type + /// Microsoft Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The start date to fetch the invoices. The date should be specified in + /// MM-DD-YYYY format. + /// + /// + /// The end date to fetch the invoices. The date should be specified in + /// MM-DD-YYYY format. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingProfileAsync(this IInvoicesOperations operations, string billingAccountName, string billingProfileName, string periodStartDate, string periodEndDate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Gets an invoice by billing account name and ID. The operation is supported + /// for billing accounts with agreement type Microsoft Partner Agreement or + /// Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + public static Invoice Get(this IInvoicesOperations operations, string billingAccountName, string invoiceName) + { + return ((IInvoicesOperations)operations).GetAsync(billingAccountName, invoiceName).GetAwaiter().GetResult(); + } + + /// + /// Gets an invoice by billing account name and ID. The operation is supported + /// for billing accounts with agreement type Microsoft Partner Agreement or + /// Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IInvoicesOperations operations, string billingAccountName, string invoiceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, invoiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Gets an invoice by ID. The operation is supported for billing accounts with + /// agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + public static Invoice GetById(this IInvoicesOperations operations, string invoiceName) + { + return ((IInvoicesOperations)operations).GetByIdAsync(invoiceName).GetAwaiter().GetResult(); + } + + /// + /// Gets an invoice by ID. The operation is supported for billing accounts with + /// agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetByIdAsync(this IInvoicesOperations operations, string invoiceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetByIdWithHttpMessagesAsync(invoiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Gets a URL to download an invoice. The operation is supported for billing + /// accounts with agreement type Microsoft Partner Agreement or Microsoft + /// Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Download token with document source and document ID. + /// + public static DownloadUrl DownloadInvoice(this IInvoicesOperations operations, string billingAccountName, string invoiceName, string downloadToken) + { + return ((IInvoicesOperations)operations).DownloadInvoiceAsync(billingAccountName, invoiceName, downloadToken).GetAwaiter().GetResult(); + } + + /// + /// Gets a URL to download an invoice. The operation is supported for billing + /// accounts with agreement type Microsoft Partner Agreement or Microsoft + /// Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Download token with document source and document ID. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DownloadInvoiceAsync(this IInvoicesOperations operations, string billingAccountName, string invoiceName, string downloadToken, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.DownloadInvoiceWithHttpMessagesAsync(billingAccountName, invoiceName, downloadToken, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the invoices for a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Invoice period start date. + /// + /// + /// Invoice period end date. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingSubscription(this IInvoicesOperations operations, string periodStartDate, string periodEndDate) + { + return ((IInvoicesOperations)operations).ListByBillingSubscriptionAsync(periodStartDate, periodEndDate).GetAwaiter().GetResult(); + } + + /// + /// Lists the invoices for a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Invoice period start date. + /// + /// + /// Invoice period end date. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingSubscriptionAsync(this IInvoicesOperations operations, string periodStartDate, string periodEndDate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingSubscriptionWithHttpMessagesAsync(periodStartDate, periodEndDate, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Gets an invoice by subscription ID and invoice ID. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + public static Invoice GetBySubscriptionAndInvoiceId(this IInvoicesOperations operations, string invoiceName) + { + return ((IInvoicesOperations)operations).GetBySubscriptionAndInvoiceIdAsync(invoiceName).GetAwaiter().GetResult(); + } + + /// + /// Gets an invoice by subscription ID and invoice ID. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetBySubscriptionAndInvoiceIdAsync(this IInvoicesOperations operations, string invoiceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetBySubscriptionAndInvoiceIdWithHttpMessagesAsync(invoiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Gets a URL to download an invoice. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Download token with document source and document ID. + /// + public static DownloadUrl DownloadBillingSubscriptionInvoice(this IInvoicesOperations operations, string invoiceName, string downloadToken) + { + return ((IInvoicesOperations)operations).DownloadBillingSubscriptionInvoiceAsync(invoiceName, downloadToken).GetAwaiter().GetResult(); + } + + /// + /// Gets a URL to download an invoice. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Download token with document source and document ID. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DownloadBillingSubscriptionInvoiceAsync(this IInvoicesOperations operations, string invoiceName, string downloadToken, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.DownloadBillingSubscriptionInvoiceWithHttpMessagesAsync(invoiceName, downloadToken, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Gets a URL to download an invoice. The operation is supported for billing + /// accounts with agreement type Microsoft Partner Agreement or Microsoft + /// Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Download token with document source and document ID. + /// + public static DownloadUrl BeginDownloadInvoice(this IInvoicesOperations operations, string billingAccountName, string invoiceName, string downloadToken) + { + return ((IInvoicesOperations)operations).BeginDownloadInvoiceAsync(billingAccountName, invoiceName, downloadToken).GetAwaiter().GetResult(); + } + + /// + /// Gets a URL to download an invoice. The operation is supported for billing + /// accounts with agreement type Microsoft Partner Agreement or Microsoft + /// Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Download token with document source and document ID. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginDownloadInvoiceAsync(this IInvoicesOperations operations, string billingAccountName, string invoiceName, string downloadToken, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginDownloadInvoiceWithHttpMessagesAsync(billingAccountName, invoiceName, downloadToken, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Gets a URL to download an invoice. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Download token with document source and document ID. + /// + public static DownloadUrl BeginDownloadBillingSubscriptionInvoice(this IInvoicesOperations operations, string invoiceName, string downloadToken) + { + return ((IInvoicesOperations)operations).BeginDownloadBillingSubscriptionInvoiceAsync(invoiceName, downloadToken).GetAwaiter().GetResult(); + } + + /// + /// Gets a URL to download an invoice. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// Download token with document source and document ID. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginDownloadBillingSubscriptionInvoiceAsync(this IInvoicesOperations operations, string invoiceName, string downloadToken, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginDownloadBillingSubscriptionInvoiceWithHttpMessagesAsync(invoiceName, downloadToken, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the invoices for a billing account for a given start date and end + /// date. The operation is supported for billing accounts with agreement type + /// Microsoft Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingAccountNext(this IInvoicesOperations operations, string nextPageLink) + { + return ((IInvoicesOperations)operations).ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the invoices for a billing account for a given start date and end + /// date. The operation is supported for billing accounts with agreement type + /// Microsoft Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingAccountNextAsync(this IInvoicesOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the invoices for a billing profile for a given start date and end + /// date. The operation is supported for billing accounts with agreement type + /// Microsoft Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingProfileNext(this IInvoicesOperations operations, string nextPageLink) + { + return ((IInvoicesOperations)operations).ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the invoices for a billing profile for a given start date and end + /// date. The operation is supported for billing accounts with agreement type + /// Microsoft Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingProfileNextAsync(this IInvoicesOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the invoices for a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingSubscriptionNext(this IInvoicesOperations operations, string nextPageLink) + { + return ((IInvoicesOperations)operations).ListByBillingSubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the invoices for a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingSubscriptionNextAsync(this IInvoicesOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingSubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/AcceptanceMode.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/AcceptanceMode.cs new file mode 100644 index 000000000000..80b47a16c015 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/AcceptanceMode.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for AcceptanceMode. + /// + + + public static class AcceptanceMode + { + public const string ClickToAccept = "ClickToAccept"; + public const string ESignEmbedded = "ESignEmbedded"; + public const string ESignOffline = "ESignOffline"; + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/AccountStatus.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/AccountStatus.cs new file mode 100644 index 000000000000..a9972d361747 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/AccountStatus.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for AccountStatus. + /// + + + public static class AccountStatus + { + public const string Active = "Active"; + public const string Deleted = "Deleted"; + public const string Disabled = "Disabled"; + public const string Expired = "Expired"; + public const string Transferred = "Transferred"; + public const string Extended = "Extended"; + public const string Terminated = "Terminated"; + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/AccountType.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/AccountType.cs new file mode 100644 index 000000000000..71fed383dcab --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/AccountType.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for AccountType. + /// + + + public static class AccountType + { + public const string Enterprise = "Enterprise"; + public const string Individual = "Individual"; + public const string Partner = "Partner"; + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/AddressDetails.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/AddressDetails.cs new file mode 100644 index 000000000000..4ad9892a6b37 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/AddressDetails.cs @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// Address details. + /// + public partial class AddressDetails + { + /// + /// Initializes a new instance of the AddressDetails class. + /// + public AddressDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AddressDetails class. + /// + + /// First name. + /// + + /// Last name. + /// + + /// Company name. + /// + + /// Address line 1. + /// + + /// Address line 2. + /// + + /// Address line 3. + /// + + /// Address city. + /// + + /// Address district. + /// + + /// Address region. + /// + + /// Country code uses ISO2, 2-digit format. + /// + + /// Postal code. + /// + + /// Email address. + /// + + /// Phone number. + /// + public AddressDetails(string addressLine1, string country, string firstName = default(string), string lastName = default(string), string companyName = default(string), string addressLine2 = default(string), string addressLine3 = default(string), string city = default(string), string district = default(string), string region = default(string), string postalCode = default(string), string email = default(string), string phoneNumber = default(string)) + + { + this.FirstName = firstName; + this.LastName = lastName; + this.CompanyName = companyName; + this.AddressLine1 = addressLine1; + this.AddressLine2 = addressLine2; + this.AddressLine3 = addressLine3; + this.City = city; + this.District = district; + this.Region = region; + this.Country = country; + this.PostalCode = postalCode; + this.Email = email; + this.PhoneNumber = phoneNumber; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets first name. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "firstName")] + public string FirstName {get; set; } + + /// + /// Gets or sets last name. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "lastName")] + public string LastName {get; set; } + + /// + /// Gets or sets company name. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "companyName")] + public string CompanyName {get; set; } + + /// + /// Gets or sets address line 1. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "addressLine1")] + public string AddressLine1 {get; set; } + + /// + /// Gets or sets address line 2. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "addressLine2")] + public string AddressLine2 {get; set; } + + /// + /// Gets or sets address line 3. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "addressLine3")] + public string AddressLine3 {get; set; } + + /// + /// Gets or sets address city. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "city")] + public string City {get; set; } + + /// + /// Gets or sets address district. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "district")] + public string District {get; set; } + + /// + /// Gets or sets address region. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "region")] + public string Region {get; set; } + + /// + /// Gets or sets country code uses ISO2, 2-digit format. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "country")] + public string Country {get; set; } + + /// + /// Gets or sets postal code. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "postalCode")] + public string PostalCode {get; set; } + + /// + /// Gets or sets email address. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "email")] + public string Email {get; set; } + + /// + /// Gets or sets phone number. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "phoneNumber")] + public string PhoneNumber {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.AddressLine1 == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "AddressLine1"); + } + if (this.Country == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Country"); + } + + + + + + + + + + + + + + } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/AddressValidationStatus.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/AddressValidationStatus.cs new file mode 100644 index 000000000000..55db79d0380b --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/AddressValidationStatus.cs @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for AddressValidationStatus. + /// + + + public static class AddressValidationStatus + { + public const string Valid = "Valid"; + public const string Invalid = "Invalid"; + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Agreement.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Agreement.cs new file mode 100644 index 000000000000..782bc5017f58 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Agreement.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// An agreement. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class Agreement : Resource + { + /// + /// Initializes a new instance of the Agreement class. + /// + public Agreement() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Agreement class. + /// + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// + + /// The category of the agreement signed by a customer. + /// Possible values include: 'MicrosoftCustomerAgreement', + /// 'AffiliatePurchaseTerms', 'Other' + + /// The mode of acceptance for an agreement. + /// Possible values include: 'ClickToAccept', 'ESignEmbedded', 'ESignOffline' + + /// The URL to download the agreement. + /// + + /// The date from which the agreement is effective. + /// + + /// The date when the agreement expires. + /// + + /// The list of participants that participates in acceptance of an agreement. + /// + + /// The current status of the agreement. + /// + public Agreement(string id = default(string), string name = default(string), string type = default(string), string category = default(string), string acceptanceMode = default(string), string agreementLink = default(string), System.DateTime? effectiveDate = default(System.DateTime?), System.DateTime? expirationDate = default(System.DateTime?), System.Collections.Generic.IList participants = default(System.Collections.Generic.IList), string status = default(string)) + + : base(id, name, type) + { + this.Category = category; + this.AcceptanceMode = acceptanceMode; + this.AgreementLink = agreementLink; + this.EffectiveDate = effectiveDate; + this.ExpirationDate = expirationDate; + this.Participants = participants; + this.Status = status; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the category of the agreement signed by a customer. Possible values include: 'MicrosoftCustomerAgreement', 'AffiliatePurchaseTerms', 'Other' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.category")] + public string Category {get; private set; } + + /// + /// Gets the mode of acceptance for an agreement. Possible values include: 'ClickToAccept', 'ESignEmbedded', 'ESignOffline' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.acceptanceMode")] + public string AcceptanceMode {get; private set; } + + /// + /// Gets the URL to download the agreement. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.agreementLink")] + public string AgreementLink {get; private set; } + + /// + /// Gets the date from which the agreement is effective. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.effectiveDate")] + public System.DateTime? EffectiveDate {get; private set; } + + /// + /// Gets the date when the agreement expires. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.expirationDate")] + public System.DateTime? ExpirationDate {get; private set; } + + /// + /// Gets or sets the list of participants that participates in acceptance of an + /// agreement. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.participants")] + public System.Collections.Generic.IList Participants {get; set; } + + /// + /// Gets the current status of the agreement. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.status")] + public string Status {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/AgreementProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/AgreementProperties.cs new file mode 100644 index 000000000000..84c5ef08adc9 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/AgreementProperties.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The properties of an agreement. + /// + public partial class AgreementProperties + { + /// + /// Initializes a new instance of the AgreementProperties class. + /// + public AgreementProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AgreementProperties class. + /// + + /// The URL to download the agreement. + /// + + /// The category of the agreement signed by a customer. + /// Possible values include: 'MicrosoftCustomerAgreement', + /// 'AffiliatePurchaseTerms', 'Other' + + /// The mode of acceptance for an agreement. + /// Possible values include: 'ClickToAccept', 'ESignEmbedded', 'ESignOffline' + + /// The date from which the agreement is effective. + /// + + /// The date when the agreement expires. + /// + + /// The list of participants that participates in acceptance of an agreement. + /// + + /// The current status of the agreement. + /// + public AgreementProperties(string agreementLink = default(string), string category = default(string), string acceptanceMode = default(string), System.DateTime? effectiveDate = default(System.DateTime?), System.DateTime? expirationDate = default(System.DateTime?), System.Collections.Generic.IList participants = default(System.Collections.Generic.IList), string status = default(string)) + + { + this.AgreementLink = agreementLink; + this.Category = category; + this.AcceptanceMode = acceptanceMode; + this.EffectiveDate = effectiveDate; + this.ExpirationDate = expirationDate; + this.Participants = participants; + this.Status = status; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the URL to download the agreement. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "agreementLink")] + public string AgreementLink {get; private set; } + + /// + /// Gets the category of the agreement signed by a customer. Possible values include: 'MicrosoftCustomerAgreement', 'AffiliatePurchaseTerms', 'Other' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "category")] + public string Category {get; private set; } + + /// + /// Gets the mode of acceptance for an agreement. Possible values include: 'ClickToAccept', 'ESignEmbedded', 'ESignOffline' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "acceptanceMode")] + public string AcceptanceMode {get; private set; } + + /// + /// Gets the date from which the agreement is effective. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "effectiveDate")] + public System.DateTime? EffectiveDate {get; private set; } + + /// + /// Gets the date when the agreement expires. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "expirationDate")] + public System.DateTime? ExpirationDate {get; private set; } + + /// + /// Gets or sets the list of participants that participates in acceptance of an + /// agreement. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "participants")] + public System.Collections.Generic.IList Participants {get; set; } + + /// + /// Gets the current status of the agreement. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/AgreementType.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/AgreementType.cs new file mode 100644 index 000000000000..76c8a8aca831 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/AgreementType.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for AgreementType. + /// + + + public static class AgreementType + { + public const string MicrosoftCustomerAgreement = "MicrosoftCustomerAgreement"; + public const string EnterpriseAgreement = "EnterpriseAgreement"; + public const string MicrosoftOnlineServicesProgram = "MicrosoftOnlineServicesProgram"; + public const string MicrosoftPartnerAgreement = "MicrosoftPartnerAgreement"; + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Amount.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Amount.cs new file mode 100644 index 000000000000..e7b71406842d --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Amount.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The amount. + /// + public partial class Amount + { + /// + /// Initializes a new instance of the Amount class. + /// + public Amount() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Amount class. + /// + + /// The currency for the amount value. + /// + + /// Amount value. + /// + public Amount(string currency = default(string), double? value = default(double?)) + + { + this.Currency = currency; + this.Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the currency for the amount value. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "currency")] + public string Currency {get; private set; } + + /// + /// Gets or sets amount value. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "value")] + public double? Value {get; set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/AutoRenew.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/AutoRenew.cs new file mode 100644 index 000000000000..9fc6652a2c8a --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/AutoRenew.cs @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for AutoRenew. + /// + + + public static class AutoRenew + { + public const string Off = "Off"; + public const string On = "On"; + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/AvailableBalance.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/AvailableBalance.cs new file mode 100644 index 000000000000..f6a5e193feb9 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/AvailableBalance.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The latest Azure credit balance. This is the balance available for pay now. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class AvailableBalance : Resource + { + /// + /// Initializes a new instance of the AvailableBalance class. + /// + public AvailableBalance() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AvailableBalance class. + /// + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// + + /// Balance amount. + /// + public AvailableBalance(string id = default(string), string name = default(string), string type = default(string), Amount amount = default(Amount)) + + : base(id, name, type) + { + this.Amount = amount; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets balance amount. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.amount")] + public Amount Amount {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/AvailableBalanceProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/AvailableBalanceProperties.cs new file mode 100644 index 000000000000..c2981aae2c6f --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/AvailableBalanceProperties.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The properties of available balance. + /// + public partial class AvailableBalanceProperties + { + /// + /// Initializes a new instance of the AvailableBalanceProperties class. + /// + public AvailableBalanceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AvailableBalanceProperties class. + /// + + /// Balance amount. + /// + public AvailableBalanceProperties(Amount amount = default(Amount)) + + { + this.Amount = amount; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets balance amount. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "amount")] + public Amount Amount {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/AzurePlan.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/AzurePlan.cs new file mode 100644 index 000000000000..c8633281d444 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/AzurePlan.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// Details of the Azure plan. + /// + public partial class AzurePlan + { + /// + /// Initializes a new instance of the AzurePlan class. + /// + public AzurePlan() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzurePlan class. + /// + + /// The sku id. + /// + + /// The sku description. + /// + public AzurePlan(string skuId = default(string), string skuDescription = default(string)) + + { + this.SkuId = skuId; + this.SkuDescription = skuDescription; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the sku id. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "skuId")] + public string SkuId {get; set; } + + /// + /// Gets the sku description. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "skuDescription")] + public string SkuDescription {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingAccount.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingAccount.cs new file mode 100644 index 000000000000..82b1eb796aec --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingAccount.cs @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// A billing account. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class BillingAccount : Resource + { + /// + /// Initializes a new instance of the BillingAccount class. + /// + public BillingAccount() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingAccount class. + /// + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// + + /// The type of agreement. + /// Possible values include: 'MicrosoftCustomerAgreement', + /// 'EnterpriseAgreement', 'MicrosoftOnlineServicesProgram', + /// 'MicrosoftPartnerAgreement' + + /// The type of customer. + /// Possible values include: 'Enterprise', 'Individual', 'Partner' + + /// The current status of the billing account. + /// Possible values include: 'Active', 'Deleted', 'Disabled', 'Expired', + /// 'Transferred', 'Extended', 'Terminated' + + /// The details about the associated legacy enrollment. By default this is not + /// populated, unless it's specified in $expand. + /// + + /// The billing account name. + /// + + /// The address of the individual or organization that is responsible for the + /// billing account. + /// + + /// The billing profiles associated with the billing account. By default this + /// is not populated, unless it's specified in $expand. + /// + + /// The departments associated to the enrollment. + /// + + /// The accounts associated to the enrollment. + /// + + /// Indicates whether user has read access to the billing account. + /// + public BillingAccount(string id = default(string), string name = default(string), string type = default(string), string agreementType = default(string), string accountType = default(string), string accountStatus = default(string), Enrollment enrollmentDetails = default(Enrollment), string displayName = default(string), AddressDetails soldTo = default(AddressDetails), BillingProfilesOnExpand billingProfiles = default(BillingProfilesOnExpand), System.Collections.Generic.IList departments = default(System.Collections.Generic.IList), System.Collections.Generic.IList enrollmentAccounts = default(System.Collections.Generic.IList), bool? hasReadAccess = default(bool?)) + + : base(id, name, type) + { + this.AgreementType = agreementType; + this.AccountType = accountType; + this.AccountStatus = accountStatus; + this.EnrollmentDetails = enrollmentDetails; + this.DisplayName = displayName; + this.SoldTo = soldTo; + this.BillingProfiles = billingProfiles; + this.Departments = departments; + this.EnrollmentAccounts = enrollmentAccounts; + this.HasReadAccess = hasReadAccess; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the type of agreement. Possible values include: 'MicrosoftCustomerAgreement', 'EnterpriseAgreement', 'MicrosoftOnlineServicesProgram', 'MicrosoftPartnerAgreement' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.agreementType")] + public string AgreementType {get; private set; } + + /// + /// Gets the type of customer. Possible values include: 'Enterprise', 'Individual', 'Partner' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.accountType")] + public string AccountType {get; private set; } + + /// + /// Gets the current status of the billing account. Possible values include: 'Active', 'Deleted', 'Disabled', 'Expired', 'Transferred', 'Extended', 'Terminated' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.accountStatus")] + public string AccountStatus {get; private set; } + + /// + /// Gets the details about the associated legacy enrollment. By default this is + /// not populated, unless it's specified in $expand. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.enrollmentDetails")] + public Enrollment EnrollmentDetails {get; private set; } + + /// + /// Gets or sets the billing account name. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName {get; set; } + + /// + /// Gets or sets the address of the individual or organization that is + /// responsible for the billing account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.soldTo")] + public AddressDetails SoldTo {get; set; } + + /// + /// Gets or sets the billing profiles associated with the billing account. By + /// default this is not populated, unless it's specified in $expand. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingProfiles")] + public BillingProfilesOnExpand BillingProfiles {get; set; } + + /// + /// Gets or sets the departments associated to the enrollment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.departments")] + public System.Collections.Generic.IList Departments {get; set; } + + /// + /// Gets or sets the accounts associated to the enrollment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.enrollmentAccounts")] + public System.Collections.Generic.IList EnrollmentAccounts {get; set; } + + /// + /// Gets indicates whether user has read access to the billing account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.hasReadAccess")] + public bool? HasReadAccess {get; private set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + + + + + + if (this.SoldTo != null) + { + this.SoldTo.Validate(); + } + + + + } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingAccountProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingAccountProperties.cs new file mode 100644 index 000000000000..90fec600b466 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingAccountProperties.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The properties of the billing account. + /// + public partial class BillingAccountProperties + { + /// + /// Initializes a new instance of the BillingAccountProperties class. + /// + public BillingAccountProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingAccountProperties class. + /// + + /// The billing account name. + /// + + /// The address of the individual or organization that is responsible for the + /// billing account. + /// + + /// The type of agreement. + /// Possible values include: 'MicrosoftCustomerAgreement', + /// 'EnterpriseAgreement', 'MicrosoftOnlineServicesProgram', + /// 'MicrosoftPartnerAgreement' + + /// The type of customer. + /// Possible values include: 'Enterprise', 'Individual', 'Partner' + + /// The current status of the billing account. + /// Possible values include: 'Active', 'Deleted', 'Disabled', 'Expired', + /// 'Transferred', 'Extended', 'Terminated' + + /// The billing profiles associated with the billing account. By default this + /// is not populated, unless it's specified in $expand. + /// + + /// The details about the associated legacy enrollment. By default this is not + /// populated, unless it's specified in $expand. + /// + + /// The departments associated to the enrollment. + /// + + /// The accounts associated to the enrollment. + /// + + /// Indicates whether user has read access to the billing account. + /// + public BillingAccountProperties(string displayName = default(string), AddressDetails soldTo = default(AddressDetails), string agreementType = default(string), string accountType = default(string), string accountStatus = default(string), BillingProfilesOnExpand billingProfiles = default(BillingProfilesOnExpand), Enrollment enrollmentDetails = default(Enrollment), System.Collections.Generic.IList departments = default(System.Collections.Generic.IList), System.Collections.Generic.IList enrollmentAccounts = default(System.Collections.Generic.IList), bool? hasReadAccess = default(bool?)) + + { + this.DisplayName = displayName; + this.SoldTo = soldTo; + this.AgreementType = agreementType; + this.AccountType = accountType; + this.AccountStatus = accountStatus; + this.BillingProfiles = billingProfiles; + this.EnrollmentDetails = enrollmentDetails; + this.Departments = departments; + this.EnrollmentAccounts = enrollmentAccounts; + this.HasReadAccess = hasReadAccess; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the billing account name. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "displayName")] + public string DisplayName {get; set; } + + /// + /// Gets or sets the address of the individual or organization that is + /// responsible for the billing account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "soldTo")] + public AddressDetails SoldTo {get; set; } + + /// + /// Gets the type of agreement. Possible values include: 'MicrosoftCustomerAgreement', 'EnterpriseAgreement', 'MicrosoftOnlineServicesProgram', 'MicrosoftPartnerAgreement' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "agreementType")] + public string AgreementType {get; private set; } + + /// + /// Gets the type of customer. Possible values include: 'Enterprise', 'Individual', 'Partner' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "accountType")] + public string AccountType {get; private set; } + + /// + /// Gets the current status of the billing account. Possible values include: 'Active', 'Deleted', 'Disabled', 'Expired', 'Transferred', 'Extended', 'Terminated' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "accountStatus")] + public string AccountStatus {get; private set; } + + /// + /// Gets or sets the billing profiles associated with the billing account. By + /// default this is not populated, unless it's specified in $expand. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfiles")] + public BillingProfilesOnExpand BillingProfiles {get; set; } + + /// + /// Gets the details about the associated legacy enrollment. By default this is + /// not populated, unless it's specified in $expand. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "enrollmentDetails")] + public Enrollment EnrollmentDetails {get; private set; } + + /// + /// Gets or sets the departments associated to the enrollment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "departments")] + public System.Collections.Generic.IList Departments {get; set; } + + /// + /// Gets or sets the accounts associated to the enrollment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "enrollmentAccounts")] + public System.Collections.Generic.IList EnrollmentAccounts {get; set; } + + /// + /// Gets indicates whether user has read access to the billing account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "hasReadAccess")] + public bool? HasReadAccess {get; private set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + + if (this.SoldTo != null) + { + this.SoldTo.Validate(); + } + + + + + + + + } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingAccountUpdateRequest.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingAccountUpdateRequest.cs new file mode 100644 index 000000000000..efeffb65c6a2 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingAccountUpdateRequest.cs @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The request properties of the billing account that can be updated. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class BillingAccountUpdateRequest + { + /// + /// Initializes a new instance of the BillingAccountUpdateRequest class. + /// + public BillingAccountUpdateRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingAccountUpdateRequest class. + /// + + /// The type of agreement. + /// Possible values include: 'MicrosoftCustomerAgreement', + /// 'EnterpriseAgreement', 'MicrosoftOnlineServicesProgram', + /// 'MicrosoftPartnerAgreement' + + /// The type of customer. + /// Possible values include: 'Enterprise', 'Individual', 'Partner' + + /// The current status of the billing account. + /// Possible values include: 'Active', 'Deleted', 'Disabled', 'Expired', + /// 'Transferred', 'Extended', 'Terminated' + + /// The details about the associated legacy enrollment. By default this is not + /// populated, unless it's specified in $expand. + /// + + /// The billing account name. + /// + + /// The address of the individual or organization that is responsible for the + /// billing account. + /// + + /// The billing profiles associated with the billing account. By default this + /// is not populated, unless it's specified in $expand. + /// + + /// The departments associated to the enrollment. + /// + + /// The accounts associated to the enrollment. + /// + + /// Indicates whether user has read access to the billing account. + /// + public BillingAccountUpdateRequest(string agreementType = default(string), string accountType = default(string), string accountStatus = default(string), Enrollment enrollmentDetails = default(Enrollment), string displayName = default(string), AddressDetails soldTo = default(AddressDetails), BillingProfilesOnExpand billingProfiles = default(BillingProfilesOnExpand), System.Collections.Generic.IList departments = default(System.Collections.Generic.IList), System.Collections.Generic.IList enrollmentAccounts = default(System.Collections.Generic.IList), bool? hasReadAccess = default(bool?)) + + { + this.AgreementType = agreementType; + this.AccountType = accountType; + this.AccountStatus = accountStatus; + this.EnrollmentDetails = enrollmentDetails; + this.DisplayName = displayName; + this.SoldTo = soldTo; + this.BillingProfiles = billingProfiles; + this.Departments = departments; + this.EnrollmentAccounts = enrollmentAccounts; + this.HasReadAccess = hasReadAccess; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the type of agreement. Possible values include: 'MicrosoftCustomerAgreement', 'EnterpriseAgreement', 'MicrosoftOnlineServicesProgram', 'MicrosoftPartnerAgreement' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.agreementType")] + public string AgreementType {get; private set; } + + /// + /// Gets the type of customer. Possible values include: 'Enterprise', 'Individual', 'Partner' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.accountType")] + public string AccountType {get; private set; } + + /// + /// Gets the current status of the billing account. Possible values include: 'Active', 'Deleted', 'Disabled', 'Expired', 'Transferred', 'Extended', 'Terminated' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.accountStatus")] + public string AccountStatus {get; private set; } + + /// + /// Gets the details about the associated legacy enrollment. By default this is + /// not populated, unless it's specified in $expand. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.enrollmentDetails")] + public Enrollment EnrollmentDetails {get; private set; } + + /// + /// Gets or sets the billing account name. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName {get; set; } + + /// + /// Gets or sets the address of the individual or organization that is + /// responsible for the billing account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.soldTo")] + public AddressDetails SoldTo {get; set; } + + /// + /// Gets or sets the billing profiles associated with the billing account. By + /// default this is not populated, unless it's specified in $expand. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingProfiles")] + public BillingProfilesOnExpand BillingProfiles {get; set; } + + /// + /// Gets or sets the departments associated to the enrollment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.departments")] + public System.Collections.Generic.IList Departments {get; set; } + + /// + /// Gets or sets the accounts associated to the enrollment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.enrollmentAccounts")] + public System.Collections.Generic.IList EnrollmentAccounts {get; set; } + + /// + /// Gets indicates whether user has read access to the billing account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.hasReadAccess")] + public bool? HasReadAccess {get; private set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + + + + + + if (this.SoldTo != null) + { + this.SoldTo.Validate(); + } + + + + } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingFrequency.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingFrequency.cs new file mode 100644 index 000000000000..57018bf676c6 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingFrequency.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for BillingFrequency. + /// + + + public static class BillingFrequency + { + public const string OneTime = "OneTime"; + public const string Monthly = "Monthly"; + public const string UsageBased = "UsageBased"; + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingPeriod.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingPeriod.cs new file mode 100644 index 000000000000..09c8869239d5 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingPeriod.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// A billing period resource. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class BillingPeriod : Resource + { + /// + /// Initializes a new instance of the BillingPeriod class. + /// + public BillingPeriod() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingPeriod class. + /// + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// + + /// The start of the date range covered by the billing period. + /// + + /// The end of the date range covered by the billing period. + /// + + /// Array of invoice ids that associated with. + /// + public BillingPeriod(string id = default(string), string name = default(string), string type = default(string), System.DateTime? billingPeriodStartDate = default(System.DateTime?), System.DateTime? billingPeriodEndDate = default(System.DateTime?), System.Collections.Generic.IList invoiceIds = default(System.Collections.Generic.IList)) + + : base(id, name, type) + { + this.BillingPeriodStartDate = billingPeriodStartDate; + this.BillingPeriodEndDate = billingPeriodEndDate; + this.InvoiceIds = invoiceIds; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the start of the date range covered by the billing period. + /// + [Newtonsoft.Json.JsonConverter(typeof(Microsoft.Rest.Serialization.DateJsonConverter))] + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingPeriodStartDate")] + public System.DateTime? BillingPeriodStartDate {get; private set; } + + /// + /// Gets the end of the date range covered by the billing period. + /// + [Newtonsoft.Json.JsonConverter(typeof(Microsoft.Rest.Serialization.DateJsonConverter))] + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingPeriodEndDate")] + public System.DateTime? BillingPeriodEndDate {get; private set; } + + /// + /// Gets array of invoice ids that associated with. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.invoiceIds")] + public System.Collections.Generic.IList InvoiceIds {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingPeriodProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingPeriodProperties.cs new file mode 100644 index 000000000000..b7dbe7f38856 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingPeriodProperties.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The properties of the billing period. + /// + public partial class BillingPeriodProperties + { + /// + /// Initializes a new instance of the BillingPeriodProperties class. + /// + public BillingPeriodProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingPeriodProperties class. + /// + + /// The start of the date range covered by the billing period. + /// + + /// The end of the date range covered by the billing period. + /// + + /// Array of invoice ids that associated with. + /// + public BillingPeriodProperties(System.DateTime? billingPeriodStartDate = default(System.DateTime?), System.DateTime? billingPeriodEndDate = default(System.DateTime?), System.Collections.Generic.IList invoiceIds = default(System.Collections.Generic.IList)) + + { + this.BillingPeriodStartDate = billingPeriodStartDate; + this.BillingPeriodEndDate = billingPeriodEndDate; + this.InvoiceIds = invoiceIds; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the start of the date range covered by the billing period. + /// + [Newtonsoft.Json.JsonConverter(typeof(Microsoft.Rest.Serialization.DateJsonConverter))] + [Newtonsoft.Json.JsonProperty(PropertyName = "billingPeriodStartDate")] + public System.DateTime? BillingPeriodStartDate {get; private set; } + + /// + /// Gets the end of the date range covered by the billing period. + /// + [Newtonsoft.Json.JsonConverter(typeof(Microsoft.Rest.Serialization.DateJsonConverter))] + [Newtonsoft.Json.JsonProperty(PropertyName = "billingPeriodEndDate")] + public System.DateTime? BillingPeriodEndDate {get; private set; } + + /// + /// Gets array of invoice ids that associated with. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "invoiceIds")] + public System.Collections.Generic.IList InvoiceIds {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingPermissionsProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingPermissionsProperties.cs new file mode 100644 index 000000000000..d8e909e0a716 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingPermissionsProperties.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The set of allowed action and not allowed actions a caller has on a billing + /// account + /// + public partial class BillingPermissionsProperties + { + /// + /// Initializes a new instance of the BillingPermissionsProperties class. + /// + public BillingPermissionsProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingPermissionsProperties class. + /// + + /// The set of actions that the caller is allowed to perform. + /// + + /// The set of actions that the caller is not allowed to perform. + /// + public BillingPermissionsProperties(System.Collections.Generic.IList actions = default(System.Collections.Generic.IList), System.Collections.Generic.IList notActions = default(System.Collections.Generic.IList)) + + { + this.Actions = actions; + this.NotActions = notActions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the set of actions that the caller is allowed to perform. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "actions")] + public System.Collections.Generic.IList Actions {get; private set; } + + /// + /// Gets the set of actions that the caller is not allowed to perform. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "notActions")] + public System.Collections.Generic.IList NotActions {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfile.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfile.cs new file mode 100644 index 000000000000..2563a60874be --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfile.cs @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// A billing profile. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class BillingProfile : Resource + { + /// + /// Initializes a new instance of the BillingProfile class. + /// + public BillingProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingProfile class. + /// + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// + + /// The billing profile spending limit. + /// Possible values include: 'Off', 'On' + + /// The name of the billing profile. + /// + + /// The purchase order name that will appear on the invoices generated for the + /// billing profile. + /// + + /// Billing address. + /// + + /// Flag controlling whether the invoices for the billing profile are sent + /// through email. + /// + + /// The day of the month when the invoice for the billing profile is generated. + /// + + /// The currency in which the charges for the billing profile are billed. + /// + + /// Information about the enabled azure plans. + /// + + /// The invoice sections associated to the billing profile. By default this is + /// not populated, unless it's specified in $expand. + /// + + /// Indicates whether user has read access to the billing profile. + /// + + /// The system generated unique identifier for a billing profile. + /// + + /// The status of the billing profile. + /// Possible values include: 'Active', 'Disabled', 'Warned' + + /// Reason for the specified billing profile status. + /// Possible values include: 'PastDue', 'SpendingLimitReached', + /// 'SpendingLimitExpired' + public BillingProfile(string id = default(string), string name = default(string), string type = default(string), string spendingLimit = default(string), string displayName = default(string), string poNumber = default(string), AddressDetails billTo = default(AddressDetails), bool? invoiceEmailOptIn = default(bool?), int? invoiceDay = default(int?), string currency = default(string), System.Collections.Generic.IList enabledAzurePlans = default(System.Collections.Generic.IList), InvoiceSectionsOnExpand invoiceSections = default(InvoiceSectionsOnExpand), bool? hasReadAccess = default(bool?), string systemId = default(string), string status = default(string), string statusReasonCode = default(string)) + + : base(id, name, type) + { + this.SpendingLimit = spendingLimit; + this.DisplayName = displayName; + this.PoNumber = poNumber; + this.BillTo = billTo; + this.InvoiceEmailOptIn = invoiceEmailOptIn; + this.InvoiceDay = invoiceDay; + this.Currency = currency; + this.EnabledAzurePlans = enabledAzurePlans; + this.InvoiceSections = invoiceSections; + this.HasReadAccess = hasReadAccess; + this.SystemId = systemId; + this.Status = status; + this.StatusReasonCode = statusReasonCode; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the billing profile spending limit. Possible values include: 'Off', 'On' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.spendingLimit")] + public string SpendingLimit {get; private set; } + + /// + /// Gets or sets the name of the billing profile. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName {get; set; } + + /// + /// Gets or sets the purchase order name that will appear on the invoices + /// generated for the billing profile. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.poNumber")] + public string PoNumber {get; set; } + + /// + /// Gets or sets billing address. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billTo")] + public AddressDetails BillTo {get; set; } + + /// + /// Gets or sets flag controlling whether the invoices for the billing profile + /// are sent through email. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.invoiceEmailOptIn")] + public bool? InvoiceEmailOptIn {get; set; } + + /// + /// Gets the day of the month when the invoice for the billing profile is + /// generated. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.invoiceDay")] + public int? InvoiceDay {get; private set; } + + /// + /// Gets the currency in which the charges for the billing profile are billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.currency")] + public string Currency {get; private set; } + + /// + /// Gets or sets information about the enabled azure plans. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.enabledAzurePlans")] + public System.Collections.Generic.IList EnabledAzurePlans {get; set; } + + /// + /// Gets or sets the invoice sections associated to the billing profile. By + /// default this is not populated, unless it's specified in $expand. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.invoiceSections")] + public InvoiceSectionsOnExpand InvoiceSections {get; set; } + + /// + /// Gets indicates whether user has read access to the billing profile. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.hasReadAccess")] + public bool? HasReadAccess {get; private set; } + + /// + /// Gets the system generated unique identifier for a billing profile. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.systemId")] + public string SystemId {get; private set; } + + /// + /// Gets the status of the billing profile. Possible values include: 'Active', 'Disabled', 'Warned' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.status")] + public string Status {get; private set; } + + /// + /// Gets reason for the specified billing profile status. Possible values include: 'PastDue', 'SpendingLimitReached', 'SpendingLimitExpired' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.statusReasonCode")] + public string StatusReasonCode {get; private set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + + + + if (this.BillTo != null) + { + this.BillTo.Validate(); + } + + + + + + + } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileCreationRequest.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileCreationRequest.cs new file mode 100644 index 000000000000..4dd4c7e1795b --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileCreationRequest.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The request parameters for creating a new billing profile. + /// + public partial class BillingProfileCreationRequest + { + /// + /// Initializes a new instance of the BillingProfileCreationRequest class. + /// + public BillingProfileCreationRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingProfileCreationRequest class. + /// + + /// The name of the billing profile. + /// + + /// The purchase order name that will appear on the invoices generated for the + /// billing profile. + /// + + /// The address of the individual or organization that is responsible for the + /// billing profile. + /// + + /// Flag controlling whether the invoices for the billing profile are sent + /// through email. + /// + + /// Enabled azure plans for the billing profile. + /// + public BillingProfileCreationRequest(string displayName = default(string), string poNumber = default(string), AddressDetails billTo = default(AddressDetails), bool? invoiceEmailOptIn = default(bool?), System.Collections.Generic.IList enabledAzurePlans = default(System.Collections.Generic.IList)) + + { + this.DisplayName = displayName; + this.PoNumber = poNumber; + this.BillTo = billTo; + this.InvoiceEmailOptIn = invoiceEmailOptIn; + this.EnabledAzurePlans = enabledAzurePlans; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the name of the billing profile. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "displayName")] + public string DisplayName {get; set; } + + /// + /// Gets or sets the purchase order name that will appear on the invoices + /// generated for the billing profile. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "poNumber")] + public string PoNumber {get; set; } + + /// + /// Gets or sets the address of the individual or organization that is + /// responsible for the billing profile. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billTo")] + public AddressDetails BillTo {get; set; } + + /// + /// Gets or sets flag controlling whether the invoices for the billing profile + /// are sent through email. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "invoiceEmailOptIn")] + public bool? InvoiceEmailOptIn {get; set; } + + /// + /// Gets or sets enabled azure plans for the billing profile. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "enabledAzurePlans")] + public System.Collections.Generic.IList EnabledAzurePlans {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + + + if (this.BillTo != null) + { + this.BillTo.Validate(); + } + + } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileProperties.cs new file mode 100644 index 000000000000..2ce02c5cad6c --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileProperties.cs @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The properties of the billing profile. + /// + public partial class BillingProfileProperties + { + /// + /// Initializes a new instance of the BillingProfileProperties class. + /// + public BillingProfileProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingProfileProperties class. + /// + + /// The name of the billing profile. + /// + + /// The purchase order name that will appear on the invoices generated for the + /// billing profile. + /// + + /// Billing address. + /// + + /// Flag controlling whether the invoices for the billing profile are sent + /// through email. + /// + + /// The day of the month when the invoice for the billing profile is generated. + /// + + /// The currency in which the charges for the billing profile are billed. + /// + + /// Information about the enabled azure plans. + /// + + /// The invoice sections associated to the billing profile. By default this is + /// not populated, unless it's specified in $expand. + /// + + /// Indicates whether user has read access to the billing profile. + /// + + /// The system generated unique identifier for a billing profile. + /// + + /// The status of the billing profile. + /// Possible values include: 'Active', 'Disabled', 'Warned' + + /// Reason for the specified billing profile status. + /// Possible values include: 'PastDue', 'SpendingLimitReached', + /// 'SpendingLimitExpired' + + /// The billing profile spending limit. + /// Possible values include: 'Off', 'On' + public BillingProfileProperties(string displayName = default(string), string poNumber = default(string), AddressDetails billTo = default(AddressDetails), bool? invoiceEmailOptIn = default(bool?), int? invoiceDay = default(int?), string currency = default(string), System.Collections.Generic.IList enabledAzurePlans = default(System.Collections.Generic.IList), InvoiceSectionsOnExpand invoiceSections = default(InvoiceSectionsOnExpand), bool? hasReadAccess = default(bool?), string systemId = default(string), string status = default(string), string statusReasonCode = default(string), string spendingLimit = default(string)) + + { + this.DisplayName = displayName; + this.PoNumber = poNumber; + this.BillTo = billTo; + this.InvoiceEmailOptIn = invoiceEmailOptIn; + this.InvoiceDay = invoiceDay; + this.Currency = currency; + this.EnabledAzurePlans = enabledAzurePlans; + this.InvoiceSections = invoiceSections; + this.HasReadAccess = hasReadAccess; + this.SystemId = systemId; + this.Status = status; + this.StatusReasonCode = statusReasonCode; + this.SpendingLimit = spendingLimit; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the name of the billing profile. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "displayName")] + public string DisplayName {get; set; } + + /// + /// Gets or sets the purchase order name that will appear on the invoices + /// generated for the billing profile. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "poNumber")] + public string PoNumber {get; set; } + + /// + /// Gets or sets billing address. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billTo")] + public AddressDetails BillTo {get; set; } + + /// + /// Gets or sets flag controlling whether the invoices for the billing profile + /// are sent through email. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "invoiceEmailOptIn")] + public bool? InvoiceEmailOptIn {get; set; } + + /// + /// Gets the day of the month when the invoice for the billing profile is + /// generated. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "invoiceDay")] + public int? InvoiceDay {get; private set; } + + /// + /// Gets the currency in which the charges for the billing profile are billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "currency")] + public string Currency {get; private set; } + + /// + /// Gets or sets information about the enabled azure plans. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "enabledAzurePlans")] + public System.Collections.Generic.IList EnabledAzurePlans {get; set; } + + /// + /// Gets or sets the invoice sections associated to the billing profile. By + /// default this is not populated, unless it's specified in $expand. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "invoiceSections")] + public InvoiceSectionsOnExpand InvoiceSections {get; set; } + + /// + /// Gets indicates whether user has read access to the billing profile. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "hasReadAccess")] + public bool? HasReadAccess {get; private set; } + + /// + /// Gets the system generated unique identifier for a billing profile. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "systemId")] + public string SystemId {get; private set; } + + /// + /// Gets the status of the billing profile. Possible values include: 'Active', 'Disabled', 'Warned' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; private set; } + + /// + /// Gets reason for the specified billing profile status. Possible values include: 'PastDue', 'SpendingLimitReached', 'SpendingLimitExpired' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "statusReasonCode")] + public string StatusReasonCode {get; private set; } + + /// + /// Gets the billing profile spending limit. Possible values include: 'Off', 'On' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "spendingLimit")] + public string SpendingLimit {get; private set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + + + if (this.BillTo != null) + { + this.BillTo.Validate(); + } + + + + + + + + } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileSpendingLimit.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileSpendingLimit.cs new file mode 100644 index 000000000000..1bfa2c41e1bb --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileSpendingLimit.cs @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for BillingProfileSpendingLimit. + /// + + + public static class BillingProfileSpendingLimit + { + public const string Off = "Off"; + public const string On = "On"; + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileStatus.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileStatus.cs new file mode 100644 index 000000000000..a90388196f19 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileStatus.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for BillingProfileStatus. + /// + + + public static class BillingProfileStatus + { + public const string Active = "Active"; + public const string Disabled = "Disabled"; + public const string Warned = "Warned"; + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileStatusReasonCode.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileStatusReasonCode.cs new file mode 100644 index 000000000000..30bb6892ad08 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfileStatusReasonCode.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for BillingProfileStatusReasonCode. + /// + + + public static class BillingProfileStatusReasonCode + { + public const string PastDue = "PastDue"; + public const string SpendingLimitReached = "SpendingLimitReached"; + public const string SpendingLimitExpired = "SpendingLimitExpired"; + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfilesCreateOrUpdateHeaders.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfilesCreateOrUpdateHeaders.cs new file mode 100644 index 000000000000..13a461155994 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfilesCreateOrUpdateHeaders.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + public partial class BillingProfilesCreateOrUpdateHeaders + { + /// + /// Initializes a new instance of the BillingProfilesCreateOrUpdateHeaders class. + /// + public BillingProfilesCreateOrUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingProfilesCreateOrUpdateHeaders class. + /// + + /// + /// + + /// + /// + public BillingProfilesCreateOrUpdateHeaders(string location = default(string), int? retryAfter = default(int?)) + + { + this.Location = location; + this.RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Location")] + public string Location {get; set; } + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter {get; set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfilesOnExpand.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfilesOnExpand.cs new file mode 100644 index 000000000000..6f10d9f23b94 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProfilesOnExpand.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The billing profiles associated with the billing account. By default this + /// is not populated, unless it's specified in $expand. + /// + public partial class BillingProfilesOnExpand + { + /// + /// Initializes a new instance of the BillingProfilesOnExpand class. + /// + public BillingProfilesOnExpand() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingProfilesOnExpand class. + /// + + /// Indicates whether there are more billing profiles than the ones listed in + /// this collection. The collection lists a maximum of 50 billing profiles. To + /// get all billing profiles, use the list billing profiles API. + /// + + /// The billing profiles associated with the billing account. + /// + public BillingProfilesOnExpand(bool? hasMoreResults = default(bool?), System.Collections.Generic.IList value = default(System.Collections.Generic.IList)) + + { + this.HasMoreResults = hasMoreResults; + this.Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets indicates whether there are more billing profiles than the ones listed + /// in this collection. The collection lists a maximum of 50 billing profiles. + /// To get all billing profiles, use the list billing profiles API. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "hasMoreResults")] + public bool? HasMoreResults {get; private set; } + + /// + /// Gets or sets the billing profiles associated with the billing account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "value")] + public System.Collections.Generic.IList Value {get; set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProperty.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProperty.cs new file mode 100644 index 000000000000..6488d3e9a8bc --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingProperty.cs @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// A billing property. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class BillingProperty : Resource + { + /// + /// Initializes a new instance of the BillingProperty class. + /// + public BillingProperty() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingProperty class. + /// + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// + + /// The email address on which the account admin gets all Azure notifications. + /// + + /// The Azure AD tenant ID of the billing account for the subscription. + /// + + /// The ID of the billing account to which the subscription is billed. + /// + + /// The name of the billing account to which the subscription is billed. + /// + + /// The ID of the billing profile to which the subscription is billed. + /// + + /// The name of the billing profile to which the subscription is billed. + /// + + /// The status of the billing profile. + /// Possible values include: 'Active', 'Disabled', 'Warned' + + /// Reason for the specified billing profile status. + /// Possible values include: 'PastDue', 'SpendingLimitReached', + /// 'SpendingLimitExpired' + + /// The billing profile spending limit. + /// Possible values include: 'Off', 'On' + + /// The cost center applied to the subscription. + /// + + /// The ID of the invoice section to which the subscription is billed. + /// + + /// The name of the invoice section to which the subscription is billed. + /// + + /// Indicates whether user is the account admin. + /// + + /// The product ID of the Azure plan. + /// + + /// The product name of the Azure plan. + /// + + /// The sku ID of the Azure plan for the subscription. + /// + + /// The sku description of the Azure plan for the subscription. + /// + public BillingProperty(string id = default(string), string name = default(string), string type = default(string), string accountAdminNotificationEmailAddress = default(string), string billingTenantId = default(string), string billingAccountId = default(string), string billingAccountDisplayName = default(string), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string billingProfileStatus = default(string), string billingProfileStatusReasonCode = default(string), string billingProfileSpendingLimit = default(string), string costCenter = default(string), string invoiceSectionId = default(string), string invoiceSectionDisplayName = default(string), bool? isAccountAdmin = default(bool?), string productId = default(string), string productName = default(string), string skuId = default(string), string skuDescription = default(string)) + + : base(id, name, type) + { + this.AccountAdminNotificationEmailAddress = accountAdminNotificationEmailAddress; + this.BillingTenantId = billingTenantId; + this.BillingAccountId = billingAccountId; + this.BillingAccountDisplayName = billingAccountDisplayName; + this.BillingProfileId = billingProfileId; + this.BillingProfileDisplayName = billingProfileDisplayName; + this.BillingProfileStatus = billingProfileStatus; + this.BillingProfileStatusReasonCode = billingProfileStatusReasonCode; + this.BillingProfileSpendingLimit = billingProfileSpendingLimit; + this.CostCenter = costCenter; + this.InvoiceSectionId = invoiceSectionId; + this.InvoiceSectionDisplayName = invoiceSectionDisplayName; + this.IsAccountAdmin = isAccountAdmin; + this.ProductId = productId; + this.ProductName = productName; + this.SkuId = skuId; + this.SkuDescription = skuDescription; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the email address on which the account admin gets all Azure + /// notifications. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.accountAdminNotificationEmailAddress")] + public string AccountAdminNotificationEmailAddress {get; private set; } + + /// + /// Gets the Azure AD tenant ID of the billing account for the subscription. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingTenantId")] + public string BillingTenantId {get; private set; } + + /// + /// Gets the ID of the billing account to which the subscription is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingAccountId")] + public string BillingAccountId {get; private set; } + + /// + /// Gets the name of the billing account to which the subscription is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingAccountDisplayName")] + public string BillingAccountDisplayName {get; private set; } + + /// + /// Gets the ID of the billing profile to which the subscription is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingProfileId")] + public string BillingProfileId {get; private set; } + + /// + /// Gets the name of the billing profile to which the subscription is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingProfileDisplayName")] + public string BillingProfileDisplayName {get; private set; } + + /// + /// Gets the status of the billing profile. Possible values include: 'Active', 'Disabled', 'Warned' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingProfileStatus")] + public string BillingProfileStatus {get; private set; } + + /// + /// Gets reason for the specified billing profile status. Possible values include: 'PastDue', 'SpendingLimitReached', 'SpendingLimitExpired' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingProfileStatusReasonCode")] + public string BillingProfileStatusReasonCode {get; private set; } + + /// + /// Gets the billing profile spending limit. Possible values include: 'Off', 'On' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingProfileSpendingLimit")] + public string BillingProfileSpendingLimit {get; private set; } + + /// + /// Gets or sets the cost center applied to the subscription. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.costCenter")] + public string CostCenter {get; set; } + + /// + /// Gets the ID of the invoice section to which the subscription is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.invoiceSectionId")] + public string InvoiceSectionId {get; private set; } + + /// + /// Gets the name of the invoice section to which the subscription is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.invoiceSectionDisplayName")] + public string InvoiceSectionDisplayName {get; private set; } + + /// + /// Gets indicates whether user is the account admin. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.isAccountAdmin")] + public bool? IsAccountAdmin {get; private set; } + + /// + /// Gets the product ID of the Azure plan. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.productId")] + public string ProductId {get; private set; } + + /// + /// Gets the product name of the Azure plan. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.productName")] + public string ProductName {get; private set; } + + /// + /// Gets the sku ID of the Azure plan for the subscription. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.skuId")] + public string SkuId {get; private set; } + + /// + /// Gets the sku description of the Azure plan for the subscription. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.skuDescription")] + public string SkuDescription {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingPropertyProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingPropertyProperties.cs new file mode 100644 index 000000000000..72a81ddfa3ab --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingPropertyProperties.cs @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The billing property. + /// + public partial class BillingPropertyProperties + { + /// + /// Initializes a new instance of the BillingPropertyProperties class. + /// + public BillingPropertyProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingPropertyProperties class. + /// + + /// The email address on which the account admin gets all Azure notifications. + /// + + /// The Azure AD tenant ID of the billing account for the subscription. + /// + + /// The ID of the billing account to which the subscription is billed. + /// + + /// The name of the billing account to which the subscription is billed. + /// + + /// The ID of the billing profile to which the subscription is billed. + /// + + /// The name of the billing profile to which the subscription is billed. + /// + + /// The status of the billing profile. + /// Possible values include: 'Active', 'Disabled', 'Warned' + + /// Reason for the specified billing profile status. + /// Possible values include: 'PastDue', 'SpendingLimitReached', + /// 'SpendingLimitExpired' + + /// The billing profile spending limit. + /// Possible values include: 'Off', 'On' + + /// The cost center applied to the subscription. + /// + + /// The ID of the invoice section to which the subscription is billed. + /// + + /// The name of the invoice section to which the subscription is billed. + /// + + /// Indicates whether user is the account admin. + /// + + /// The product ID of the Azure plan. + /// + + /// The product name of the Azure plan. + /// + + /// The sku ID of the Azure plan for the subscription. + /// + + /// The sku description of the Azure plan for the subscription. + /// + public BillingPropertyProperties(string accountAdminNotificationEmailAddress = default(string), string billingTenantId = default(string), string billingAccountId = default(string), string billingAccountDisplayName = default(string), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string billingProfileStatus = default(string), string billingProfileStatusReasonCode = default(string), string billingProfileSpendingLimit = default(string), string costCenter = default(string), string invoiceSectionId = default(string), string invoiceSectionDisplayName = default(string), bool? isAccountAdmin = default(bool?), string productId = default(string), string productName = default(string), string skuId = default(string), string skuDescription = default(string)) + + { + this.AccountAdminNotificationEmailAddress = accountAdminNotificationEmailAddress; + this.BillingTenantId = billingTenantId; + this.BillingAccountId = billingAccountId; + this.BillingAccountDisplayName = billingAccountDisplayName; + this.BillingProfileId = billingProfileId; + this.BillingProfileDisplayName = billingProfileDisplayName; + this.BillingProfileStatus = billingProfileStatus; + this.BillingProfileStatusReasonCode = billingProfileStatusReasonCode; + this.BillingProfileSpendingLimit = billingProfileSpendingLimit; + this.CostCenter = costCenter; + this.InvoiceSectionId = invoiceSectionId; + this.InvoiceSectionDisplayName = invoiceSectionDisplayName; + this.IsAccountAdmin = isAccountAdmin; + this.ProductId = productId; + this.ProductName = productName; + this.SkuId = skuId; + this.SkuDescription = skuDescription; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the email address on which the account admin gets all Azure + /// notifications. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "accountAdminNotificationEmailAddress")] + public string AccountAdminNotificationEmailAddress {get; private set; } + + /// + /// Gets the Azure AD tenant ID of the billing account for the subscription. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingTenantId")] + public string BillingTenantId {get; private set; } + + /// + /// Gets the ID of the billing account to which the subscription is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingAccountId")] + public string BillingAccountId {get; private set; } + + /// + /// Gets the name of the billing account to which the subscription is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingAccountDisplayName")] + public string BillingAccountDisplayName {get; private set; } + + /// + /// Gets the ID of the billing profile to which the subscription is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileId")] + public string BillingProfileId {get; private set; } + + /// + /// Gets the name of the billing profile to which the subscription is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileDisplayName")] + public string BillingProfileDisplayName {get; private set; } + + /// + /// Gets the status of the billing profile. Possible values include: 'Active', 'Disabled', 'Warned' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileStatus")] + public string BillingProfileStatus {get; private set; } + + /// + /// Gets reason for the specified billing profile status. Possible values include: 'PastDue', 'SpendingLimitReached', 'SpendingLimitExpired' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileStatusReasonCode")] + public string BillingProfileStatusReasonCode {get; private set; } + + /// + /// Gets the billing profile spending limit. Possible values include: 'Off', 'On' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileSpendingLimit")] + public string BillingProfileSpendingLimit {get; private set; } + + /// + /// Gets or sets the cost center applied to the subscription. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "costCenter")] + public string CostCenter {get; set; } + + /// + /// Gets the ID of the invoice section to which the subscription is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "invoiceSectionId")] + public string InvoiceSectionId {get; private set; } + + /// + /// Gets the name of the invoice section to which the subscription is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "invoiceSectionDisplayName")] + public string InvoiceSectionDisplayName {get; private set; } + + /// + /// Gets indicates whether user is the account admin. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "isAccountAdmin")] + public bool? IsAccountAdmin {get; private set; } + + /// + /// Gets the product ID of the Azure plan. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "productId")] + public string ProductId {get; private set; } + + /// + /// Gets the product name of the Azure plan. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "productName")] + public string ProductName {get; private set; } + + /// + /// Gets the sku ID of the Azure plan for the subscription. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "skuId")] + public string SkuId {get; private set; } + + /// + /// Gets the sku description of the Azure plan for the subscription. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "skuDescription")] + public string SkuDescription {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingRoleAssignment.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingRoleAssignment.cs new file mode 100644 index 000000000000..23d74ef05b22 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingRoleAssignment.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The role assignment + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class BillingRoleAssignment : Resource + { + /// + /// Initializes a new instance of the BillingRoleAssignment class. + /// + public BillingRoleAssignment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingRoleAssignment class. + /// + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// + + /// The date the role assignment was created. + /// + + /// The tenant Id of the user who created the role assignment. + /// + + /// The principal Id of the user who created the role assignment. + /// + + /// The email address of the user who created the role assignment. + /// + + /// The principal id of the user to whom the role was assigned. + /// + + /// The principal tenant id of the user to whom the role was assigned. + /// + + /// The ID of the role definition. + /// + + /// The scope at which the role was assigned. + /// + + /// The authentication type. + /// + + /// The email address of the user. + /// + public BillingRoleAssignment(string id = default(string), string name = default(string), string type = default(string), string createdOn = default(string), string createdByPrincipalTenantId = default(string), string createdByPrincipalId = default(string), string createdByUserEmailAddress = default(string), string principalId = default(string), string principalTenantId = default(string), string roleDefinitionId = default(string), string scope = default(string), string userAuthenticationType = default(string), string userEmailAddress = default(string)) + + : base(id, name, type) + { + this.CreatedOn = createdOn; + this.CreatedByPrincipalTenantId = createdByPrincipalTenantId; + this.CreatedByPrincipalId = createdByPrincipalId; + this.CreatedByUserEmailAddress = createdByUserEmailAddress; + this.PrincipalId = principalId; + this.PrincipalTenantId = principalTenantId; + this.RoleDefinitionId = roleDefinitionId; + this.Scope = scope; + this.UserAuthenticationType = userAuthenticationType; + this.UserEmailAddress = userEmailAddress; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the date the role assignment was created. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdOn")] + public string CreatedOn {get; private set; } + + /// + /// Gets the tenant Id of the user who created the role assignment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdByPrincipalTenantId")] + public string CreatedByPrincipalTenantId {get; private set; } + + /// + /// Gets the principal Id of the user who created the role assignment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdByPrincipalId")] + public string CreatedByPrincipalId {get; private set; } + + /// + /// Gets the email address of the user who created the role assignment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.createdByUserEmailAddress")] + public string CreatedByUserEmailAddress {get; private set; } + + /// + /// Gets or sets the principal id of the user to whom the role was assigned. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.principalId")] + public string PrincipalId {get; set; } + + /// + /// Gets or sets the principal tenant id of the user to whom the role was + /// assigned. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.principalTenantId")] + public string PrincipalTenantId {get; set; } + + /// + /// Gets or sets the ID of the role definition. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.roleDefinitionId")] + public string RoleDefinitionId {get; set; } + + /// + /// Gets the scope at which the role was assigned. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.scope")] + public string Scope {get; private set; } + + /// + /// Gets or sets the authentication type. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.userAuthenticationType")] + public string UserAuthenticationType {get; set; } + + /// + /// Gets or sets the email address of the user. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.userEmailAddress")] + public string UserEmailAddress {get; set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingRoleAssignmentProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingRoleAssignmentProperties.cs new file mode 100644 index 000000000000..5d43f49b5e2e --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingRoleAssignmentProperties.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.Models +{ + using System.Linq; + + /// + /// The properties of the role assignment. + /// + public partial class BillingRoleAssignmentProperties + { + /// + /// Initializes a new instance of the BillingRoleAssignmentProperties class. + /// + public BillingRoleAssignmentProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingRoleAssignmentProperties class. + /// + + /// The date the role assignment was created. + /// + + /// The tenant Id of the user who created the role assignment. + /// + + /// The principal Id of the user who created the role assignment. + /// + + /// The email address of the user who created the role assignment. + /// + + /// The principal id of the user to whom the role was assigned. + /// + + /// The principal tenant id of the user to whom the role was assigned. + /// + + /// The ID of the role definition. + /// + + /// The scope at which the role was assigned. + /// + + /// The authentication type. + /// + + /// The email address of the user. + /// + public BillingRoleAssignmentProperties(string createdOn = default(string), string createdByPrincipalTenantId = default(string), string createdByPrincipalId = default(string), string createdByUserEmailAddress = default(string), string principalId = default(string), string principalTenantId = default(string), string roleDefinitionId = default(string), string scope = default(string), string userAuthenticationType = default(string), string userEmailAddress = default(string)) + + { + this.CreatedOn = createdOn; + this.CreatedByPrincipalTenantId = createdByPrincipalTenantId; + this.CreatedByPrincipalId = createdByPrincipalId; + this.CreatedByUserEmailAddress = createdByUserEmailAddress; + this.PrincipalId = principalId; + this.PrincipalTenantId = principalTenantId; + this.RoleDefinitionId = roleDefinitionId; + this.Scope = scope; + this.UserAuthenticationType = userAuthenticationType; + this.UserEmailAddress = userEmailAddress; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the date the role assignment was created. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdOn")] + public string CreatedOn {get; private set; } + + /// + /// Gets the tenant Id of the user who created the role assignment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdByPrincipalTenantId")] + public string CreatedByPrincipalTenantId {get; private set; } + + /// + /// Gets the principal Id of the user who created the role assignment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdByPrincipalId")] + public string CreatedByPrincipalId {get; private set; } + + /// + /// Gets the email address of the user who created the role assignment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "createdByUserEmailAddress")] + public string CreatedByUserEmailAddress {get; private set; } + + /// + /// Gets or sets the principal id of the user to whom the role was assigned. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "principalId")] + public string PrincipalId {get; set; } + + /// + /// Gets or sets the principal tenant id of the user to whom the role was + /// assigned. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "principalTenantId")] + public string PrincipalTenantId {get; set; } + + /// + /// Gets or sets the ID of the role definition. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "roleDefinitionId")] + public string RoleDefinitionId {get; set; } + + /// + /// Gets the scope at which the role was assigned. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "scope")] + public string Scope {get; private set; } + + /// + /// Gets or sets the authentication type. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "userAuthenticationType")] + public string UserAuthenticationType {get; set; } + + /// + /// Gets or sets the email address of the user. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "userEmailAddress")] + public string UserEmailAddress {get; set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingRoleDefinition.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingRoleDefinition.cs new file mode 100644 index 000000000000..193e459f8a93 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingRoleDefinition.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The properties of a role definition. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class BillingRoleDefinition : Resource + { + /// + /// Initializes a new instance of the BillingRoleDefinition class. + /// + public BillingRoleDefinition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingRoleDefinition class. + /// + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// + + /// The role description + /// + + /// The billingPermissions the role has + /// + + /// The name of the role + /// + public BillingRoleDefinition(string id = default(string), string name = default(string), string type = default(string), string description = default(string), System.Collections.Generic.IList permissions = default(System.Collections.Generic.IList), string roleName = default(string)) + + : base(id, name, type) + { + this.Description = description; + this.Permissions = permissions; + this.RoleName = roleName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the role description + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.description")] + public string Description {get; private set; } + + /// + /// Gets or sets the billingPermissions the role has + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.permissions")] + public System.Collections.Generic.IList Permissions {get; set; } + + /// + /// Gets the name of the role + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.roleName")] + public string RoleName {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingRoleDefinitionProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingRoleDefinitionProperties.cs new file mode 100644 index 000000000000..e62c9921a623 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingRoleDefinitionProperties.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The properties of the a role definition. + /// + public partial class BillingRoleDefinitionProperties + { + /// + /// Initializes a new instance of the BillingRoleDefinitionProperties class. + /// + public BillingRoleDefinitionProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingRoleDefinitionProperties class. + /// + + /// The role description + /// + + /// The billingPermissions the role has + /// + + /// The name of the role + /// + public BillingRoleDefinitionProperties(string description = default(string), System.Collections.Generic.IList permissions = default(System.Collections.Generic.IList), string roleName = default(string)) + + { + this.Description = description; + this.Permissions = permissions; + this.RoleName = roleName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the role description + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; private set; } + + /// + /// Gets or sets the billingPermissions the role has + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "permissions")] + public System.Collections.Generic.IList Permissions {get; set; } + + /// + /// Gets the name of the role + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "roleName")] + public string RoleName {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingSubscription.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingSubscription.cs new file mode 100644 index 000000000000..a22ca2b90c1f --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingSubscription.cs @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// A billing subscription. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class BillingSubscription : Resource + { + /// + /// Initializes a new instance of the BillingSubscription class. + /// + public BillingSubscription() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingSubscription class. + /// + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// + + /// Reseller for this subscription. + /// + + /// The name of the subscription. + /// + + /// The ID of the subscription. + /// + + /// The current billing status of the subscription. + /// Possible values include: 'Active', 'Inactive', 'Abandoned', 'Deleted', + /// 'Warning' + + /// The last month charges. + /// + + /// The current month to date charges. + /// + + /// The ID of the billing profile to which the subscription is billed. + /// + + /// The name of the billing profile to which the subscription is billed. + /// + + /// The cost center applied to the subscription. + /// + + /// The ID of the customer for whom the subscription was created. The field is + /// applicable only for Microsoft Partner Agreement billing account. + /// + + /// The name of the customer for whom the subscription was created. The field + /// is applicable only for Microsoft Partner Agreement billing account. + /// + + /// The ID of the invoice section to which the subscription is billed. + /// + + /// The name of the invoice section to which the subscription is billed. + /// + + /// The sku ID of the Azure plan for the subscription. + /// + + /// The sku description of the Azure plan for the subscription. + /// + public BillingSubscription(string id = default(string), string name = default(string), string type = default(string), Reseller reseller = default(Reseller), string displayName = default(string), System.Guid? subscriptionId = default(System.Guid?), string subscriptionBillingStatus = default(string), Amount lastMonthCharges = default(Amount), Amount monthToDateCharges = default(Amount), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string costCenter = default(string), string customerId = default(string), string customerDisplayName = default(string), string invoiceSectionId = default(string), string invoiceSectionDisplayName = default(string), string skuId = default(string), string skuDescription = default(string)) + + : base(id, name, type) + { + this.Reseller = reseller; + this.DisplayName = displayName; + this.SubscriptionId = subscriptionId; + this.SubscriptionBillingStatus = subscriptionBillingStatus; + this.LastMonthCharges = lastMonthCharges; + this.MonthToDateCharges = monthToDateCharges; + this.BillingProfileId = billingProfileId; + this.BillingProfileDisplayName = billingProfileDisplayName; + this.CostCenter = costCenter; + this.CustomerId = customerId; + this.CustomerDisplayName = customerDisplayName; + this.InvoiceSectionId = invoiceSectionId; + this.InvoiceSectionDisplayName = invoiceSectionDisplayName; + this.SkuId = skuId; + this.SkuDescription = skuDescription; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets reseller for this subscription. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.reseller")] + public Reseller Reseller {get; private set; } + + /// + /// Gets the name of the subscription. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName {get; private set; } + + /// + /// Gets the ID of the subscription. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.subscriptionId")] + public System.Guid? SubscriptionId {get; private set; } + + /// + /// Gets or sets the current billing status of the subscription. Possible values include: 'Active', 'Inactive', 'Abandoned', 'Deleted', 'Warning' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.subscriptionBillingStatus")] + public string SubscriptionBillingStatus {get; set; } + + /// + /// Gets the last month charges. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.lastMonthCharges")] + public Amount LastMonthCharges {get; private set; } + + /// + /// Gets the current month to date charges. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.monthToDateCharges")] + public Amount MonthToDateCharges {get; private set; } + + /// + /// Gets the ID of the billing profile to which the subscription is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingProfileId")] + public string BillingProfileId {get; private set; } + + /// + /// Gets the name of the billing profile to which the subscription is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingProfileDisplayName")] + public string BillingProfileDisplayName {get; private set; } + + /// + /// Gets or sets the cost center applied to the subscription. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.costCenter")] + public string CostCenter {get; set; } + + /// + /// Gets the ID of the customer for whom the subscription was created. The + /// field is applicable only for Microsoft Partner Agreement billing account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.customerId")] + public string CustomerId {get; private set; } + + /// + /// Gets the name of the customer for whom the subscription was created. The + /// field is applicable only for Microsoft Partner Agreement billing account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.customerDisplayName")] + public string CustomerDisplayName {get; private set; } + + /// + /// Gets the ID of the invoice section to which the subscription is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.invoiceSectionId")] + public string InvoiceSectionId {get; private set; } + + /// + /// Gets the name of the invoice section to which the subscription is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.invoiceSectionDisplayName")] + public string InvoiceSectionDisplayName {get; private set; } + + /// + /// Gets or sets the sku ID of the Azure plan for the subscription. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.skuId")] + public string SkuId {get; set; } + + /// + /// Gets the sku description of the Azure plan for the subscription. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.skuDescription")] + public string SkuDescription {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingSubscriptionProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingSubscriptionProperties.cs new file mode 100644 index 000000000000..c7b03bf5a601 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingSubscriptionProperties.cs @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The billing properties of a subscription. + /// + public partial class BillingSubscriptionProperties + { + /// + /// Initializes a new instance of the BillingSubscriptionProperties class. + /// + public BillingSubscriptionProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingSubscriptionProperties class. + /// + + /// The name of the subscription. + /// + + /// The ID of the subscription. + /// + + /// The current billing status of the subscription. + /// Possible values include: 'Active', 'Inactive', 'Abandoned', 'Deleted', + /// 'Warning' + + /// The last month charges. + /// + + /// The current month to date charges. + /// + + /// The ID of the billing profile to which the subscription is billed. + /// + + /// The name of the billing profile to which the subscription is billed. + /// + + /// The cost center applied to the subscription. + /// + + /// The ID of the customer for whom the subscription was created. The field is + /// applicable only for Microsoft Partner Agreement billing account. + /// + + /// The name of the customer for whom the subscription was created. The field + /// is applicable only for Microsoft Partner Agreement billing account. + /// + + /// The ID of the invoice section to which the subscription is billed. + /// + + /// The name of the invoice section to which the subscription is billed. + /// + + /// Reseller for this subscription. + /// + + /// The sku ID of the Azure plan for the subscription. + /// + + /// The sku description of the Azure plan for the subscription. + /// + public BillingSubscriptionProperties(string displayName = default(string), System.Guid? subscriptionId = default(System.Guid?), string subscriptionBillingStatus = default(string), Amount lastMonthCharges = default(Amount), Amount monthToDateCharges = default(Amount), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string costCenter = default(string), string customerId = default(string), string customerDisplayName = default(string), string invoiceSectionId = default(string), string invoiceSectionDisplayName = default(string), Reseller reseller = default(Reseller), string skuId = default(string), string skuDescription = default(string)) + + { + this.DisplayName = displayName; + this.SubscriptionId = subscriptionId; + this.SubscriptionBillingStatus = subscriptionBillingStatus; + this.LastMonthCharges = lastMonthCharges; + this.MonthToDateCharges = monthToDateCharges; + this.BillingProfileId = billingProfileId; + this.BillingProfileDisplayName = billingProfileDisplayName; + this.CostCenter = costCenter; + this.CustomerId = customerId; + this.CustomerDisplayName = customerDisplayName; + this.InvoiceSectionId = invoiceSectionId; + this.InvoiceSectionDisplayName = invoiceSectionDisplayName; + this.Reseller = reseller; + this.SkuId = skuId; + this.SkuDescription = skuDescription; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the name of the subscription. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "displayName")] + public string DisplayName {get; private set; } + + /// + /// Gets the ID of the subscription. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "subscriptionId")] + public System.Guid? SubscriptionId {get; private set; } + + /// + /// Gets or sets the current billing status of the subscription. Possible values include: 'Active', 'Inactive', 'Abandoned', 'Deleted', 'Warning' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "subscriptionBillingStatus")] + public string SubscriptionBillingStatus {get; set; } + + /// + /// Gets the last month charges. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "lastMonthCharges")] + public Amount LastMonthCharges {get; private set; } + + /// + /// Gets the current month to date charges. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "monthToDateCharges")] + public Amount MonthToDateCharges {get; private set; } + + /// + /// Gets the ID of the billing profile to which the subscription is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileId")] + public string BillingProfileId {get; private set; } + + /// + /// Gets the name of the billing profile to which the subscription is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileDisplayName")] + public string BillingProfileDisplayName {get; private set; } + + /// + /// Gets or sets the cost center applied to the subscription. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "costCenter")] + public string CostCenter {get; set; } + + /// + /// Gets the ID of the customer for whom the subscription was created. The + /// field is applicable only for Microsoft Partner Agreement billing account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "customerId")] + public string CustomerId {get; private set; } + + /// + /// Gets the name of the customer for whom the subscription was created. The + /// field is applicable only for Microsoft Partner Agreement billing account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "customerDisplayName")] + public string CustomerDisplayName {get; private set; } + + /// + /// Gets the ID of the invoice section to which the subscription is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "invoiceSectionId")] + public string InvoiceSectionId {get; private set; } + + /// + /// Gets the name of the invoice section to which the subscription is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "invoiceSectionDisplayName")] + public string InvoiceSectionDisplayName {get; private set; } + + /// + /// Gets reseller for this subscription. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "reseller")] + public Reseller Reseller {get; private set; } + + /// + /// Gets or sets the sku ID of the Azure plan for the subscription. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "skuId")] + public string SkuId {get; set; } + + /// + /// Gets the sku description of the Azure plan for the subscription. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "skuDescription")] + public string SkuDescription {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingSubscriptionStatusType.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingSubscriptionStatusType.cs new file mode 100644 index 000000000000..7ce390acb8ae --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingSubscriptionStatusType.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for BillingSubscriptionStatusType. + /// + + + public static class BillingSubscriptionStatusType + { + public const string Active = "Active"; + public const string Inactive = "Inactive"; + public const string Abandoned = "Abandoned"; + public const string Deleted = "Deleted"; + public const string Warning = "Warning"; + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/BillingSubscriptionsMoveHeaders.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingSubscriptionsMoveHeaders.cs new file mode 100644 index 000000000000..66db29fc08f3 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/BillingSubscriptionsMoveHeaders.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + public partial class BillingSubscriptionsMoveHeaders + { + /// + /// Initializes a new instance of the BillingSubscriptionsMoveHeaders class. + /// + public BillingSubscriptionsMoveHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BillingSubscriptionsMoveHeaders class. + /// + + /// + /// + + /// + /// + public BillingSubscriptionsMoveHeaders(string location = default(string), int? retryAfter = default(int?)) + + { + this.Location = location; + this.RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Location")] + public string Location {get; set; } + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter {get; set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Category.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Category.cs new file mode 100644 index 000000000000..5690ba5bc1be --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Category.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for Category. + /// + + + public static class Category + { + public const string MicrosoftCustomerAgreement = "MicrosoftCustomerAgreement"; + public const string AffiliatePurchaseTerms = "AffiliatePurchaseTerms"; + public const string Other = "Other"; + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Customer.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Customer.cs new file mode 100644 index 000000000000..026eab0ba7ae --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Customer.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// A partner's customer. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class Customer : Resource + { + /// + /// Initializes a new instance of the Customer class. + /// + public Customer() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Customer class. + /// + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// + + /// The ID of the billing profile for the invoice section. + /// + + /// The name of the billing profile for the invoice section. + /// + + /// The name of the customer. + /// + + /// Azure plans enabled for the customer. + /// + + /// The list of resellers for which an Azure plan is enabled for the customer. + /// + public Customer(string id = default(string), string name = default(string), string type = default(string), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string displayName = default(string), System.Collections.Generic.IList enabledAzurePlans = default(System.Collections.Generic.IList), System.Collections.Generic.IList resellers = default(System.Collections.Generic.IList)) + + : base(id, name, type) + { + this.BillingProfileId = billingProfileId; + this.BillingProfileDisplayName = billingProfileDisplayName; + this.DisplayName = displayName; + this.EnabledAzurePlans = enabledAzurePlans; + this.Resellers = resellers; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the ID of the billing profile for the invoice section. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingProfileId")] + public string BillingProfileId {get; private set; } + + /// + /// Gets the name of the billing profile for the invoice section. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingProfileDisplayName")] + public string BillingProfileDisplayName {get; private set; } + + /// + /// Gets or sets the name of the customer. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName {get; set; } + + /// + /// Gets or sets azure plans enabled for the customer. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.enabledAzurePlans")] + public System.Collections.Generic.IList EnabledAzurePlans {get; set; } + + /// + /// Gets or sets the list of resellers for which an Azure plan is enabled for + /// the customer. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.resellers")] + public System.Collections.Generic.IList Resellers {get; set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/CustomerPolicy.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/CustomerPolicy.cs new file mode 100644 index 000000000000..705ac937c598 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/CustomerPolicy.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The customer's Policy. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class CustomerPolicy : Resource + { + /// + /// Initializes a new instance of the CustomerPolicy class. + /// + public CustomerPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CustomerPolicy class. + /// + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// + + /// The policy that controls whether the users in customer's organization can + /// view charges at pay-as-you-go prices. + /// Possible values include: 'Allowed', 'NotAllowed' + public CustomerPolicy(string id = default(string), string name = default(string), string type = default(string), string viewCharges = default(string)) + + : base(id, name, type) + { + this.ViewCharges = viewCharges; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the policy that controls whether the users in customer's + /// organization can view charges at pay-as-you-go prices. Possible values include: 'Allowed', 'NotAllowed' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.viewCharges")] + public string ViewCharges {get; set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/CustomerPolicyProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/CustomerPolicyProperties.cs new file mode 100644 index 000000000000..f17349933dad --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/CustomerPolicyProperties.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The properties of a customer's policy. + /// + public partial class CustomerPolicyProperties + { + /// + /// Initializes a new instance of the CustomerPolicyProperties class. + /// + public CustomerPolicyProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CustomerPolicyProperties class. + /// + + /// The policy that controls whether the users in customer's organization can + /// view charges at pay-as-you-go prices. + /// Possible values include: 'Allowed', 'NotAllowed' + public CustomerPolicyProperties(string viewCharges = default(string)) + + { + this.ViewCharges = viewCharges; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the policy that controls whether the users in customer's + /// organization can view charges at pay-as-you-go prices. Possible values include: 'Allowed', 'NotAllowed' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "viewCharges")] + public string ViewCharges {get; set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/CustomerProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/CustomerProperties.cs new file mode 100644 index 000000000000..c1eb16eea6eb --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/CustomerProperties.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The properties of a customer. + /// + public partial class CustomerProperties + { + /// + /// Initializes a new instance of the CustomerProperties class. + /// + public CustomerProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CustomerProperties class. + /// + + /// The ID of the billing profile for the invoice section. + /// + + /// The name of the billing profile for the invoice section. + /// + + /// The name of the customer. + /// + + /// Azure plans enabled for the customer. + /// + + /// The list of resellers for which an Azure plan is enabled for the customer. + /// + public CustomerProperties(string billingProfileId = default(string), string billingProfileDisplayName = default(string), string displayName = default(string), System.Collections.Generic.IList enabledAzurePlans = default(System.Collections.Generic.IList), System.Collections.Generic.IList resellers = default(System.Collections.Generic.IList)) + + { + this.BillingProfileId = billingProfileId; + this.BillingProfileDisplayName = billingProfileDisplayName; + this.DisplayName = displayName; + this.EnabledAzurePlans = enabledAzurePlans; + this.Resellers = resellers; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the ID of the billing profile for the invoice section. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileId")] + public string BillingProfileId {get; private set; } + + /// + /// Gets the name of the billing profile for the invoice section. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileDisplayName")] + public string BillingProfileDisplayName {get; private set; } + + /// + /// Gets or sets the name of the customer. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "displayName")] + public string DisplayName {get; set; } + + /// + /// Gets or sets azure plans enabled for the customer. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "enabledAzurePlans")] + public System.Collections.Generic.IList EnabledAzurePlans {get; set; } + + /// + /// Gets or sets the list of resellers for which an Azure plan is enabled for + /// the customer. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "resellers")] + public System.Collections.Generic.IList Resellers {get; set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Department.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Department.cs new file mode 100644 index 000000000000..fa427bb1e6ce --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Department.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// A department. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class Department : Resource + { + /// + /// Initializes a new instance of the Department class. + /// + public Department() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Department class. + /// + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// + + /// The name of the department. + /// + + /// The cost center associated with the department. + /// + + /// The status of the department. + /// + + /// Associated enrollment accounts. By default this is not populated, unless + /// it's specified in $expand. + /// + public Department(string id = default(string), string name = default(string), string type = default(string), string departmentName = default(string), string costCenter = default(string), string status = default(string), System.Collections.Generic.IList enrollmentAccounts = default(System.Collections.Generic.IList)) + + : base(id, name, type) + { + this.DepartmentName = departmentName; + this.CostCenter = costCenter; + this.Status = status; + this.EnrollmentAccounts = enrollmentAccounts; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the name of the department. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.departmentName")] + public string DepartmentName {get; set; } + + /// + /// Gets or sets the cost center associated with the department. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.costCenter")] + public string CostCenter {get; set; } + + /// + /// Gets or sets the status of the department. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.status")] + public string Status {get; set; } + + /// + /// Gets or sets associated enrollment accounts. By default this is not + /// populated, unless it's specified in $expand. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.enrollmentAccounts")] + public System.Collections.Generic.IList EnrollmentAccounts {get; set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/DepartmentProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/DepartmentProperties.cs new file mode 100644 index 000000000000..fa09fbdb0153 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/DepartmentProperties.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The properties of a department. + /// + public partial class DepartmentProperties + { + /// + /// Initializes a new instance of the DepartmentProperties class. + /// + public DepartmentProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DepartmentProperties class. + /// + + /// The name of the department. + /// + + /// The cost center associated with the department. + /// + + /// The status of the department. + /// + + /// Associated enrollment accounts. By default this is not populated, unless + /// it's specified in $expand. + /// + public DepartmentProperties(string departmentName = default(string), string costCenter = default(string), string status = default(string), System.Collections.Generic.IList enrollmentAccounts = default(System.Collections.Generic.IList)) + + { + this.DepartmentName = departmentName; + this.CostCenter = costCenter; + this.Status = status; + this.EnrollmentAccounts = enrollmentAccounts; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the name of the department. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "departmentName")] + public string DepartmentName {get; set; } + + /// + /// Gets or sets the cost center associated with the department. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "costCenter")] + public string CostCenter {get; set; } + + /// + /// Gets or sets the status of the department. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; set; } + + /// + /// Gets or sets associated enrollment accounts. By default this is not + /// populated, unless it's specified in $expand. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "enrollmentAccounts")] + public System.Collections.Generic.IList EnrollmentAccounts {get; set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Document.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Document.cs new file mode 100644 index 000000000000..861fbe200216 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Document.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The properties of a document. + /// + public partial class Document + { + /// + /// Initializes a new instance of the Document class. + /// + public Document() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Document class. + /// + + /// The type of the document. + /// Possible values include: 'Invoice', 'VoidNote', 'TaxReceipt', 'CreditNote' + + /// Document URL. + /// + + /// The source of the document. ENF for Brazil and DRS for rest of the world. + /// Possible values include: 'DRS', 'ENF' + public Document(string kind = default(string), string url = default(string), string source = default(string)) + + { + this.Kind = kind; + this.Url = url; + this.Source = source; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the type of the document. Possible values include: 'Invoice', 'VoidNote', 'TaxReceipt', 'CreditNote' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "kind")] + public string Kind {get; private set; } + + /// + /// Gets document URL. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "url")] + public string Url {get; private set; } + + /// + /// Gets the source of the document. ENF for Brazil and DRS for rest of the + /// world. Possible values include: 'DRS', 'ENF' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "source")] + public string Source {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/DocumentSource.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/DocumentSource.cs new file mode 100644 index 000000000000..4534da8794f7 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/DocumentSource.cs @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for DocumentSource. + /// + + + public static class DocumentSource + { + public const string DRS = "DRS"; + public const string ENF = "ENF"; + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/DocumentType.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/DocumentType.cs new file mode 100644 index 000000000000..5a388e1ad083 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/DocumentType.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for DocumentType. + /// + + + public static class DocumentType + { + public const string Invoice = "Invoice"; + public const string VoidNote = "VoidNote"; + public const string TaxReceipt = "TaxReceipt"; + public const string CreditNote = "CreditNote"; + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/DownloadUrl.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/DownloadUrl.cs new file mode 100644 index 000000000000..776943465180 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/DownloadUrl.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// A secure URL that can be used to download a an entity until the URL + /// expires. + /// + public partial class DownloadUrl + { + /// + /// Initializes a new instance of the DownloadUrl class. + /// + public DownloadUrl() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DownloadUrl class. + /// + + /// The time in UTC when the download URL will expire. + /// + + /// The URL to the PDF file. + /// + public DownloadUrl(System.DateTime? expiryTime = default(System.DateTime?), string url = default(string)) + + { + this.ExpiryTime = expiryTime; + this.Url = url; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the time in UTC when the download URL will expire. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "expiryTime")] + public System.DateTime? ExpiryTime {get; private set; } + + /// + /// Gets the URL to the PDF file. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "url")] + public string Url {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Enrollment.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Enrollment.cs new file mode 100644 index 000000000000..a79b8f83756f --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Enrollment.cs @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The properties of an enrollment. + /// + public partial class Enrollment + { + /// + /// Initializes a new instance of the Enrollment class. + /// + public Enrollment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Enrollment class. + /// + + /// The start date of the enrollment. + /// + + /// The end date of the enrollment. + /// + + /// The billing currency for the enrollment. + /// + + /// The channel type of the enrollment. + /// + + /// The policies for Enterprise Agreement enrollments. + /// + + /// The language for the enrollment. + /// + + /// The country code of the enrollment. + /// + + /// The current status of the enrollment. + /// + + /// The billing cycle for the enrollment. + /// + public Enrollment(System.DateTime? startDate = default(System.DateTime?), System.DateTime? endDate = default(System.DateTime?), string currency = default(string), string channel = default(string), EnrollmentPolicies policies = default(EnrollmentPolicies), string language = default(string), string countryCode = default(string), string status = default(string), string billingCycle = default(string)) + + { + this.StartDate = startDate; + this.EndDate = endDate; + this.Currency = currency; + this.Channel = channel; + this.Policies = policies; + this.Language = language; + this.CountryCode = countryCode; + this.Status = status; + this.BillingCycle = billingCycle; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the start date of the enrollment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "startDate")] + public System.DateTime? StartDate {get; set; } + + /// + /// Gets or sets the end date of the enrollment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "endDate")] + public System.DateTime? EndDate {get; set; } + + /// + /// Gets the billing currency for the enrollment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "currency")] + public string Currency {get; private set; } + + /// + /// Gets the channel type of the enrollment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "channel")] + public string Channel {get; private set; } + + /// + /// Gets the policies for Enterprise Agreement enrollments. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "policies")] + public EnrollmentPolicies Policies {get; private set; } + + /// + /// Gets the language for the enrollment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "language")] + public string Language {get; private set; } + + /// + /// Gets the country code of the enrollment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "countryCode")] + public string CountryCode {get; private set; } + + /// + /// Gets the current status of the enrollment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; private set; } + + /// + /// Gets the billing cycle for the enrollment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingCycle")] + public string BillingCycle {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccount.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccount.cs new file mode 100644 index 000000000000..166721d1486a --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccount.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// An enrollment account. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class EnrollmentAccount : Resource + { + /// + /// Initializes a new instance of the EnrollmentAccount class. + /// + public EnrollmentAccount() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EnrollmentAccount class. + /// + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// + + /// Associated department. By default this is not populated, unless it's + /// specified in $expand. + /// + + /// The name of the enrollment account. + /// + + /// The cost center associated with the enrollment account. + /// + + /// The owner of the enrollment account. + /// + + /// The status of the enrollment account. + /// + + /// The start date of the enrollment account. + /// + + /// The end date of the enrollment account. + /// + public EnrollmentAccount(string id = default(string), string name = default(string), string type = default(string), Department department = default(Department), string accountName = default(string), string costCenter = default(string), string accountOwner = default(string), string status = default(string), System.DateTime? startDate = default(System.DateTime?), System.DateTime? endDate = default(System.DateTime?)) + + : base(id, name, type) + { + this.Department = department; + this.AccountName = accountName; + this.CostCenter = costCenter; + this.AccountOwner = accountOwner; + this.Status = status; + this.StartDate = startDate; + this.EndDate = endDate; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets associated department. By default this is not populated, + /// unless it's specified in $expand. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.department")] + public Department Department {get; set; } + + /// + /// Gets or sets the name of the enrollment account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.accountName")] + public string AccountName {get; set; } + + /// + /// Gets or sets the cost center associated with the enrollment account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.costCenter")] + public string CostCenter {get; set; } + + /// + /// Gets or sets the owner of the enrollment account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.accountOwner")] + public string AccountOwner {get; set; } + + /// + /// Gets or sets the status of the enrollment account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.status")] + public string Status {get; set; } + + /// + /// Gets or sets the start date of the enrollment account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.startDate")] + public System.DateTime? StartDate {get; set; } + + /// + /// Gets or sets the end date of the enrollment account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.endDate")] + public System.DateTime? EndDate {get; set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccountContext.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccountContext.cs new file mode 100644 index 000000000000..5dea5c6bd125 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccountContext.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The enrollment account context + /// + public partial class EnrollmentAccountContext + { + /// + /// Initializes a new instance of the EnrollmentAccountContext class. + /// + public EnrollmentAccountContext() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EnrollmentAccountContext class. + /// + + /// The cost center associated with the enrollment account. + /// + + /// The start date of the enrollment account. + /// + + /// The end date of the enrollment account. + /// + + /// The ID of the enrollment account. + /// + public EnrollmentAccountContext(string costCenter = default(string), System.DateTime? startDate = default(System.DateTime?), System.DateTime? endDate = default(System.DateTime?), string enrollmentAccountName = default(string)) + + { + this.CostCenter = costCenter; + this.StartDate = startDate; + this.EndDate = endDate; + this.EnrollmentAccountName = enrollmentAccountName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the cost center associated with the enrollment account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "costCenter")] + public string CostCenter {get; set; } + + /// + /// Gets or sets the start date of the enrollment account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "startDate")] + public System.DateTime? StartDate {get; set; } + + /// + /// Gets or sets the end date of the enrollment account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "endDate")] + public System.DateTime? EndDate {get; set; } + + /// + /// Gets or sets the ID of the enrollment account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "enrollmentAccountName")] + public string EnrollmentAccountName {get; set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccountProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccountProperties.cs new file mode 100644 index 000000000000..a10a83c5327e --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccountProperties.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The properties of an enrollment account. + /// + public partial class EnrollmentAccountProperties + { + /// + /// Initializes a new instance of the EnrollmentAccountProperties class. + /// + public EnrollmentAccountProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EnrollmentAccountProperties class. + /// + + /// The name of the enrollment account. + /// + + /// The cost center associated with the enrollment account. + /// + + /// The owner of the enrollment account. + /// + + /// The status of the enrollment account. + /// + + /// The start date of the enrollment account. + /// + + /// The end date of the enrollment account. + /// + + /// Associated department. By default this is not populated, unless it's + /// specified in $expand. + /// + public EnrollmentAccountProperties(string accountName = default(string), string costCenter = default(string), string accountOwner = default(string), string status = default(string), System.DateTime? startDate = default(System.DateTime?), System.DateTime? endDate = default(System.DateTime?), Department department = default(Department)) + + { + this.AccountName = accountName; + this.CostCenter = costCenter; + this.AccountOwner = accountOwner; + this.Status = status; + this.StartDate = startDate; + this.EndDate = endDate; + this.Department = department; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the name of the enrollment account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "accountName")] + public string AccountName {get; set; } + + /// + /// Gets or sets the cost center associated with the enrollment account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "costCenter")] + public string CostCenter {get; set; } + + /// + /// Gets or sets the owner of the enrollment account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "accountOwner")] + public string AccountOwner {get; set; } + + /// + /// Gets or sets the status of the enrollment account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; set; } + + /// + /// Gets or sets the start date of the enrollment account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "startDate")] + public System.DateTime? StartDate {get; set; } + + /// + /// Gets or sets the end date of the enrollment account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "endDate")] + public System.DateTime? EndDate {get; set; } + + /// + /// Gets or sets associated department. By default this is not populated, + /// unless it's specified in $expand. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "department")] + public Department Department {get; set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccountSummary.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccountSummary.cs new file mode 100644 index 000000000000..499a57819d12 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccountSummary.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// An enrollment account resource. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class EnrollmentAccountSummary : Resource + { + /// + /// Initializes a new instance of the EnrollmentAccountSummary class. + /// + public EnrollmentAccountSummary() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EnrollmentAccountSummary class. + /// + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// + + /// The account owner's principal name. + /// + public EnrollmentAccountSummary(string id = default(string), string name = default(string), string type = default(string), string principalName = default(string)) + + : base(id, name, type) + { + this.PrincipalName = principalName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the account owner's principal name. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.principalName")] + public string PrincipalName {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccountSummaryProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccountSummaryProperties.cs new file mode 100644 index 000000000000..d56ee50f83d3 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentAccountSummaryProperties.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The properties of the enrollment account. + /// + public partial class EnrollmentAccountSummaryProperties + { + /// + /// Initializes a new instance of the EnrollmentAccountSummaryProperties class. + /// + public EnrollmentAccountSummaryProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EnrollmentAccountSummaryProperties class. + /// + + /// The account owner's principal name. + /// + public EnrollmentAccountSummaryProperties(string principalName = default(string)) + + { + this.PrincipalName = principalName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the account owner's principal name. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "principalName")] + public string PrincipalName {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentPolicies.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentPolicies.cs new file mode 100644 index 000000000000..b409296fba41 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/EnrollmentPolicies.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The policies for Enterprise Agreement enrollments. + /// + public partial class EnrollmentPolicies + { + /// + /// Initializes a new instance of the EnrollmentPolicies class. + /// + public EnrollmentPolicies() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EnrollmentPolicies class. + /// + + /// The policy that controls whether Account Owners can view charges. + /// + + /// The policy that controls whether Department Administrators can view + /// charges. + /// + + /// The policy that controls whether Azure marketplace purchases are allowed in + /// the enrollment. + /// + + /// The policy that controls whether Azure reservation purchases are allowed in + /// the enrollment. + /// + public EnrollmentPolicies(bool? accountOwnerViewCharges = default(bool?), bool? departmentAdminViewCharges = default(bool?), bool? marketplacesEnabled = default(bool?), bool? reservedInstancesEnabled = default(bool?)) + + { + this.AccountOwnerViewCharges = accountOwnerViewCharges; + this.DepartmentAdminViewCharges = departmentAdminViewCharges; + this.MarketplacesEnabled = marketplacesEnabled; + this.ReservedInstancesEnabled = reservedInstancesEnabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the policy that controls whether Account Owners can view charges. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "accountOwnerViewCharges")] + public bool? AccountOwnerViewCharges {get; private set; } + + /// + /// Gets the policy that controls whether Department Administrators can view + /// charges. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "departmentAdminViewCharges")] + public bool? DepartmentAdminViewCharges {get; private set; } + + /// + /// Gets the policy that controls whether Azure marketplace purchases are + /// allowed in the enrollment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "marketplacesEnabled")] + public bool? MarketplacesEnabled {get; private set; } + + /// + /// Gets the policy that controls whether Azure reservation purchases are + /// allowed in the enrollment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "reservedInstancesEnabled")] + public bool? ReservedInstancesEnabled {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ErrorDetails.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ErrorDetails.cs new file mode 100644 index 000000000000..12b69cd1b94b --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ErrorDetails.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The details of the error. + /// + public partial class ErrorDetails + { + /// + /// Initializes a new instance of the ErrorDetails class. + /// + public ErrorDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorDetails class. + /// + + /// Error code. + /// + + /// Error message indicating why the operation failed. + /// + + /// The target of the particular error. + /// + public ErrorDetails(string code = default(string), string message = default(string), string target = default(string)) + + { + this.Code = code; + this.Message = message; + this.Target = target; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets error code. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "code")] + public string Code {get; private set; } + + /// + /// Gets error message indicating why the operation failed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "message")] + public string Message {get; private set; } + + /// + /// Gets the target of the particular error. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "target")] + public string Target {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ErrorResponse.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ErrorResponse.cs new file mode 100644 index 000000000000..4f3c56b5d4cd --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ErrorResponse.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// Error response indicates that the service is not able to process the + /// incoming request. The reason is provided in the error message. + /// + public partial class ErrorResponse + { + /// + /// Initializes a new instance of the ErrorResponse class. + /// + public ErrorResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorResponse class. + /// + + /// The details of the error. + /// + public ErrorResponse(ErrorDetails error = default(ErrorDetails)) + + { + this.Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the details of the error. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "error")] + public ErrorDetails Error {get; set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ErrorResponseException.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ErrorResponseException.cs new file mode 100644 index 000000000000..4a32f819da4b --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ErrorResponseException.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Exception thrown for an invalid response with ErrorResponse information. + /// + public partial class ErrorResponseException : Microsoft.Rest.RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public Microsoft.Rest.HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public Microsoft.Rest.HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public ErrorResponse Body { get; set; } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + public ErrorResponseException() + { + } + + /// + /// Initializes a new instance of the ErrorResponse class. + /// + /// The exception message. + public ErrorResponseException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the ErrorResponse class. + /// + /// The exception message. + /// Inner exception. + public ErrorResponseException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Instruction.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Instruction.cs new file mode 100644 index 000000000000..2e05f80532d7 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Instruction.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// An instruction. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class Instruction : Resource + { + /// + /// Initializes a new instance of the Instruction class. + /// + public Instruction() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Instruction class. + /// + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// + + /// The amount budgeted for this billing instruction. + /// + + /// The date this billing instruction goes into effect. + /// + + /// The date this billing instruction is no longer in effect. + /// + + /// The date this billing instruction was created. + /// + public Instruction(string id = default(string), string name = default(string), string type = default(string), double? amount = default(double?), System.DateTime? startDate = default(System.DateTime?), System.DateTime? endDate = default(System.DateTime?), System.DateTime? creationDate = default(System.DateTime?)) + + : base(id, name, type) + { + this.Amount = amount; + this.StartDate = startDate; + this.EndDate = endDate; + this.CreationDate = creationDate; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the amount budgeted for this billing instruction. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.amount")] + public double? Amount {get; set; } + + /// + /// Gets or sets the date this billing instruction goes into effect. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.startDate")] + public System.DateTime? StartDate {get; set; } + + /// + /// Gets or sets the date this billing instruction is no longer in effect. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.endDate")] + public System.DateTime? EndDate {get; set; } + + /// + /// Gets or sets the date this billing instruction was created. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.creationDate")] + public System.DateTime? CreationDate {get; set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/InstructionProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/InstructionProperties.cs new file mode 100644 index 000000000000..cfc4dcf66408 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/InstructionProperties.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// A billing instruction used during invoice generation. + /// + public partial class InstructionProperties + { + /// + /// Initializes a new instance of the InstructionProperties class. + /// + public InstructionProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InstructionProperties class. + /// + + /// The amount budgeted for this billing instruction. + /// + + /// The date this billing instruction goes into effect. + /// + + /// The date this billing instruction is no longer in effect. + /// + + /// The date this billing instruction was created. + /// + public InstructionProperties(double amount, System.DateTime startDate, System.DateTime endDate, System.DateTime? creationDate = default(System.DateTime?)) + + { + this.Amount = amount; + this.StartDate = startDate; + this.EndDate = endDate; + this.CreationDate = creationDate; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the amount budgeted for this billing instruction. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "amount")] + public double Amount {get; set; } + + /// + /// Gets or sets the date this billing instruction goes into effect. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "startDate")] + public System.DateTime StartDate {get; set; } + + /// + /// Gets or sets the date this billing instruction is no longer in effect. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "endDate")] + public System.DateTime EndDate {get; set; } + + /// + /// Gets or sets the date this billing instruction was created. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "creationDate")] + public System.DateTime? CreationDate {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + //Nothing to validate + } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Invoice.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Invoice.cs new file mode 100644 index 000000000000..a940eef5a0f7 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Invoice.cs @@ -0,0 +1,285 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// An invoice. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class Invoice : Resource + { + /// + /// Initializes a new instance of the Invoice class. + /// + public Invoice() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Invoice class. + /// + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// + + /// The amount due as of now. + /// + + /// Invoice type. + /// Possible values include: 'AzureService', 'AzureMarketplace', 'AzureSupport' + + /// The due date for the invoice. + /// + + /// The date when the invoice was generated. + /// + + /// The current status of the invoice. + /// Possible values include: 'Due', 'OverDue', 'Paid' + + /// The amount of Azure prepayment applied to the charges. This field is + /// applicable to billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + + /// The total charges for the invoice billing period. + /// + + /// The total refund for returns and cancellations during the invoice billing + /// period. This field is applicable to billing accounts with agreement type + /// Microsoft Customer Agreement. + /// + + /// The amount of free Azure credits applied to the charges. This field is + /// applicable to billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + + /// The pre-tax amount due. This field is applicable to billing accounts with + /// agreement type Microsoft Customer Agreement. + /// + + /// The amount of tax charged for the billing period. This field is applicable + /// to billing accounts with agreement type Microsoft Customer Agreement. + /// + + /// The amount due when the invoice was generated. This field is applicable to + /// billing accounts with agreement type Microsoft Customer Agreement. + /// + + /// The start date of the billing period for which the invoice is generated. + /// + + /// The end date of the billing period for which the invoice is generated. + /// + + /// Specifies if the invoice is generated as part of monthly invoicing cycle or + /// not. This field is applicable to billing accounts with agreement type + /// Microsoft Customer Agreement. + /// + + /// The ID of the billing profile for which the invoice is generated. + /// + + /// The name of the billing profile for which the invoice is generated. + /// + + /// An optional purchase order number for the invoice. + /// + + /// List of documents available to download such as invoice and tax receipt. + /// + + /// List of payments. + /// + + /// The ID of the subscription for which the invoice is generated. + /// + public Invoice(string id = default(string), string name = default(string), string type = default(string), Amount amountDue = default(Amount), string invoiceType = default(string), System.DateTime? dueDate = default(System.DateTime?), System.DateTime? invoiceDate = default(System.DateTime?), string status = default(string), Amount azurePrepaymentApplied = default(Amount), Amount billedAmount = default(Amount), Amount creditAmount = default(Amount), Amount freeAzureCreditApplied = default(Amount), Amount subTotal = default(Amount), Amount taxAmount = default(Amount), Amount totalAmount = default(Amount), System.DateTime? invoicePeriodStartDate = default(System.DateTime?), System.DateTime? invoicePeriodEndDate = default(System.DateTime?), bool? isMonthlyInvoice = default(bool?), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string purchaseOrderNumber = default(string), System.Collections.Generic.IList documents = default(System.Collections.Generic.IList), System.Collections.Generic.IList payments = default(System.Collections.Generic.IList), string subscriptionId = default(string)) + + : base(id, name, type) + { + this.AmountDue = amountDue; + this.InvoiceType = invoiceType; + this.DueDate = dueDate; + this.InvoiceDate = invoiceDate; + this.Status = status; + this.AzurePrepaymentApplied = azurePrepaymentApplied; + this.BilledAmount = billedAmount; + this.CreditAmount = creditAmount; + this.FreeAzureCreditApplied = freeAzureCreditApplied; + this.SubTotal = subTotal; + this.TaxAmount = taxAmount; + this.TotalAmount = totalAmount; + this.InvoicePeriodStartDate = invoicePeriodStartDate; + this.InvoicePeriodEndDate = invoicePeriodEndDate; + this.IsMonthlyInvoice = isMonthlyInvoice; + this.BillingProfileId = billingProfileId; + this.BillingProfileDisplayName = billingProfileDisplayName; + this.PurchaseOrderNumber = purchaseOrderNumber; + this.Documents = documents; + this.Payments = payments; + this.SubscriptionId = subscriptionId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the amount due as of now. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.amountDue")] + public Amount AmountDue {get; private set; } + + /// + /// Gets invoice type. Possible values include: 'AzureService', 'AzureMarketplace', 'AzureSupport' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.invoiceType")] + public string InvoiceType {get; private set; } + + /// + /// Gets the due date for the invoice. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.dueDate")] + public System.DateTime? DueDate {get; private set; } + + /// + /// Gets the date when the invoice was generated. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.invoiceDate")] + public System.DateTime? InvoiceDate {get; private set; } + + /// + /// Gets the current status of the invoice. Possible values include: 'Due', 'OverDue', 'Paid' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.status")] + public string Status {get; private set; } + + /// + /// Gets the amount of Azure prepayment applied to the charges. This field is + /// applicable to billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.azurePrepaymentApplied")] + public Amount AzurePrepaymentApplied {get; private set; } + + /// + /// Gets the total charges for the invoice billing period. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billedAmount")] + public Amount BilledAmount {get; private set; } + + /// + /// Gets the total refund for returns and cancellations during the invoice + /// billing period. This field is applicable to billing accounts with agreement + /// type Microsoft Customer Agreement. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.creditAmount")] + public Amount CreditAmount {get; private set; } + + /// + /// Gets the amount of free Azure credits applied to the charges. This field is + /// applicable to billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.freeAzureCreditApplied")] + public Amount FreeAzureCreditApplied {get; private set; } + + /// + /// Gets the pre-tax amount due. This field is applicable to billing accounts + /// with agreement type Microsoft Customer Agreement. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.subTotal")] + public Amount SubTotal {get; private set; } + + /// + /// Gets the amount of tax charged for the billing period. This field is + /// applicable to billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.taxAmount")] + public Amount TaxAmount {get; private set; } + + /// + /// Gets the amount due when the invoice was generated. This field is + /// applicable to billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.totalAmount")] + public Amount TotalAmount {get; private set; } + + /// + /// Gets the start date of the billing period for which the invoice is + /// generated. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.invoicePeriodStartDate")] + public System.DateTime? InvoicePeriodStartDate {get; private set; } + + /// + /// Gets the end date of the billing period for which the invoice is generated. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.invoicePeriodEndDate")] + public System.DateTime? InvoicePeriodEndDate {get; private set; } + + /// + /// Gets specifies if the invoice is generated as part of monthly invoicing + /// cycle or not. This field is applicable to billing accounts with agreement + /// type Microsoft Customer Agreement. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.isMonthlyInvoice")] + public bool? IsMonthlyInvoice {get; private set; } + + /// + /// Gets the ID of the billing profile for which the invoice is generated. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingProfileId")] + public string BillingProfileId {get; private set; } + + /// + /// Gets the name of the billing profile for which the invoice is generated. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingProfileDisplayName")] + public string BillingProfileDisplayName {get; private set; } + + /// + /// Gets an optional purchase order number for the invoice. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.purchaseOrderNumber")] + public string PurchaseOrderNumber {get; private set; } + + /// + /// Gets list of documents available to download such as invoice and tax + /// receipt. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.documents")] + public System.Collections.Generic.IList Documents {get; private set; } + + /// + /// Gets list of payments. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.payments")] + public System.Collections.Generic.IList Payments {get; private set; } + + /// + /// Gets the ID of the subscription for which the invoice is generated. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.subscriptionId")] + public string SubscriptionId {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceProperties.cs new file mode 100644 index 000000000000..ea0f453cfb43 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceProperties.cs @@ -0,0 +1,274 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The properties of the invoice. + /// + public partial class InvoiceProperties + { + /// + /// Initializes a new instance of the InvoiceProperties class. + /// + public InvoiceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InvoiceProperties class. + /// + + /// The due date for the invoice. + /// + + /// The date when the invoice was generated. + /// + + /// The current status of the invoice. + /// Possible values include: 'Due', 'OverDue', 'Paid' + + /// The amount due as of now. + /// + + /// The amount of Azure prepayment applied to the charges. This field is + /// applicable to billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + + /// The total charges for the invoice billing period. + /// + + /// The total refund for returns and cancellations during the invoice billing + /// period. This field is applicable to billing accounts with agreement type + /// Microsoft Customer Agreement. + /// + + /// The amount of free Azure credits applied to the charges. This field is + /// applicable to billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + + /// The pre-tax amount due. This field is applicable to billing accounts with + /// agreement type Microsoft Customer Agreement. + /// + + /// The amount of tax charged for the billing period. This field is applicable + /// to billing accounts with agreement type Microsoft Customer Agreement. + /// + + /// The amount due when the invoice was generated. This field is applicable to + /// billing accounts with agreement type Microsoft Customer Agreement. + /// + + /// The start date of the billing period for which the invoice is generated. + /// + + /// The end date of the billing period for which the invoice is generated. + /// + + /// Invoice type. + /// Possible values include: 'AzureService', 'AzureMarketplace', 'AzureSupport' + + /// Specifies if the invoice is generated as part of monthly invoicing cycle or + /// not. This field is applicable to billing accounts with agreement type + /// Microsoft Customer Agreement. + /// + + /// The ID of the billing profile for which the invoice is generated. + /// + + /// The name of the billing profile for which the invoice is generated. + /// + + /// An optional purchase order number for the invoice. + /// + + /// List of documents available to download such as invoice and tax receipt. + /// + + /// List of payments. + /// + + /// The ID of the subscription for which the invoice is generated. + /// + public InvoiceProperties(System.DateTime? dueDate = default(System.DateTime?), System.DateTime? invoiceDate = default(System.DateTime?), string status = default(string), Amount amountDue = default(Amount), Amount azurePrepaymentApplied = default(Amount), Amount billedAmount = default(Amount), Amount creditAmount = default(Amount), Amount freeAzureCreditApplied = default(Amount), Amount subTotal = default(Amount), Amount taxAmount = default(Amount), Amount totalAmount = default(Amount), System.DateTime? invoicePeriodStartDate = default(System.DateTime?), System.DateTime? invoicePeriodEndDate = default(System.DateTime?), string invoiceType = default(string), bool? isMonthlyInvoice = default(bool?), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string purchaseOrderNumber = default(string), System.Collections.Generic.IList documents = default(System.Collections.Generic.IList), System.Collections.Generic.IList payments = default(System.Collections.Generic.IList), string subscriptionId = default(string)) + + { + this.DueDate = dueDate; + this.InvoiceDate = invoiceDate; + this.Status = status; + this.AmountDue = amountDue; + this.AzurePrepaymentApplied = azurePrepaymentApplied; + this.BilledAmount = billedAmount; + this.CreditAmount = creditAmount; + this.FreeAzureCreditApplied = freeAzureCreditApplied; + this.SubTotal = subTotal; + this.TaxAmount = taxAmount; + this.TotalAmount = totalAmount; + this.InvoicePeriodStartDate = invoicePeriodStartDate; + this.InvoicePeriodEndDate = invoicePeriodEndDate; + this.InvoiceType = invoiceType; + this.IsMonthlyInvoice = isMonthlyInvoice; + this.BillingProfileId = billingProfileId; + this.BillingProfileDisplayName = billingProfileDisplayName; + this.PurchaseOrderNumber = purchaseOrderNumber; + this.Documents = documents; + this.Payments = payments; + this.SubscriptionId = subscriptionId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the due date for the invoice. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "dueDate")] + public System.DateTime? DueDate {get; private set; } + + /// + /// Gets the date when the invoice was generated. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "invoiceDate")] + public System.DateTime? InvoiceDate {get; private set; } + + /// + /// Gets the current status of the invoice. Possible values include: 'Due', 'OverDue', 'Paid' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; private set; } + + /// + /// Gets the amount due as of now. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "amountDue")] + public Amount AmountDue {get; private set; } + + /// + /// Gets the amount of Azure prepayment applied to the charges. This field is + /// applicable to billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "azurePrepaymentApplied")] + public Amount AzurePrepaymentApplied {get; private set; } + + /// + /// Gets the total charges for the invoice billing period. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billedAmount")] + public Amount BilledAmount {get; private set; } + + /// + /// Gets the total refund for returns and cancellations during the invoice + /// billing period. This field is applicable to billing accounts with agreement + /// type Microsoft Customer Agreement. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "creditAmount")] + public Amount CreditAmount {get; private set; } + + /// + /// Gets the amount of free Azure credits applied to the charges. This field is + /// applicable to billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "freeAzureCreditApplied")] + public Amount FreeAzureCreditApplied {get; private set; } + + /// + /// Gets the pre-tax amount due. This field is applicable to billing accounts + /// with agreement type Microsoft Customer Agreement. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "subTotal")] + public Amount SubTotal {get; private set; } + + /// + /// Gets the amount of tax charged for the billing period. This field is + /// applicable to billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "taxAmount")] + public Amount TaxAmount {get; private set; } + + /// + /// Gets the amount due when the invoice was generated. This field is + /// applicable to billing accounts with agreement type Microsoft Customer + /// Agreement. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "totalAmount")] + public Amount TotalAmount {get; private set; } + + /// + /// Gets the start date of the billing period for which the invoice is + /// generated. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "invoicePeriodStartDate")] + public System.DateTime? InvoicePeriodStartDate {get; private set; } + + /// + /// Gets the end date of the billing period for which the invoice is generated. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "invoicePeriodEndDate")] + public System.DateTime? InvoicePeriodEndDate {get; private set; } + + /// + /// Gets invoice type. Possible values include: 'AzureService', 'AzureMarketplace', 'AzureSupport' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "invoiceType")] + public string InvoiceType {get; private set; } + + /// + /// Gets specifies if the invoice is generated as part of monthly invoicing + /// cycle or not. This field is applicable to billing accounts with agreement + /// type Microsoft Customer Agreement. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "isMonthlyInvoice")] + public bool? IsMonthlyInvoice {get; private set; } + + /// + /// Gets the ID of the billing profile for which the invoice is generated. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileId")] + public string BillingProfileId {get; private set; } + + /// + /// Gets the name of the billing profile for which the invoice is generated. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileDisplayName")] + public string BillingProfileDisplayName {get; private set; } + + /// + /// Gets an optional purchase order number for the invoice. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "purchaseOrderNumber")] + public string PurchaseOrderNumber {get; private set; } + + /// + /// Gets list of documents available to download such as invoice and tax + /// receipt. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "documents")] + public System.Collections.Generic.IList Documents {get; private set; } + + /// + /// Gets list of payments. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "payments")] + public System.Collections.Generic.IList Payments {get; private set; } + + /// + /// Gets the ID of the subscription for which the invoice is generated. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "subscriptionId")] + public string SubscriptionId {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSection.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSection.cs new file mode 100644 index 000000000000..76531f1fd1ba --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSection.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// An invoice section. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class InvoiceSection : Resource + { + /// + /// Initializes a new instance of the InvoiceSection class. + /// + public InvoiceSection() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InvoiceSection class. + /// + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// + + /// The name of the invoice section. + /// + + /// Dictionary of metadata associated with the invoice section. + /// + + /// The system generated unique identifier for an invoice section. + /// + public InvoiceSection(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), System.Collections.Generic.IDictionary labels = default(System.Collections.Generic.IDictionary), string systemId = default(string)) + + : base(id, name, type) + { + this.DisplayName = displayName; + this.Labels = labels; + this.SystemId = systemId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the name of the invoice section. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName {get; set; } + + /// + /// Gets or sets dictionary of metadata associated with the invoice section. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.labels")] + public System.Collections.Generic.IDictionary Labels {get; set; } + + /// + /// Gets the system generated unique identifier for an invoice section. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.systemId")] + public string SystemId {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionCreationRequest.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionCreationRequest.cs new file mode 100644 index 000000000000..9ac947af68dc --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionCreationRequest.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The properties of the invoice section. + /// + public partial class InvoiceSectionCreationRequest + { + /// + /// Initializes a new instance of the InvoiceSectionCreationRequest class. + /// + public InvoiceSectionCreationRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InvoiceSectionCreationRequest class. + /// + + /// The name of the invoice section. + /// + public InvoiceSectionCreationRequest(string displayName = default(string)) + + { + this.DisplayName = displayName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the name of the invoice section. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "displayName")] + public string DisplayName {get; set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionProperties.cs new file mode 100644 index 000000000000..f18f9af0a9cc --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionProperties.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The properties of an invoice section. + /// + public partial class InvoiceSectionProperties + { + /// + /// Initializes a new instance of the InvoiceSectionProperties class. + /// + public InvoiceSectionProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InvoiceSectionProperties class. + /// + + /// The name of the invoice section. + /// + + /// Dictionary of metadata associated with the invoice section. + /// + + /// The system generated unique identifier for an invoice section. + /// + public InvoiceSectionProperties(string displayName = default(string), System.Collections.Generic.IDictionary labels = default(System.Collections.Generic.IDictionary), string systemId = default(string)) + + { + this.DisplayName = displayName; + this.Labels = labels; + this.SystemId = systemId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the name of the invoice section. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "displayName")] + public string DisplayName {get; set; } + + /// + /// Gets or sets dictionary of metadata associated with the invoice section. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "labels")] + public System.Collections.Generic.IDictionary Labels {get; set; } + + /// + /// Gets the system generated unique identifier for an invoice section. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "systemId")] + public string SystemId {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionWithCreateSubPermission.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionWithCreateSubPermission.cs new file mode 100644 index 000000000000..31c2d4359911 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionWithCreateSubPermission.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.Models +{ + using System.Linq; + + /// + /// Invoice section properties with create subscription permission. + /// + public partial class InvoiceSectionWithCreateSubPermission + { + /// + /// Initializes a new instance of the InvoiceSectionWithCreateSubPermission class. + /// + public InvoiceSectionWithCreateSubPermission() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InvoiceSectionWithCreateSubPermission class. + /// + + /// The ID of the invoice section. + /// + + /// The name of the invoice section. + /// + + /// The system generated unique identifier for an invoice section. + /// + + /// The ID of the billing profile for the invoice section. + /// + + /// The name of the billing profile for the invoice section. + /// + + /// The status of the billing profile. + /// Possible values include: 'Active', 'Disabled', 'Warned' + + /// Reason for the specified billing profile status. + /// Possible values include: 'PastDue', 'SpendingLimitReached', + /// 'SpendingLimitExpired' + + /// The billing profile spending limit. + /// Possible values include: 'Off', 'On' + + /// The system generated unique identifier for a billing profile. + /// + + /// Enabled azure plans for the associated billing profile. + /// + public InvoiceSectionWithCreateSubPermission(string invoiceSectionId = default(string), string invoiceSectionDisplayName = default(string), string invoiceSectionSystemId = default(string), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string billingProfileStatus = default(string), string billingProfileStatusReasonCode = default(string), string billingProfileSpendingLimit = default(string), string billingProfileSystemId = default(string), System.Collections.Generic.IList enabledAzurePlans = default(System.Collections.Generic.IList)) + + { + this.InvoiceSectionId = invoiceSectionId; + this.InvoiceSectionDisplayName = invoiceSectionDisplayName; + this.InvoiceSectionSystemId = invoiceSectionSystemId; + this.BillingProfileId = billingProfileId; + this.BillingProfileDisplayName = billingProfileDisplayName; + this.BillingProfileStatus = billingProfileStatus; + this.BillingProfileStatusReasonCode = billingProfileStatusReasonCode; + this.BillingProfileSpendingLimit = billingProfileSpendingLimit; + this.BillingProfileSystemId = billingProfileSystemId; + this.EnabledAzurePlans = enabledAzurePlans; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the ID of the invoice section. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "invoiceSectionId")] + public string InvoiceSectionId {get; private set; } + + /// + /// Gets the name of the invoice section. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "invoiceSectionDisplayName")] + public string InvoiceSectionDisplayName {get; private set; } + + /// + /// Gets the system generated unique identifier for an invoice section. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "invoiceSectionSystemId")] + public string InvoiceSectionSystemId {get; private set; } + + /// + /// Gets the ID of the billing profile for the invoice section. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileId")] + public string BillingProfileId {get; private set; } + + /// + /// Gets the name of the billing profile for the invoice section. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileDisplayName")] + public string BillingProfileDisplayName {get; private set; } + + /// + /// Gets the status of the billing profile. Possible values include: 'Active', 'Disabled', 'Warned' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileStatus")] + public string BillingProfileStatus {get; private set; } + + /// + /// Gets reason for the specified billing profile status. Possible values include: 'PastDue', 'SpendingLimitReached', 'SpendingLimitExpired' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileStatusReasonCode")] + public string BillingProfileStatusReasonCode {get; private set; } + + /// + /// Gets the billing profile spending limit. Possible values include: 'Off', 'On' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileSpendingLimit")] + public string BillingProfileSpendingLimit {get; private set; } + + /// + /// Gets the system generated unique identifier for a billing profile. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileSystemId")] + public string BillingProfileSystemId {get; private set; } + + /// + /// Gets or sets enabled azure plans for the associated billing profile. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "enabledAzurePlans")] + public System.Collections.Generic.IList EnabledAzurePlans {get; set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionsCreateOrUpdateHeaders.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionsCreateOrUpdateHeaders.cs new file mode 100644 index 000000000000..a089b3c1970f --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionsCreateOrUpdateHeaders.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + public partial class InvoiceSectionsCreateOrUpdateHeaders + { + /// + /// Initializes a new instance of the InvoiceSectionsCreateOrUpdateHeaders class. + /// + public InvoiceSectionsCreateOrUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InvoiceSectionsCreateOrUpdateHeaders class. + /// + + /// + /// + + /// + /// + public InvoiceSectionsCreateOrUpdateHeaders(string location = default(string), int? retryAfter = default(int?)) + + { + this.Location = location; + this.RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Location")] + public string Location {get; set; } + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter {get; set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionsOnExpand.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionsOnExpand.cs new file mode 100644 index 000000000000..3a131485fed6 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceSectionsOnExpand.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The invoice sections associated to the billing profile. By default this is + /// not populated, unless it's specified in $expand. + /// + public partial class InvoiceSectionsOnExpand + { + /// + /// Initializes a new instance of the InvoiceSectionsOnExpand class. + /// + public InvoiceSectionsOnExpand() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InvoiceSectionsOnExpand class. + /// + + /// Indicates whether there are more invoice sections than the ones listed in + /// this collection. The collection lists a maximum of 50 invoice sections. To + /// get all invoice sections, use the list invoice sections API. + /// + + /// The invoice sections associated to the billing profile. + /// + public InvoiceSectionsOnExpand(bool? hasMoreResults = default(bool?), System.Collections.Generic.IList value = default(System.Collections.Generic.IList)) + + { + this.HasMoreResults = hasMoreResults; + this.Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets indicates whether there are more invoice sections than the ones listed + /// in this collection. The collection lists a maximum of 50 invoice sections. + /// To get all invoice sections, use the list invoice sections API. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "hasMoreResults")] + public bool? HasMoreResults {get; private set; } + + /// + /// Gets or sets the invoice sections associated to the billing profile. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "value")] + public System.Collections.Generic.IList Value {get; set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceStatus.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceStatus.cs new file mode 100644 index 000000000000..3efbe16fd464 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceStatus.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for InvoiceStatus. + /// + + + public static class InvoiceStatus + { + public const string Due = "Due"; + public const string OverDue = "OverDue"; + public const string Paid = "Paid"; + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceType.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceType.cs new file mode 100644 index 000000000000..dee5f86d8247 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoiceType.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for InvoiceType. + /// + + + public static class InvoiceType + { + public const string AzureService = "AzureService"; + public const string AzureMarketplace = "AzureMarketplace"; + public const string AzureSupport = "AzureSupport"; + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/InvoicesDownloadBillingSubscriptionInvoiceHeaders.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoicesDownloadBillingSubscriptionInvoiceHeaders.cs new file mode 100644 index 000000000000..6501666d992e --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoicesDownloadBillingSubscriptionInvoiceHeaders.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + public partial class InvoicesDownloadBillingSubscriptionInvoiceHeaders + { + /// + /// Initializes a new instance of the InvoicesDownloadBillingSubscriptionInvoiceHeaders class. + /// + public InvoicesDownloadBillingSubscriptionInvoiceHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InvoicesDownloadBillingSubscriptionInvoiceHeaders class. + /// + + /// + /// + + /// + /// + public InvoicesDownloadBillingSubscriptionInvoiceHeaders(string location = default(string), string retryAfter = default(string)) + + { + this.Location = location; + this.RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Location")] + public string Location {get; set; } + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Retry-After")] + public string RetryAfter {get; set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/InvoicesDownloadInvoiceHeaders.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoicesDownloadInvoiceHeaders.cs new file mode 100644 index 000000000000..f58103febbdc --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/InvoicesDownloadInvoiceHeaders.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + public partial class InvoicesDownloadInvoiceHeaders + { + /// + /// Initializes a new instance of the InvoicesDownloadInvoiceHeaders class. + /// + public InvoicesDownloadInvoiceHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InvoicesDownloadInvoiceHeaders class. + /// + + /// + /// + + /// + /// + public InvoicesDownloadInvoiceHeaders(string location = default(string), string retryAfter = default(string)) + + { + this.Location = location; + this.RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Location")] + public string Location {get; set; } + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Retry-After")] + public string RetryAfter {get; set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/MarketplacePurchasesPolicy.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/MarketplacePurchasesPolicy.cs new file mode 100644 index 000000000000..06e7c6ee2fb4 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/MarketplacePurchasesPolicy.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for MarketplacePurchasesPolicy. + /// + + + public static class MarketplacePurchasesPolicy + { + public const string AllAllowed = "AllAllowed"; + public const string OnlyFreeAllowed = "OnlyFreeAllowed"; + public const string NotAllowed = "NotAllowed"; + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Operation.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Operation.cs new file mode 100644 index 000000000000..cd988e4f3795 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Operation.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// A Billing REST API operation. + /// + public partial class Operation + { + /// + /// Initializes a new instance of the Operation class. + /// + public Operation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Operation class. + /// + + /// Operation name: {provider}/{resource}/{operation}. + /// + + /// The object that represents the operation. + /// + public Operation(string name = default(string), OperationDisplay display = default(OperationDisplay)) + + { + this.Name = name; + this.Display = display; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets operation name: {provider}/{resource}/{operation}. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; private set; } + + /// + /// Gets or sets the object that represents the operation. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "display")] + public OperationDisplay Display {get; set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/OperationDisplay.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/OperationDisplay.cs new file mode 100644 index 000000000000..7204159b9bea --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/OperationDisplay.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The object that represents the operation. + /// + public partial class OperationDisplay + { + /// + /// Initializes a new instance of the OperationDisplay class. + /// + public OperationDisplay() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationDisplay class. + /// + + /// Service provider: Microsoft.Billing. + /// + + /// Resource on which the operation is performed such as invoice and billing + /// subscription. + /// + + /// Operation type such as read, write and delete. + /// + public OperationDisplay(string provider = default(string), string resource = default(string), string operation = default(string)) + + { + this.Provider = provider; + this.Resource = resource; + this.Operation = operation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets service provider: Microsoft.Billing. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provider")] + public string Provider {get; private set; } + + /// + /// Gets resource on which the operation is performed such as invoice and + /// billing subscription. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "resource")] + public string Resource {get; private set; } + + /// + /// Gets operation type such as read, write and delete. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "operation")] + public string Operation {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Page.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Page.cs new file mode 100644 index 000000000000..cdc0396c9f91 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Page.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines a page in Azure responses. + /// + /// Type of the page content items + [Newtonsoft.Json.JsonObject] + public class Page : Microsoft.Rest.Azure.IPage + { + /// + /// Gets the link to the next page. + /// + [Newtonsoft.Json.JsonProperty("nextLink")] + public System.String NextPageLink { get; private set; } + + [Newtonsoft.Json.JsonProperty("value")] + private System.Collections.Generic.IList Items{ get; set; } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + public System.Collections.Generic.IEnumerator GetEnumerator() + { + return (Items == null) ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); + } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Participants.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Participants.cs new file mode 100644 index 000000000000..50c15960631e --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Participants.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The details about a participant. + /// + public partial class Participants + { + /// + /// Initializes a new instance of the Participants class. + /// + public Participants() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Participants class. + /// + + /// The acceptance status of the participant. + /// + + /// The date when the status got changed. + /// + + /// The email address of the participant. + /// + public Participants(string status = default(string), System.DateTime? statusDate = default(System.DateTime?), string email = default(string)) + + { + this.Status = status; + this.StatusDate = statusDate; + this.Email = email; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the acceptance status of the participant. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; private set; } + + /// + /// Gets the date when the status got changed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "statusDate")] + public System.DateTime? StatusDate {get; private set; } + + /// + /// Gets the email address of the participant. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "email")] + public string Email {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/PaymentMethodFamily.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/PaymentMethodFamily.cs new file mode 100644 index 000000000000..606ffb9ad45c --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/PaymentMethodFamily.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for PaymentMethodFamily. + /// + + + public static class PaymentMethodFamily + { + public const string Credits = "Credits"; + public const string CheckWire = "CheckWire"; + public const string CreditCard = "CreditCard"; + public const string None = "None"; + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/PaymentProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/PaymentProperties.cs new file mode 100644 index 000000000000..649650ab40cf --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/PaymentProperties.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The properties of a payment. + /// + public partial class PaymentProperties + { + /// + /// Initializes a new instance of the PaymentProperties class. + /// + public PaymentProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PaymentProperties class. + /// + + /// The type of payment. + /// + + /// The paid amount. + /// + + /// The date when the payment was made. + /// + + /// The family of payment method. + /// Possible values include: 'Credits', 'CheckWire', 'CreditCard', 'None' + + /// The type of payment method. + /// + public PaymentProperties(string paymentType = default(string), Amount amount = default(Amount), System.DateTime? date = default(System.DateTime?), string paymentMethodFamily = default(string), string paymentMethodType = default(string)) + + { + this.PaymentType = paymentType; + this.Amount = amount; + this.Date = date; + this.PaymentMethodFamily = paymentMethodFamily; + this.PaymentMethodType = paymentMethodType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the type of payment. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "paymentType")] + public string PaymentType {get; private set; } + + /// + /// Gets the paid amount. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "amount")] + public Amount Amount {get; private set; } + + /// + /// Gets the date when the payment was made. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "date")] + public System.DateTime? Date {get; private set; } + + /// + /// Gets or sets the family of payment method. Possible values include: 'Credits', 'CheckWire', 'CreditCard', 'None' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "paymentMethodFamily")] + public string PaymentMethodFamily {get; set; } + + /// + /// Gets the type of payment method. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "paymentMethodType")] + public string PaymentMethodType {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Policy.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Policy.cs new file mode 100644 index 000000000000..2146b07e28a9 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Policy.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// A policy. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class Policy : Resource + { + /// + /// Initializes a new instance of the Policy class. + /// + public Policy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Policy class. + /// + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// + + /// The policy that controls whether Azure marketplace purchases are allowed + /// for a billing profile. + /// Possible values include: 'AllAllowed', 'OnlyFreeAllowed', 'NotAllowed' + + /// The policy that controls whether Azure reservation purchases are allowed + /// for a billing profile. + /// Possible values include: 'Allowed', 'NotAllowed' + + /// The policy that controls whether users with Azure RBAC access to a + /// subscription can view its charges. + /// Possible values include: 'Allowed', 'NotAllowed' + public Policy(string id = default(string), string name = default(string), string type = default(string), string marketplacePurchases = default(string), string reservationPurchases = default(string), string viewCharges = default(string)) + + : base(id, name, type) + { + this.MarketplacePurchases = marketplacePurchases; + this.ReservationPurchases = reservationPurchases; + this.ViewCharges = viewCharges; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the policy that controls whether Azure marketplace purchases + /// are allowed for a billing profile. Possible values include: 'AllAllowed', 'OnlyFreeAllowed', 'NotAllowed' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.marketplacePurchases")] + public string MarketplacePurchases {get; set; } + + /// + /// Gets or sets the policy that controls whether Azure reservation purchases + /// are allowed for a billing profile. Possible values include: 'Allowed', 'NotAllowed' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.reservationPurchases")] + public string ReservationPurchases {get; set; } + + /// + /// Gets or sets the policy that controls whether users with Azure RBAC access + /// to a subscription can view its charges. Possible values include: 'Allowed', 'NotAllowed' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.viewCharges")] + public string ViewCharges {get; set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/PolicyProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/PolicyProperties.cs new file mode 100644 index 000000000000..7dd3e14a3dee --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/PolicyProperties.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The properties of a policy. + /// + public partial class PolicyProperties + { + /// + /// Initializes a new instance of the PolicyProperties class. + /// + public PolicyProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PolicyProperties class. + /// + + /// The policy that controls whether Azure marketplace purchases are allowed + /// for a billing profile. + /// Possible values include: 'AllAllowed', 'OnlyFreeAllowed', 'NotAllowed' + + /// The policy that controls whether Azure reservation purchases are allowed + /// for a billing profile. + /// Possible values include: 'Allowed', 'NotAllowed' + + /// The policy that controls whether users with Azure RBAC access to a + /// subscription can view its charges. + /// Possible values include: 'Allowed', 'NotAllowed' + public PolicyProperties(string marketplacePurchases = default(string), string reservationPurchases = default(string), string viewCharges = default(string)) + + { + this.MarketplacePurchases = marketplacePurchases; + this.ReservationPurchases = reservationPurchases; + this.ViewCharges = viewCharges; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the policy that controls whether Azure marketplace purchases + /// are allowed for a billing profile. Possible values include: 'AllAllowed', 'OnlyFreeAllowed', 'NotAllowed' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "marketplacePurchases")] + public string MarketplacePurchases {get; set; } + + /// + /// Gets or sets the policy that controls whether Azure reservation purchases + /// are allowed for a billing profile. Possible values include: 'Allowed', 'NotAllowed' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "reservationPurchases")] + public string ReservationPurchases {get; set; } + + /// + /// Gets or sets the policy that controls whether users with Azure RBAC access + /// to a subscription can view its charges. Possible values include: 'Allowed', 'NotAllowed' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "viewCharges")] + public string ViewCharges {get; set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Product.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Product.cs new file mode 100644 index 000000000000..95a47080e7cb --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Product.cs @@ -0,0 +1,275 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// A product. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class Product : Resource + { + /// + /// Initializes a new instance of the Product class. + /// + public Product() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Product class. + /// + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// + + /// Indicates whether auto renewal is turned on or off for a product. + /// Possible values include: 'Off', 'On' + + /// The frequency at which the product will be billed. + /// Possible values include: 'OneTime', 'Monthly', 'UsageBased' + + /// Reseller for this product. + /// + + /// The display name of the product. + /// + + /// The date when the product was purchased. + /// + + /// The ID of the type of product. + /// + + /// The description of the type of product. + /// + + /// The current status of the product. + /// Possible values include: 'Active', 'Inactive', 'PastDue', 'Expiring', + /// 'Expired', 'Disabled', 'Cancelled', 'AutoRenew' + + /// The date when the product will be renewed or canceled. + /// + + /// The last month charges. + /// + + /// The date of the last charge. + /// + + /// The quantity purchased for the product. + /// + + /// The sku ID of the product. + /// + + /// The sku description of the product. + /// + + /// The id of the tenant in which the product is used. + /// + + /// The availability of the product. + /// + + /// The ID of the invoice section to which the product is billed. + /// + + /// The name of the invoice section to which the product is billed. + /// + + /// The ID of the billing profile to which the product is billed. + /// + + /// The name of the billing profile to which the product is billed. + /// + + /// The ID of the customer for whom the product was purchased. The field is + /// applicable only for Microsoft Partner Agreement billing account. + /// + + /// The name of the customer for whom the product was purchased. The field is + /// applicable only for Microsoft Partner Agreement billing account. + /// + public Product(string id = default(string), string name = default(string), string type = default(string), string autoRenew = default(string), string billingFrequency = default(string), Reseller reseller = default(Reseller), string displayName = default(string), System.DateTime? purchaseDate = default(System.DateTime?), string productTypeId = default(string), string productType = default(string), string status = default(string), System.DateTime? endDate = default(System.DateTime?), Amount lastCharge = default(Amount), System.DateTime? lastChargeDate = default(System.DateTime?), double? quantity = default(double?), string skuId = default(string), string skuDescription = default(string), string tenantId = default(string), string availabilityId = default(string), string invoiceSectionId = default(string), string invoiceSectionDisplayName = default(string), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string customerId = default(string), string customerDisplayName = default(string)) + + : base(id, name, type) + { + this.AutoRenew = autoRenew; + this.BillingFrequency = billingFrequency; + this.Reseller = reseller; + this.DisplayName = displayName; + this.PurchaseDate = purchaseDate; + this.ProductTypeId = productTypeId; + this.ProductType = productType; + this.Status = status; + this.EndDate = endDate; + this.LastCharge = lastCharge; + this.LastChargeDate = lastChargeDate; + this.Quantity = quantity; + this.SkuId = skuId; + this.SkuDescription = skuDescription; + this.TenantId = tenantId; + this.AvailabilityId = availabilityId; + this.InvoiceSectionId = invoiceSectionId; + this.InvoiceSectionDisplayName = invoiceSectionDisplayName; + this.BillingProfileId = billingProfileId; + this.BillingProfileDisplayName = billingProfileDisplayName; + this.CustomerId = customerId; + this.CustomerDisplayName = customerDisplayName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets indicates whether auto renewal is turned on or off for a + /// product. Possible values include: 'Off', 'On' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.autoRenew")] + public string AutoRenew {get; set; } + + /// + /// Gets or sets the frequency at which the product will be billed. Possible values include: 'OneTime', 'Monthly', 'UsageBased' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingFrequency")] + public string BillingFrequency {get; set; } + + /// + /// Gets reseller for this product. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.reseller")] + public Reseller Reseller {get; private set; } + + /// + /// Gets the display name of the product. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName {get; private set; } + + /// + /// Gets the date when the product was purchased. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.purchaseDate")] + public System.DateTime? PurchaseDate {get; private set; } + + /// + /// Gets the ID of the type of product. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.productTypeId")] + public string ProductTypeId {get; private set; } + + /// + /// Gets the description of the type of product. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.productType")] + public string ProductType {get; private set; } + + /// + /// Gets or sets the current status of the product. Possible values include: 'Active', 'Inactive', 'PastDue', 'Expiring', 'Expired', 'Disabled', 'Cancelled', 'AutoRenew' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.status")] + public string Status {get; set; } + + /// + /// Gets the date when the product will be renewed or canceled. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.endDate")] + public System.DateTime? EndDate {get; private set; } + + /// + /// Gets the last month charges. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.lastCharge")] + public Amount LastCharge {get; private set; } + + /// + /// Gets the date of the last charge. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.lastChargeDate")] + public System.DateTime? LastChargeDate {get; private set; } + + /// + /// Gets the quantity purchased for the product. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.quantity")] + public double? Quantity {get; private set; } + + /// + /// Gets the sku ID of the product. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.skuId")] + public string SkuId {get; private set; } + + /// + /// Gets the sku description of the product. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.skuDescription")] + public string SkuDescription {get; private set; } + + /// + /// Gets the id of the tenant in which the product is used. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.tenantId")] + public string TenantId {get; private set; } + + /// + /// Gets the availability of the product. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.availabilityId")] + public string AvailabilityId {get; private set; } + + /// + /// Gets the ID of the invoice section to which the product is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.invoiceSectionId")] + public string InvoiceSectionId {get; private set; } + + /// + /// Gets the name of the invoice section to which the product is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.invoiceSectionDisplayName")] + public string InvoiceSectionDisplayName {get; private set; } + + /// + /// Gets the ID of the billing profile to which the product is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingProfileId")] + public string BillingProfileId {get; private set; } + + /// + /// Gets the name of the billing profile to which the product is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingProfileDisplayName")] + public string BillingProfileDisplayName {get; private set; } + + /// + /// Gets the ID of the customer for whom the product was purchased. The field + /// is applicable only for Microsoft Partner Agreement billing account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.customerId")] + public string CustomerId {get; private set; } + + /// + /// Gets the name of the customer for whom the product was purchased. The field + /// is applicable only for Microsoft Partner Agreement billing account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.customerDisplayName")] + public string CustomerDisplayName {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ProductProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ProductProperties.cs new file mode 100644 index 000000000000..39532913489a --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ProductProperties.cs @@ -0,0 +1,264 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The properties of a product. + /// + public partial class ProductProperties + { + /// + /// Initializes a new instance of the ProductProperties class. + /// + public ProductProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProductProperties class. + /// + + /// Indicates whether auto renewal is turned on or off for a product. + /// Possible values include: 'Off', 'On' + + /// The display name of the product. + /// + + /// The date when the product was purchased. + /// + + /// The ID of the type of product. + /// + + /// The description of the type of product. + /// + + /// The current status of the product. + /// Possible values include: 'Active', 'Inactive', 'PastDue', 'Expiring', + /// 'Expired', 'Disabled', 'Cancelled', 'AutoRenew' + + /// The date when the product will be renewed or canceled. + /// + + /// The frequency at which the product will be billed. + /// Possible values include: 'OneTime', 'Monthly', 'UsageBased' + + /// The last month charges. + /// + + /// The date of the last charge. + /// + + /// The quantity purchased for the product. + /// + + /// The sku ID of the product. + /// + + /// The sku description of the product. + /// + + /// The id of the tenant in which the product is used. + /// + + /// The availability of the product. + /// + + /// The ID of the invoice section to which the product is billed. + /// + + /// The name of the invoice section to which the product is billed. + /// + + /// The ID of the billing profile to which the product is billed. + /// + + /// The name of the billing profile to which the product is billed. + /// + + /// The ID of the customer for whom the product was purchased. The field is + /// applicable only for Microsoft Partner Agreement billing account. + /// + + /// The name of the customer for whom the product was purchased. The field is + /// applicable only for Microsoft Partner Agreement billing account. + /// + + /// Reseller for this product. + /// + public ProductProperties(string autoRenew = default(string), string displayName = default(string), System.DateTime? purchaseDate = default(System.DateTime?), string productTypeId = default(string), string productType = default(string), string status = default(string), System.DateTime? endDate = default(System.DateTime?), string billingFrequency = default(string), Amount lastCharge = default(Amount), System.DateTime? lastChargeDate = default(System.DateTime?), double? quantity = default(double?), string skuId = default(string), string skuDescription = default(string), string tenantId = default(string), string availabilityId = default(string), string invoiceSectionId = default(string), string invoiceSectionDisplayName = default(string), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string customerId = default(string), string customerDisplayName = default(string), Reseller reseller = default(Reseller)) + + { + this.AutoRenew = autoRenew; + this.DisplayName = displayName; + this.PurchaseDate = purchaseDate; + this.ProductTypeId = productTypeId; + this.ProductType = productType; + this.Status = status; + this.EndDate = endDate; + this.BillingFrequency = billingFrequency; + this.LastCharge = lastCharge; + this.LastChargeDate = lastChargeDate; + this.Quantity = quantity; + this.SkuId = skuId; + this.SkuDescription = skuDescription; + this.TenantId = tenantId; + this.AvailabilityId = availabilityId; + this.InvoiceSectionId = invoiceSectionId; + this.InvoiceSectionDisplayName = invoiceSectionDisplayName; + this.BillingProfileId = billingProfileId; + this.BillingProfileDisplayName = billingProfileDisplayName; + this.CustomerId = customerId; + this.CustomerDisplayName = customerDisplayName; + this.Reseller = reseller; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets indicates whether auto renewal is turned on or off for a + /// product. Possible values include: 'Off', 'On' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "autoRenew")] + public string AutoRenew {get; set; } + + /// + /// Gets the display name of the product. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "displayName")] + public string DisplayName {get; private set; } + + /// + /// Gets the date when the product was purchased. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "purchaseDate")] + public System.DateTime? PurchaseDate {get; private set; } + + /// + /// Gets the ID of the type of product. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "productTypeId")] + public string ProductTypeId {get; private set; } + + /// + /// Gets the description of the type of product. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "productType")] + public string ProductType {get; private set; } + + /// + /// Gets or sets the current status of the product. Possible values include: 'Active', 'Inactive', 'PastDue', 'Expiring', 'Expired', 'Disabled', 'Cancelled', 'AutoRenew' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; set; } + + /// + /// Gets the date when the product will be renewed or canceled. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "endDate")] + public System.DateTime? EndDate {get; private set; } + + /// + /// Gets or sets the frequency at which the product will be billed. Possible values include: 'OneTime', 'Monthly', 'UsageBased' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingFrequency")] + public string BillingFrequency {get; set; } + + /// + /// Gets the last month charges. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "lastCharge")] + public Amount LastCharge {get; private set; } + + /// + /// Gets the date of the last charge. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "lastChargeDate")] + public System.DateTime? LastChargeDate {get; private set; } + + /// + /// Gets the quantity purchased for the product. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "quantity")] + public double? Quantity {get; private set; } + + /// + /// Gets the sku ID of the product. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "skuId")] + public string SkuId {get; private set; } + + /// + /// Gets the sku description of the product. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "skuDescription")] + public string SkuDescription {get; private set; } + + /// + /// Gets the id of the tenant in which the product is used. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "tenantId")] + public string TenantId {get; private set; } + + /// + /// Gets the availability of the product. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "availabilityId")] + public string AvailabilityId {get; private set; } + + /// + /// Gets the ID of the invoice section to which the product is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "invoiceSectionId")] + public string InvoiceSectionId {get; private set; } + + /// + /// Gets the name of the invoice section to which the product is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "invoiceSectionDisplayName")] + public string InvoiceSectionDisplayName {get; private set; } + + /// + /// Gets the ID of the billing profile to which the product is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileId")] + public string BillingProfileId {get; private set; } + + /// + /// Gets the name of the billing profile to which the product is billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileDisplayName")] + public string BillingProfileDisplayName {get; private set; } + + /// + /// Gets the ID of the customer for whom the product was purchased. The field + /// is applicable only for Microsoft Partner Agreement billing account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "customerId")] + public string CustomerId {get; private set; } + + /// + /// Gets the name of the customer for whom the product was purchased. The field + /// is applicable only for Microsoft Partner Agreement billing account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "customerDisplayName")] + public string CustomerDisplayName {get; private set; } + + /// + /// Gets reseller for this product. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "reseller")] + public Reseller Reseller {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ProductStatusType.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ProductStatusType.cs new file mode 100644 index 000000000000..289f5ecb4cdc --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ProductStatusType.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for ProductStatusType. + /// + + + public static class ProductStatusType + { + public const string Active = "Active"; + public const string Inactive = "Inactive"; + public const string PastDue = "PastDue"; + public const string Expiring = "Expiring"; + public const string Expired = "Expired"; + public const string Disabled = "Disabled"; + public const string Cancelled = "Cancelled"; + public const string AutoRenew = "AutoRenew"; + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ProductTransferValidationErrorCode.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ProductTransferValidationErrorCode.cs new file mode 100644 index 000000000000..d9c041c3b338 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ProductTransferValidationErrorCode.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for ProductTransferValidationErrorCode. + /// + + + public static class ProductTransferValidationErrorCode + { + public const string InvalidSource = "InvalidSource"; + public const string ProductNotActive = "ProductNotActive"; + public const string InsufficientPermissionOnSource = "InsufficientPermissionOnSource"; + public const string InsufficientPermissionOnDestination = "InsufficientPermissionOnDestination"; + public const string DestinationBillingProfilePastDue = "DestinationBillingProfilePastDue"; + public const string ProductTypeNotSupported = "ProductTypeNotSupported"; + public const string CrossBillingAccountNotAllowed = "CrossBillingAccountNotAllowed"; + public const string NotAvailableForDestinationMarket = "NotAvailableForDestinationMarket"; + public const string OneTimePurchaseProductTransferNotAllowed = "OneTimePurchaseProductTransferNotAllowed"; + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ProductsMoveHeaders.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ProductsMoveHeaders.cs new file mode 100644 index 000000000000..55dcfb7ea6a9 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ProductsMoveHeaders.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + public partial class ProductsMoveHeaders + { + /// + /// Initializes a new instance of the ProductsMoveHeaders class. + /// + public ProductsMoveHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProductsMoveHeaders class. + /// + + /// + /// + + /// + /// + public ProductsMoveHeaders(string location = default(string), int? retryAfter = default(int?)) + + { + this.Location = location; + this.RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Location")] + public string Location {get; set; } + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter {get; set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Reseller.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Reseller.cs new file mode 100644 index 000000000000..4e46039e33cb --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Reseller.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// Details of the reseller. + /// + public partial class Reseller + { + /// + /// Initializes a new instance of the Reseller class. + /// + public Reseller() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Reseller class. + /// + + /// The MPN ID of the reseller. + /// + + /// The name of the reseller. + /// + public Reseller(string resellerId = default(string), string description = default(string)) + + { + this.ResellerId = resellerId; + this.Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the MPN ID of the reseller. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "resellerId")] + public string ResellerId {get; private set; } + + /// + /// Gets the name of the reseller. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ReservationPurchasesPolicy.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ReservationPurchasesPolicy.cs new file mode 100644 index 000000000000..ead07b499fcd --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ReservationPurchasesPolicy.cs @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for ReservationPurchasesPolicy. + /// + + + public static class ReservationPurchasesPolicy + { + public const string Allowed = "Allowed"; + public const string NotAllowed = "NotAllowed"; + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ReservationType.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ReservationType.cs new file mode 100644 index 000000000000..667a698bdeb6 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ReservationType.cs @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for ReservationType. + /// + + + public static class ReservationType + { + public const string Purchase = "Purchase"; + public const string UsageCharge = "Usage Charge"; + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Resource.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Resource.cs new file mode 100644 index 000000000000..b07267bd625f --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Resource.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The Resource model definition. + /// + public partial class Resource : Microsoft.Rest.Azure.IResource + { + /// + /// Initializes a new instance of the Resource class. + /// + public Resource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Resource class. + /// + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// + public Resource(string id = default(string), string name = default(string), string type = default(string)) + + { + this.Id = id; + this.Name = name; + this.Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets resource Id. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + public string Id {get; private set; } + + /// + /// Gets resource name. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; private set; } + + /// + /// Gets resource type. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + public string Type {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/SpendingLimit.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/SpendingLimit.cs new file mode 100644 index 000000000000..2a301ec38b73 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/SpendingLimit.cs @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for SpendingLimit. + /// + + + public static class SpendingLimit + { + public const string Off = "Off"; + public const string On = "On"; + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/SpendingLimitForBillingProfile.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/SpendingLimitForBillingProfile.cs new file mode 100644 index 000000000000..3004c65aa3ca --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/SpendingLimitForBillingProfile.cs @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for SpendingLimitForBillingProfile. + /// + + + public static class SpendingLimitForBillingProfile + { + public const string Off = "Off"; + public const string On = "On"; + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/StatusReasonCode.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/StatusReasonCode.cs new file mode 100644 index 000000000000..daec5e596efd --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/StatusReasonCode.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for StatusReasonCode. + /// + + + public static class StatusReasonCode + { + public const string PastDue = "PastDue"; + public const string SpendingLimitReached = "SpendingLimitReached"; + public const string SpendingLimitExpired = "SpendingLimitExpired"; + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/StatusReasonCodeForBillingProfile.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/StatusReasonCodeForBillingProfile.cs new file mode 100644 index 000000000000..1841673b5171 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/StatusReasonCodeForBillingProfile.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for StatusReasonCodeForBillingProfile. + /// + + + public static class StatusReasonCodeForBillingProfile + { + public const string PastDue = "PastDue"; + public const string SpendingLimitReached = "SpendingLimitReached"; + public const string SpendingLimitExpired = "SpendingLimitExpired"; + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/SubscriptionTransferValidationErrorCode.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/SubscriptionTransferValidationErrorCode.cs new file mode 100644 index 000000000000..6ccf36491a4e --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/SubscriptionTransferValidationErrorCode.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for SubscriptionTransferValidationErrorCode. + /// + + + public static class SubscriptionTransferValidationErrorCode + { + public const string InvalidSource = "InvalidSource"; + public const string SubscriptionNotActive = "SubscriptionNotActive"; + public const string InsufficientPermissionOnSource = "InsufficientPermissionOnSource"; + public const string InsufficientPermissionOnDestination = "InsufficientPermissionOnDestination"; + public const string DestinationBillingProfilePastDue = "DestinationBillingProfilePastDue"; + public const string SubscriptionTypeNotSupported = "SubscriptionTypeNotSupported"; + public const string CrossBillingAccountNotAllowed = "CrossBillingAccountNotAllowed"; + public const string NotAvailableForDestinationMarket = "NotAvailableForDestinationMarket"; + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/Transaction.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/Transaction.cs new file mode 100644 index 000000000000..471a4d7cc6ff --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/Transaction.cs @@ -0,0 +1,441 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// A transaction. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class Transaction : Resource + { + /// + /// Initializes a new instance of the Transaction class. + /// + public Transaction() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Transaction class. + /// + + /// Resource Id. + /// + + /// Resource name. + /// + + /// Resource type. + /// + + /// The kind of transaction. Options are all or reservation. + /// Possible values include: 'all', 'reservation' + + /// The date of transaction. + /// + + /// Invoice on which the transaction was billed or 'pending' if the transaction + /// is not billed. + /// + + /// The ID of the invoice on which the transaction was billed. This field is + /// only applicable for transactions which are billed. + /// + + /// The order ID of the reservation. The field is only applicable for + /// transaction of kind reservation. + /// + + /// The name of the reservation order. The field is only applicable for + /// transactions of kind reservation. + /// + + /// The family of the product for which the transaction took place. + /// + + /// The ID of the product type for which the transaction took place. + /// + + /// The type of the product for which the transaction took place. + /// + + /// The description of the product for which the transaction took place. + /// + + /// The type of transaction. + /// Possible values include: 'Purchase', 'Usage Charge' + + /// The charge associated with the transaction. + /// + + /// The quantity purchased in the transaction. + /// + + /// The ID of the invoice section which will be billed for the transaction. + /// + + /// The name of the invoice section which will be billed for the transaction. + /// + + /// The ID of the billing profile which will be billed for the transaction. + /// + + /// The name of the billing profile which will be billed for the transaction. + /// + + /// The ID of the customer for which the transaction took place. The field is + /// applicable only for Microsoft Partner Agreement billing account. + /// + + /// The name of the customer for which the transaction took place. The field is + /// applicable only for Microsoft Partner Agreement billing account. + /// + + /// The ID of the subscription that was used for the transaction. The field is + /// only applicable for transaction of kind reservation. + /// + + /// The name of the subscription that was used for the transaction. The field + /// is only applicable for transaction of kind reservation. + /// + + /// The type of azure plan of the subscription that was used for the + /// transaction. + /// + + /// The amount of any Azure credits automatically applied to this transaction. + /// + + /// The ISO 4217 code for the currency in which this transaction is billed. + /// + + /// The percentage discount, if any, applied to this transaction. + /// + + /// The price of the product after applying any discounts. + /// + + /// The exchange rate used to convert charged amount to billing currency, if + /// applicable. + /// + + /// The retail price of the product. + /// + + /// The ISO 4217 code for the currency in which the product is priced. + /// + + /// The date of the purchase of the product, or the start date of the month in + /// which usage started. + /// + + /// The end date of the product term, or the end date of the month in which + /// usage ended. + /// + + /// The pre-tax charged amount for the transaction. + /// + + /// The tax amount applied to the transaction. + /// + + /// The unit of measure used to bill for the product. For example, compute + /// services are billed per hour. + /// + + /// The number of units used for a given product. + /// + + /// The description for the unit of measure for a given product. + /// + public Transaction(string id = default(string), string name = default(string), string type = default(string), string kind = default(string), System.DateTime? date = default(System.DateTime?), string invoice = default(string), string invoiceId = default(string), string orderId = default(string), string orderName = default(string), string productFamily = default(string), string productTypeId = default(string), string productType = default(string), string productDescription = default(string), string transactionType = default(string), Amount transactionAmount = default(Amount), int? quantity = default(int?), string invoiceSectionId = default(string), string invoiceSectionDisplayName = default(string), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string customerId = default(string), string customerDisplayName = default(string), string subscriptionId = default(string), string subscriptionName = default(string), string azurePlan = default(string), Amount azureCreditApplied = default(Amount), string billingCurrency = default(string), double? discount = default(double?), Amount effectivePrice = default(Amount), double? exchangeRate = default(double?), Amount marketPrice = default(Amount), string pricingCurrency = default(string), System.DateTime? servicePeriodStartDate = default(System.DateTime?), System.DateTime? servicePeriodEndDate = default(System.DateTime?), Amount subTotal = default(Amount), Amount tax = default(Amount), string unitOfMeasure = default(string), double? units = default(double?), string unitType = default(string)) + + : base(id, name, type) + { + this.Kind = kind; + this.Date = date; + this.Invoice = invoice; + this.InvoiceId = invoiceId; + this.OrderId = orderId; + this.OrderName = orderName; + this.ProductFamily = productFamily; + this.ProductTypeId = productTypeId; + this.ProductType = productType; + this.ProductDescription = productDescription; + this.TransactionType = transactionType; + this.TransactionAmount = transactionAmount; + this.Quantity = quantity; + this.InvoiceSectionId = invoiceSectionId; + this.InvoiceSectionDisplayName = invoiceSectionDisplayName; + this.BillingProfileId = billingProfileId; + this.BillingProfileDisplayName = billingProfileDisplayName; + this.CustomerId = customerId; + this.CustomerDisplayName = customerDisplayName; + this.SubscriptionId = subscriptionId; + this.SubscriptionName = subscriptionName; + this.AzurePlan = azurePlan; + this.AzureCreditApplied = azureCreditApplied; + this.BillingCurrency = billingCurrency; + this.Discount = discount; + this.EffectivePrice = effectivePrice; + this.ExchangeRate = exchangeRate; + this.MarketPrice = marketPrice; + this.PricingCurrency = pricingCurrency; + this.ServicePeriodStartDate = servicePeriodStartDate; + this.ServicePeriodEndDate = servicePeriodEndDate; + this.SubTotal = subTotal; + this.Tax = tax; + this.UnitOfMeasure = unitOfMeasure; + this.Units = units; + this.UnitType = unitType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the kind of transaction. Options are all or reservation. Possible values include: 'all', 'reservation' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.kind")] + public string Kind {get; set; } + + /// + /// Gets the date of transaction. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.date")] + public System.DateTime? Date {get; private set; } + + /// + /// Gets invoice on which the transaction was billed or 'pending' if the + /// transaction is not billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.invoice")] + public string Invoice {get; private set; } + + /// + /// Gets the ID of the invoice on which the transaction was billed. This field + /// is only applicable for transactions which are billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.invoiceId")] + public string InvoiceId {get; private set; } + + /// + /// Gets the order ID of the reservation. The field is only applicable for + /// transaction of kind reservation. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.orderId")] + public string OrderId {get; private set; } + + /// + /// Gets the name of the reservation order. The field is only applicable for + /// transactions of kind reservation. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.orderName")] + public string OrderName {get; private set; } + + /// + /// Gets the family of the product for which the transaction took place. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.productFamily")] + public string ProductFamily {get; private set; } + + /// + /// Gets the ID of the product type for which the transaction took place. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.productTypeId")] + public string ProductTypeId {get; private set; } + + /// + /// Gets the type of the product for which the transaction took place. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.productType")] + public string ProductType {get; private set; } + + /// + /// Gets the description of the product for which the transaction took place. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.productDescription")] + public string ProductDescription {get; private set; } + + /// + /// Gets or sets the type of transaction. Possible values include: 'Purchase', 'Usage Charge' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.transactionType")] + public string TransactionType {get; set; } + + /// + /// Gets the charge associated with the transaction. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.transactionAmount")] + public Amount TransactionAmount {get; private set; } + + /// + /// Gets the quantity purchased in the transaction. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.quantity")] + public int? Quantity {get; private set; } + + /// + /// Gets the ID of the invoice section which will be billed for the + /// transaction. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.invoiceSectionId")] + public string InvoiceSectionId {get; private set; } + + /// + /// Gets the name of the invoice section which will be billed for the + /// transaction. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.invoiceSectionDisplayName")] + public string InvoiceSectionDisplayName {get; private set; } + + /// + /// Gets the ID of the billing profile which will be billed for the + /// transaction. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingProfileId")] + public string BillingProfileId {get; private set; } + + /// + /// Gets the name of the billing profile which will be billed for the + /// transaction. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingProfileDisplayName")] + public string BillingProfileDisplayName {get; private set; } + + /// + /// Gets the ID of the customer for which the transaction took place. The field + /// is applicable only for Microsoft Partner Agreement billing account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.customerId")] + public string CustomerId {get; private set; } + + /// + /// Gets the name of the customer for which the transaction took place. The + /// field is applicable only for Microsoft Partner Agreement billing account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.customerDisplayName")] + public string CustomerDisplayName {get; private set; } + + /// + /// Gets the ID of the subscription that was used for the transaction. The + /// field is only applicable for transaction of kind reservation. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.subscriptionId")] + public string SubscriptionId {get; private set; } + + /// + /// Gets the name of the subscription that was used for the transaction. The + /// field is only applicable for transaction of kind reservation. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.subscriptionName")] + public string SubscriptionName {get; private set; } + + /// + /// Gets the type of azure plan of the subscription that was used for the + /// transaction. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.azurePlan")] + public string AzurePlan {get; private set; } + + /// + /// Gets the amount of any Azure credits automatically applied to this + /// transaction. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.azureCreditApplied")] + public Amount AzureCreditApplied {get; private set; } + + /// + /// Gets the ISO 4217 code for the currency in which this transaction is + /// billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.billingCurrency")] + public string BillingCurrency {get; private set; } + + /// + /// Gets the percentage discount, if any, applied to this transaction. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.discount")] + public double? Discount {get; private set; } + + /// + /// Gets the price of the product after applying any discounts. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.effectivePrice")] + public Amount EffectivePrice {get; private set; } + + /// + /// Gets the exchange rate used to convert charged amount to billing currency, + /// if applicable. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.exchangeRate")] + public double? ExchangeRate {get; private set; } + + /// + /// Gets the retail price of the product. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.marketPrice")] + public Amount MarketPrice {get; private set; } + + /// + /// Gets the ISO 4217 code for the currency in which the product is priced. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.pricingCurrency")] + public string PricingCurrency {get; private set; } + + /// + /// Gets the date of the purchase of the product, or the start date of the + /// month in which usage started. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.servicePeriodStartDate")] + public System.DateTime? ServicePeriodStartDate {get; private set; } + + /// + /// Gets the end date of the product term, or the end date of the month in + /// which usage ended. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.servicePeriodEndDate")] + public System.DateTime? ServicePeriodEndDate {get; private set; } + + /// + /// Gets the pre-tax charged amount for the transaction. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.subTotal")] + public Amount SubTotal {get; private set; } + + /// + /// Gets the tax amount applied to the transaction. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.tax")] + public Amount Tax {get; private set; } + + /// + /// Gets the unit of measure used to bill for the product. For example, compute + /// services are billed per hour. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.unitOfMeasure")] + public string UnitOfMeasure {get; private set; } + + /// + /// Gets the number of units used for a given product. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.units")] + public double? Units {get; private set; } + + /// + /// Gets the description for the unit of measure for a given product. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.unitType")] + public string UnitType {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/TransactionProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/TransactionProperties.cs new file mode 100644 index 000000000000..1823cf65c33e --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/TransactionProperties.cs @@ -0,0 +1,430 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The properties of a transaction. + /// + public partial class TransactionProperties + { + /// + /// Initializes a new instance of the TransactionProperties class. + /// + public TransactionProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TransactionProperties class. + /// + + /// The kind of transaction. Options are all or reservation. + /// Possible values include: 'all', 'reservation' + + /// The date of transaction. + /// + + /// Invoice on which the transaction was billed or 'pending' if the transaction + /// is not billed. + /// + + /// The ID of the invoice on which the transaction was billed. This field is + /// only applicable for transactions which are billed. + /// + + /// The order ID of the reservation. The field is only applicable for + /// transaction of kind reservation. + /// + + /// The name of the reservation order. The field is only applicable for + /// transactions of kind reservation. + /// + + /// The family of the product for which the transaction took place. + /// + + /// The ID of the product type for which the transaction took place. + /// + + /// The type of the product for which the transaction took place. + /// + + /// The description of the product for which the transaction took place. + /// + + /// The type of transaction. + /// Possible values include: 'Purchase', 'Usage Charge' + + /// The charge associated with the transaction. + /// + + /// The quantity purchased in the transaction. + /// + + /// The ID of the invoice section which will be billed for the transaction. + /// + + /// The name of the invoice section which will be billed for the transaction. + /// + + /// The ID of the billing profile which will be billed for the transaction. + /// + + /// The name of the billing profile which will be billed for the transaction. + /// + + /// The ID of the customer for which the transaction took place. The field is + /// applicable only for Microsoft Partner Agreement billing account. + /// + + /// The name of the customer for which the transaction took place. The field is + /// applicable only for Microsoft Partner Agreement billing account. + /// + + /// The ID of the subscription that was used for the transaction. The field is + /// only applicable for transaction of kind reservation. + /// + + /// The name of the subscription that was used for the transaction. The field + /// is only applicable for transaction of kind reservation. + /// + + /// The type of azure plan of the subscription that was used for the + /// transaction. + /// + + /// The amount of any Azure credits automatically applied to this transaction. + /// + + /// The ISO 4217 code for the currency in which this transaction is billed. + /// + + /// The percentage discount, if any, applied to this transaction. + /// + + /// The price of the product after applying any discounts. + /// + + /// The exchange rate used to convert charged amount to billing currency, if + /// applicable. + /// + + /// The retail price of the product. + /// + + /// The ISO 4217 code for the currency in which the product is priced. + /// + + /// The date of the purchase of the product, or the start date of the month in + /// which usage started. + /// + + /// The end date of the product term, or the end date of the month in which + /// usage ended. + /// + + /// The pre-tax charged amount for the transaction. + /// + + /// The tax amount applied to the transaction. + /// + + /// The unit of measure used to bill for the product. For example, compute + /// services are billed per hour. + /// + + /// The number of units used for a given product. + /// + + /// The description for the unit of measure for a given product. + /// + public TransactionProperties(string kind = default(string), System.DateTime? date = default(System.DateTime?), string invoice = default(string), string invoiceId = default(string), string orderId = default(string), string orderName = default(string), string productFamily = default(string), string productTypeId = default(string), string productType = default(string), string productDescription = default(string), string transactionType = default(string), Amount transactionAmount = default(Amount), int? quantity = default(int?), string invoiceSectionId = default(string), string invoiceSectionDisplayName = default(string), string billingProfileId = default(string), string billingProfileDisplayName = default(string), string customerId = default(string), string customerDisplayName = default(string), string subscriptionId = default(string), string subscriptionName = default(string), string azurePlan = default(string), Amount azureCreditApplied = default(Amount), string billingCurrency = default(string), double? discount = default(double?), Amount effectivePrice = default(Amount), double? exchangeRate = default(double?), Amount marketPrice = default(Amount), string pricingCurrency = default(string), System.DateTime? servicePeriodStartDate = default(System.DateTime?), System.DateTime? servicePeriodEndDate = default(System.DateTime?), Amount subTotal = default(Amount), Amount tax = default(Amount), string unitOfMeasure = default(string), double? units = default(double?), string unitType = default(string)) + + { + this.Kind = kind; + this.Date = date; + this.Invoice = invoice; + this.InvoiceId = invoiceId; + this.OrderId = orderId; + this.OrderName = orderName; + this.ProductFamily = productFamily; + this.ProductTypeId = productTypeId; + this.ProductType = productType; + this.ProductDescription = productDescription; + this.TransactionType = transactionType; + this.TransactionAmount = transactionAmount; + this.Quantity = quantity; + this.InvoiceSectionId = invoiceSectionId; + this.InvoiceSectionDisplayName = invoiceSectionDisplayName; + this.BillingProfileId = billingProfileId; + this.BillingProfileDisplayName = billingProfileDisplayName; + this.CustomerId = customerId; + this.CustomerDisplayName = customerDisplayName; + this.SubscriptionId = subscriptionId; + this.SubscriptionName = subscriptionName; + this.AzurePlan = azurePlan; + this.AzureCreditApplied = azureCreditApplied; + this.BillingCurrency = billingCurrency; + this.Discount = discount; + this.EffectivePrice = effectivePrice; + this.ExchangeRate = exchangeRate; + this.MarketPrice = marketPrice; + this.PricingCurrency = pricingCurrency; + this.ServicePeriodStartDate = servicePeriodStartDate; + this.ServicePeriodEndDate = servicePeriodEndDate; + this.SubTotal = subTotal; + this.Tax = tax; + this.UnitOfMeasure = unitOfMeasure; + this.Units = units; + this.UnitType = unitType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the kind of transaction. Options are all or reservation. Possible values include: 'all', 'reservation' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "kind")] + public string Kind {get; set; } + + /// + /// Gets the date of transaction. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "date")] + public System.DateTime? Date {get; private set; } + + /// + /// Gets invoice on which the transaction was billed or 'pending' if the + /// transaction is not billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "invoice")] + public string Invoice {get; private set; } + + /// + /// Gets the ID of the invoice on which the transaction was billed. This field + /// is only applicable for transactions which are billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "invoiceId")] + public string InvoiceId {get; private set; } + + /// + /// Gets the order ID of the reservation. The field is only applicable for + /// transaction of kind reservation. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "orderId")] + public string OrderId {get; private set; } + + /// + /// Gets the name of the reservation order. The field is only applicable for + /// transactions of kind reservation. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "orderName")] + public string OrderName {get; private set; } + + /// + /// Gets the family of the product for which the transaction took place. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "productFamily")] + public string ProductFamily {get; private set; } + + /// + /// Gets the ID of the product type for which the transaction took place. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "productTypeId")] + public string ProductTypeId {get; private set; } + + /// + /// Gets the type of the product for which the transaction took place. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "productType")] + public string ProductType {get; private set; } + + /// + /// Gets the description of the product for which the transaction took place. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "productDescription")] + public string ProductDescription {get; private set; } + + /// + /// Gets or sets the type of transaction. Possible values include: 'Purchase', 'Usage Charge' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "transactionType")] + public string TransactionType {get; set; } + + /// + /// Gets the charge associated with the transaction. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "transactionAmount")] + public Amount TransactionAmount {get; private set; } + + /// + /// Gets the quantity purchased in the transaction. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "quantity")] + public int? Quantity {get; private set; } + + /// + /// Gets the ID of the invoice section which will be billed for the + /// transaction. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "invoiceSectionId")] + public string InvoiceSectionId {get; private set; } + + /// + /// Gets the name of the invoice section which will be billed for the + /// transaction. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "invoiceSectionDisplayName")] + public string InvoiceSectionDisplayName {get; private set; } + + /// + /// Gets the ID of the billing profile which will be billed for the + /// transaction. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileId")] + public string BillingProfileId {get; private set; } + + /// + /// Gets the name of the billing profile which will be billed for the + /// transaction. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingProfileDisplayName")] + public string BillingProfileDisplayName {get; private set; } + + /// + /// Gets the ID of the customer for which the transaction took place. The field + /// is applicable only for Microsoft Partner Agreement billing account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "customerId")] + public string CustomerId {get; private set; } + + /// + /// Gets the name of the customer for which the transaction took place. The + /// field is applicable only for Microsoft Partner Agreement billing account. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "customerDisplayName")] + public string CustomerDisplayName {get; private set; } + + /// + /// Gets the ID of the subscription that was used for the transaction. The + /// field is only applicable for transaction of kind reservation. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "subscriptionId")] + public string SubscriptionId {get; private set; } + + /// + /// Gets the name of the subscription that was used for the transaction. The + /// field is only applicable for transaction of kind reservation. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "subscriptionName")] + public string SubscriptionName {get; private set; } + + /// + /// Gets the type of azure plan of the subscription that was used for the + /// transaction. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "azurePlan")] + public string AzurePlan {get; private set; } + + /// + /// Gets the amount of any Azure credits automatically applied to this + /// transaction. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "azureCreditApplied")] + public Amount AzureCreditApplied {get; private set; } + + /// + /// Gets the ISO 4217 code for the currency in which this transaction is + /// billed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "billingCurrency")] + public string BillingCurrency {get; private set; } + + /// + /// Gets the percentage discount, if any, applied to this transaction. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "discount")] + public double? Discount {get; private set; } + + /// + /// Gets the price of the product after applying any discounts. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "effectivePrice")] + public Amount EffectivePrice {get; private set; } + + /// + /// Gets the exchange rate used to convert charged amount to billing currency, + /// if applicable. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "exchangeRate")] + public double? ExchangeRate {get; private set; } + + /// + /// Gets the retail price of the product. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "marketPrice")] + public Amount MarketPrice {get; private set; } + + /// + /// Gets the ISO 4217 code for the currency in which the product is priced. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "pricingCurrency")] + public string PricingCurrency {get; private set; } + + /// + /// Gets the date of the purchase of the product, or the start date of the + /// month in which usage started. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "servicePeriodStartDate")] + public System.DateTime? ServicePeriodStartDate {get; private set; } + + /// + /// Gets the end date of the product term, or the end date of the month in + /// which usage ended. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "servicePeriodEndDate")] + public System.DateTime? ServicePeriodEndDate {get; private set; } + + /// + /// Gets the pre-tax charged amount for the transaction. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "subTotal")] + public Amount SubTotal {get; private set; } + + /// + /// Gets the tax amount applied to the transaction. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "tax")] + public Amount Tax {get; private set; } + + /// + /// Gets the unit of measure used to bill for the product. For example, compute + /// services are billed per hour. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "unitOfMeasure")] + public string UnitOfMeasure {get; private set; } + + /// + /// Gets the number of units used for a given product. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "units")] + public double? Units {get; private set; } + + /// + /// Gets the description for the unit of measure for a given product. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "unitType")] + public string UnitType {get; private set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/TransactionTypeKind.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/TransactionTypeKind.cs new file mode 100644 index 000000000000..404dd5fa90d5 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/TransactionTypeKind.cs @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for TransactionTypeKind. + /// + + + public static class TransactionTypeKind + { + public const string All = "all"; + public const string Reservation = "reservation"; + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/TransferBillingSubscriptionRequestProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/TransferBillingSubscriptionRequestProperties.cs new file mode 100644 index 000000000000..807bb3e24b77 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/TransferBillingSubscriptionRequestProperties.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// Request parameters to transfer billing subscription. + /// + public partial class TransferBillingSubscriptionRequestProperties + { + /// + /// Initializes a new instance of the TransferBillingSubscriptionRequestProperties class. + /// + public TransferBillingSubscriptionRequestProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TransferBillingSubscriptionRequestProperties class. + /// + + /// The destination invoice section id. + /// + public TransferBillingSubscriptionRequestProperties(string destinationInvoiceSectionId) + + { + this.DestinationInvoiceSectionId = destinationInvoiceSectionId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the destination invoice section id. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "destinationInvoiceSectionId")] + public string DestinationInvoiceSectionId {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.DestinationInvoiceSectionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "DestinationInvoiceSectionId"); + } + + } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/TransferProductRequestProperties.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/TransferProductRequestProperties.cs new file mode 100644 index 000000000000..ba575477bc1d --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/TransferProductRequestProperties.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// The properties of the product to initiate a transfer. + /// + public partial class TransferProductRequestProperties + { + /// + /// Initializes a new instance of the TransferProductRequestProperties class. + /// + public TransferProductRequestProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TransferProductRequestProperties class. + /// + + /// The destination invoice section id. + /// + public TransferProductRequestProperties(string destinationInvoiceSectionId = default(string)) + + { + this.DestinationInvoiceSectionId = destinationInvoiceSectionId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the destination invoice section id. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "destinationInvoiceSectionId")] + public string DestinationInvoiceSectionId {get; set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateAddressResponse.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateAddressResponse.cs new file mode 100644 index 000000000000..3861bca0cfbc --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateAddressResponse.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// Result of the address validation + /// + public partial class ValidateAddressResponse + { + /// + /// Initializes a new instance of the ValidateAddressResponse class. + /// + public ValidateAddressResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ValidateAddressResponse class. + /// + + /// status of the address validation. + /// Possible values include: 'Valid', 'Invalid' + + /// The list of suggested addresses. + /// + + /// Validation error message. + /// + public ValidateAddressResponse(string status = default(string), System.Collections.Generic.IList suggestedAddresses = default(System.Collections.Generic.IList), string validationMessage = default(string)) + + { + this.Status = status; + this.SuggestedAddresses = suggestedAddresses; + this.ValidationMessage = validationMessage; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets status of the address validation. Possible values include: 'Valid', 'Invalid' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; set; } + + /// + /// Gets or sets the list of suggested addresses. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "suggestedAddresses")] + public System.Collections.Generic.IList SuggestedAddresses {get; set; } + + /// + /// Gets or sets validation error message. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "validationMessage")] + public string ValidationMessage {get; set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateProductTransferEligibilityError.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateProductTransferEligibilityError.cs new file mode 100644 index 000000000000..003e53036f00 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateProductTransferEligibilityError.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// Error details of the product transfer eligibility validation. + /// + public partial class ValidateProductTransferEligibilityError + { + /// + /// Initializes a new instance of the ValidateProductTransferEligibilityError class. + /// + public ValidateProductTransferEligibilityError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ValidateProductTransferEligibilityError class. + /// + + /// Error code for the product transfer validation. + /// Possible values include: 'InvalidSource', 'ProductNotActive', + /// 'InsufficientPermissionOnSource', 'InsufficientPermissionOnDestination', + /// 'DestinationBillingProfilePastDue', 'ProductTypeNotSupported', + /// 'CrossBillingAccountNotAllowed', 'NotAvailableForDestinationMarket', + /// 'OneTimePurchaseProductTransferNotAllowed' + + /// The error message. + /// + + /// Detailed error message explaining the error. + /// + public ValidateProductTransferEligibilityError(string code = default(string), string message = default(string), string details = default(string)) + + { + this.Code = code; + this.Message = message; + this.Details = details; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets error code for the product transfer validation. Possible values include: 'InvalidSource', 'ProductNotActive', 'InsufficientPermissionOnSource', 'InsufficientPermissionOnDestination', 'DestinationBillingProfilePastDue', 'ProductTypeNotSupported', 'CrossBillingAccountNotAllowed', 'NotAvailableForDestinationMarket', 'OneTimePurchaseProductTransferNotAllowed' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "code")] + public string Code {get; set; } + + /// + /// Gets or sets the error message. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "message")] + public string Message {get; set; } + + /// + /// Gets or sets detailed error message explaining the error. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "details")] + public string Details {get; set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateProductTransferEligibilityResult.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateProductTransferEligibilityResult.cs new file mode 100644 index 000000000000..839ff7c044a3 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateProductTransferEligibilityResult.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// Result of the product transfer eligibility validation. + /// + public partial class ValidateProductTransferEligibilityResult + { + /// + /// Initializes a new instance of the ValidateProductTransferEligibilityResult class. + /// + public ValidateProductTransferEligibilityResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ValidateProductTransferEligibilityResult class. + /// + + /// Specifies whether the transfer is eligible or not. + /// + + /// Validation error details. + /// + public ValidateProductTransferEligibilityResult(bool? isMoveEligible = default(bool?), ValidateProductTransferEligibilityError errorDetails = default(ValidateProductTransferEligibilityError)) + + { + this.IsMoveEligible = isMoveEligible; + this.ErrorDetails = errorDetails; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets specifies whether the transfer is eligible or not. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "isMoveEligible")] + public bool? IsMoveEligible {get; private set; } + + /// + /// Gets or sets validation error details. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "errorDetails")] + public ValidateProductTransferEligibilityError ErrorDetails {get; set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateSubscriptionTransferEligibilityError.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateSubscriptionTransferEligibilityError.cs new file mode 100644 index 000000000000..a1ceadba5c4d --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateSubscriptionTransferEligibilityError.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// Error details of the transfer eligibility validation + /// + public partial class ValidateSubscriptionTransferEligibilityError + { + /// + /// Initializes a new instance of the ValidateSubscriptionTransferEligibilityError class. + /// + public ValidateSubscriptionTransferEligibilityError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ValidateSubscriptionTransferEligibilityError class. + /// + + /// Error code for the product transfer validation. + /// Possible values include: 'InvalidSource', 'SubscriptionNotActive', + /// 'InsufficientPermissionOnSource', 'InsufficientPermissionOnDestination', + /// 'DestinationBillingProfilePastDue', 'SubscriptionTypeNotSupported', + /// 'CrossBillingAccountNotAllowed', 'NotAvailableForDestinationMarket' + + /// The error message. + /// + + /// Detailed error message explaining the error. + /// + public ValidateSubscriptionTransferEligibilityError(string code = default(string), string message = default(string), string details = default(string)) + + { + this.Code = code; + this.Message = message; + this.Details = details; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets error code for the product transfer validation. Possible values include: 'InvalidSource', 'SubscriptionNotActive', 'InsufficientPermissionOnSource', 'InsufficientPermissionOnDestination', 'DestinationBillingProfilePastDue', 'SubscriptionTypeNotSupported', 'CrossBillingAccountNotAllowed', 'NotAvailableForDestinationMarket' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "code")] + public string Code {get; set; } + + /// + /// Gets or sets the error message. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "message")] + public string Message {get; set; } + + /// + /// Gets or sets detailed error message explaining the error. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "details")] + public string Details {get; set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateSubscriptionTransferEligibilityResult.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateSubscriptionTransferEligibilityResult.cs new file mode 100644 index 000000000000..835312e8188b --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ValidateSubscriptionTransferEligibilityResult.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + using System.Linq; + + /// + /// Result of the transfer eligibility validation. + /// + public partial class ValidateSubscriptionTransferEligibilityResult + { + /// + /// Initializes a new instance of the ValidateSubscriptionTransferEligibilityResult class. + /// + public ValidateSubscriptionTransferEligibilityResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ValidateSubscriptionTransferEligibilityResult class. + /// + + /// Specifies whether the subscription is eligible to be transferred. + /// + + /// Validation error details. + /// + public ValidateSubscriptionTransferEligibilityResult(bool? isMoveEligible = default(bool?), ValidateSubscriptionTransferEligibilityError errorDetails = default(ValidateSubscriptionTransferEligibilityError)) + + { + this.IsMoveEligible = isMoveEligible; + this.ErrorDetails = errorDetails; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets specifies whether the subscription is eligible to be transferred. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "isMoveEligible")] + public bool? IsMoveEligible {get; private set; } + + /// + /// Gets or sets validation error details. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "errorDetails")] + public ValidateSubscriptionTransferEligibilityError ErrorDetails {get; set; } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ViewCharges.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ViewCharges.cs new file mode 100644 index 000000000000..84a43e548ab3 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ViewCharges.cs @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for ViewCharges. + /// + + + public static class ViewCharges + { + public const string Allowed = "Allowed"; + public const string NotAllowed = "NotAllowed"; + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Models/ViewChargesPolicy.cs b/src/Billing/Billing.Management.Sdk/Generated/Models/ViewChargesPolicy.cs new file mode 100644 index 000000000000..0fd9b6d374f3 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Models/ViewChargesPolicy.cs @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.Billing.Models +{ + + /// + /// Defines values for ViewChargesPolicy. + /// + + + public static class ViewChargesPolicy + { + public const string Allowed = "Allowed"; + public const string NotAllowed = "NotAllowed"; + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/Operations.cs b/src/Billing/Billing.Management.Sdk/Generated/Operations.cs new file mode 100644 index 000000000000..fa8f11372deb --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/Operations.cs @@ -0,0 +1,398 @@ +// 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 System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// Operations operations. + /// + internal partial class Operations : Microsoft.Rest.IServiceOperations, IOperations + { + /// + /// Initializes a new instance of the Operations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal Operations (BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// Lists the available billing REST API operations. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/operations").ToString(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the available billing REST API operations. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/OperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/OperationsExtensions.cs new file mode 100644 index 000000000000..654b47da7413 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/OperationsExtensions.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for Operations + /// + public static partial class OperationsExtensions + { + /// + /// Lists the available billing REST API operations. + /// + /// + /// The operations group for this extension method. + /// + public static Microsoft.Rest.Azure.IPage List(this IOperations operations) + { + return ((IOperations)operations).ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists the available billing REST API operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IOperations operations, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the available billing REST API operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IOperations operations, string nextPageLink) + { + return ((IOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the available billing REST API operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/PoliciesOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/PoliciesOperations.cs new file mode 100644 index 000000000000..c9bc67949d3e --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/PoliciesOperations.cs @@ -0,0 +1,872 @@ +// 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 System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// PoliciesOperations operations. + /// + internal partial class PoliciesOperations : Microsoft.Rest.IServiceOperations, IPoliciesOperations + { + /// + /// Initializes a new instance of the PoliciesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PoliciesOperations (BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// Lists the policies for a billing profile. This operation is supported only + /// for billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> GetByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (billingProfileName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("apiVersion", apiVersion); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetByBillingProfile", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/policies/default").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Updates the policies for a billing profile. This operation is supported + /// only for billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// Request parameters that are provided to the update policies 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 System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string billingAccountName, string billingProfileName, Policy parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + } + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (billingProfileName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + + tracingParameters.Add("parameters", parameters); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/policies/default").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the policies for a customer. This operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// 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 System.Threading.Tasks.Task> GetByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (customerName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "customerName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("customerName", customerName); + tracingParameters.Add("apiVersion", apiVersion); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetByCustomer", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/policies/default").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Updates the policies for a customer. This operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// Request parameters that are provided to the update policies 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 System.Threading.Tasks.Task> UpdateCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, CustomerPolicy parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + } + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (customerName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "customerName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("customerName", customerName); + + tracingParameters.Add("parameters", parameters); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "UpdateCustomer", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/policies/default").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/PoliciesOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/PoliciesOperationsExtensions.cs new file mode 100644 index 000000000000..6e3639fc59f5 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/PoliciesOperationsExtensions.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +namespace Microsoft.Azure.Management.Billing +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for PoliciesOperations + /// + public static partial class PoliciesOperationsExtensions + { + /// + /// Lists the policies for a billing profile. This operation is supported only + /// for billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + public static Policy GetByBillingProfile(this IPoliciesOperations operations, string billingAccountName, string billingProfileName) + { + return ((IPoliciesOperations)operations).GetByBillingProfileAsync(billingAccountName, billingProfileName).GetAwaiter().GetResult(); + } + + /// + /// Lists the policies for a billing profile. This operation is supported only + /// for billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetByBillingProfileAsync(this IPoliciesOperations operations, string billingAccountName, string billingProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Updates the policies for a billing profile. This operation is supported + /// only for billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + public static Policy Update(this IPoliciesOperations operations, string billingAccountName, string billingProfileName, Policy parameters) + { + return ((IPoliciesOperations)operations).UpdateAsync(billingAccountName, billingProfileName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates the policies for a billing profile. This operation is supported + /// only for billing accounts with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this IPoliciesOperations operations, string billingAccountName, string billingProfileName, Policy parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(billingAccountName, billingProfileName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the policies for a customer. This operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + public static CustomerPolicy GetByCustomer(this IPoliciesOperations operations, string billingAccountName, string customerName) + { + return ((IPoliciesOperations)operations).GetByCustomerAsync(billingAccountName, customerName).GetAwaiter().GetResult(); + } + + /// + /// Lists the policies for a customer. This operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetByCustomerAsync(this IPoliciesOperations operations, string billingAccountName, string customerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetByCustomerWithHttpMessagesAsync(billingAccountName, customerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Updates the policies for a customer. This operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + public static CustomerPolicy UpdateCustomer(this IPoliciesOperations operations, string billingAccountName, string customerName, CustomerPolicy parameters) + { + return ((IPoliciesOperations)operations).UpdateCustomerAsync(billingAccountName, customerName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates the policies for a customer. This operation is supported only for + /// billing accounts with agreement type Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateCustomerAsync(this IPoliciesOperations operations, string billingAccountName, string customerName, CustomerPolicy parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateCustomerWithHttpMessagesAsync(billingAccountName, customerName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/ProductsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/ProductsOperations.cs new file mode 100644 index 000000000000..a2cf48854844 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/ProductsOperations.cs @@ -0,0 +1,2462 @@ +// 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 System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// ProductsOperations operations. + /// + internal partial class ProductsOperations : Microsoft.Rest.IServiceOperations, IProductsOperations + { + /// + /// Initializes a new instance of the ProductsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ProductsOperations (BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// Lists the products for a customer. These don't include products billed + /// based on usage.The operation is supported only for billing accounts with + /// agreement type Microsoft Partner Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListByCustomerWithHttpMessagesAsync(string billingAccountName, string customerName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (customerName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "customerName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("customerName", customerName); + tracingParameters.Add("apiVersion", apiVersion); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByCustomer", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/products").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the products for a billing account. These don't include products + /// billed based on usage. The operation is supported for billing accounts with + /// agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// May be used to filter by product type. The filter supports 'eq', 'lt', + /// 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or + /// 'not'. Tag filter is a key value pair string where key and value are + /// separated by a colon (:). + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByBillingAccountWithHttpMessagesAsync(string billingAccountName, string filter = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("filter", filter); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccount", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the products for a billing profile. These don't include products + /// billed based on usage. The operation is supported for billing accounts with + /// agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// May be used to filter by product type. The filter supports 'eq', 'lt', + /// 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or + /// 'not'. Tag filter is a key value pair string where key and value are + /// separated by a colon (:). + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByBillingProfileWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string filter = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (billingProfileName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); + } + + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("filter", filter); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfile", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/products").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the products for an invoice section. These don't include products + /// billed based on usage. The operation is supported only for billing accounts + /// with agreement type Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// May be used to filter by product type. The filter supports 'eq', 'lt', + /// 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or + /// 'not'. Tag filter is a key value pair string where key and value are + /// separated by a colon (:). + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByInvoiceSectionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, string filter = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (billingProfileName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingProfileName"); + } + + if (invoiceSectionName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "invoiceSectionName"); + } + + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("billingProfileName", billingProfileName); + tracingParameters.Add("invoiceSectionName", invoiceSectionName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("filter", filter); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSection", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/products").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName)); + _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Gets a product by ID. The operation is supported only for billing accounts + /// with agreement type Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a product. + /// + /// + /// 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 System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string billingAccountName, string productName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (productName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "productName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("productName", productName); + tracingParameters.Add("apiVersion", apiVersion); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{productName}", System.Uri.EscapeDataString(productName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Updates the properties of a Product. Currently, auto renew can be updated. + /// The operation is supported only for billing accounts with agreement type + /// Microsoft Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a product. + /// + /// + /// Request parameters that are provided to the update product 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 System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string billingAccountName, string productName, Product parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + } + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (productName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "productName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("productName", productName); + tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("parameters", parameters); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{productName}", System.Uri.EscapeDataString(productName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Moves a product's charges to a new invoice section. The new invoice section + /// must belong to the same billing profile as the existing invoice section. + /// This operation is supported only for products that are purchased with a + /// recurring charge and for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a product. + /// + /// + /// Request parameters that are provided to the move product 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 System.Threading.Tasks.Task> MoveWithHttpMessagesAsync(string billingAccountName, string productName, TransferProductRequestProperties parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + } + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (productName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "productName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("productName", productName); + tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("parameters", parameters); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Move", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}/move").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{productName}", System.Uri.EscapeDataString(productName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Validates if a product's charges can be moved to a new invoice section. + /// This operation is supported only for products that are purchased with a + /// recurring charge and for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a product. + /// + /// + /// Request parameters that are provided to the validate move eligibility + /// 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 System.Threading.Tasks.Task> ValidateMoveWithHttpMessagesAsync(string billingAccountName, string productName, TransferProductRequestProperties parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (parameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + } + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (productName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "productName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("productName", productName); + tracingParameters.Add("apiVersion", apiVersion); + + tracingParameters.Add("parameters", parameters); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ValidateMove", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}/validateMoveEligibility").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{productName}", System.Uri.EscapeDataString(productName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the products for a customer. These don't include products billed + /// based on usage.The operation is supported only for billing accounts with + /// agreement type Microsoft Partner Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByCustomerNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByCustomerNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the products for a billing account. These don't include products + /// billed based on usage. The operation is supported for billing accounts with + /// agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByBillingAccountNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingAccountNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the products for a billing profile. These don't include products + /// billed based on usage. The operation is supported for billing accounts with + /// agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByBillingProfileNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByBillingProfileNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the products for an invoice section. These don't include products + /// billed based on usage. The operation is supported only for billing accounts + /// with agreement type Microsoft Customer Agreement. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByInvoiceSectionNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceSectionNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/ProductsOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/ProductsOperationsExtensions.cs new file mode 100644 index 000000000000..304956deb1d9 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/ProductsOperationsExtensions.cs @@ -0,0 +1,548 @@ +// 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.Azure; + using Models; + + /// + /// Extension methods for ProductsOperations + /// + public static partial class ProductsOperationsExtensions + { + /// + /// Lists the products for a customer. These don't include products billed + /// based on usage.The operation is supported only for billing accounts with + /// agreement type Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + public static Microsoft.Rest.Azure.IPage ListByCustomer(this IProductsOperations operations, string billingAccountName, string customerName) + { + return ((IProductsOperations)operations).ListByCustomerAsync(billingAccountName, customerName).GetAwaiter().GetResult(); + } + + /// + /// Lists the products for a customer. These don't include products billed + /// based on usage.The operation is supported only for billing accounts with + /// agreement type Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a customer. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByCustomerAsync(this IProductsOperations operations, string billingAccountName, string customerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByCustomerWithHttpMessagesAsync(billingAccountName, customerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the products for a billing account. These don't include products + /// billed based on usage. The operation is supported for billing accounts with + /// agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// May be used to filter by product type. The filter supports 'eq', 'lt', + /// 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or + /// 'not'. Tag filter is a key value pair string where key and value are + /// separated by a colon (:). + /// + public static Microsoft.Rest.Azure.IPage ListByBillingAccount(this IProductsOperations operations, string billingAccountName, string filter = default(string)) + { + return ((IProductsOperations)operations).ListByBillingAccountAsync(billingAccountName, filter).GetAwaiter().GetResult(); + } + + /// + /// Lists the products for a billing account. These don't include products + /// billed based on usage. The operation is supported for billing accounts with + /// agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// May be used to filter by product type. The filter supports 'eq', 'lt', + /// 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or + /// 'not'. Tag filter is a key value pair string where key and value are + /// separated by a colon (:). + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingAccountAsync(this IProductsOperations operations, string billingAccountName, string filter = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountWithHttpMessagesAsync(billingAccountName, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the products for a billing profile. These don't include products + /// billed based on usage. The operation is supported for billing accounts with + /// agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// May be used to filter by product type. The filter supports 'eq', 'lt', + /// 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or + /// 'not'. Tag filter is a key value pair string where key and value are + /// separated by a colon (:). + /// + public static Microsoft.Rest.Azure.IPage ListByBillingProfile(this IProductsOperations operations, string billingAccountName, string billingProfileName, string filter = default(string)) + { + return ((IProductsOperations)operations).ListByBillingProfileAsync(billingAccountName, billingProfileName, filter).GetAwaiter().GetResult(); + } + + /// + /// Lists the products for a billing profile. These don't include products + /// billed based on usage. The operation is supported for billing accounts with + /// agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// May be used to filter by product type. The filter supports 'eq', 'lt', + /// 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or + /// 'not'. Tag filter is a key value pair string where key and value are + /// separated by a colon (:). + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingProfileAsync(this IProductsOperations operations, string billingAccountName, string billingProfileName, string filter = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileWithHttpMessagesAsync(billingAccountName, billingProfileName, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the products for an invoice section. These don't include products + /// billed based on usage. The operation is supported only for billing accounts + /// with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// May be used to filter by product type. The filter supports 'eq', 'lt', + /// 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or + /// 'not'. Tag filter is a key value pair string where key and value are + /// separated by a colon (:). + /// + public static Microsoft.Rest.Azure.IPage ListByInvoiceSection(this IProductsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string filter = default(string)) + { + return ((IProductsOperations)operations).ListByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, filter).GetAwaiter().GetResult(); + } + + /// + /// Lists the products for an invoice section. These don't include products + /// billed based on usage. The operation is supported only for billing accounts + /// with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a billing profile. + /// + /// + /// The ID that uniquely identifies an invoice section. + /// + /// + /// May be used to filter by product type. The filter supports 'eq', 'lt', + /// 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or + /// 'not'. Tag filter is a key value pair string where key and value are + /// separated by a colon (:). + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByInvoiceSectionAsync(this IProductsOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, string filter = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByInvoiceSectionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Gets a product by ID. The operation is supported only for billing accounts + /// with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a product. + /// + public static Product Get(this IProductsOperations operations, string billingAccountName, string productName) + { + return ((IProductsOperations)operations).GetAsync(billingAccountName, productName).GetAwaiter().GetResult(); + } + + /// + /// Gets a product by ID. The operation is supported only for billing accounts + /// with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a product. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IProductsOperations operations, string billingAccountName, string productName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountName, productName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Updates the properties of a Product. Currently, auto renew can be updated. + /// The operation is supported only for billing accounts with agreement type + /// Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a product. + /// + public static Product Update(this IProductsOperations operations, string billingAccountName, string productName, Product parameters) + { + return ((IProductsOperations)operations).UpdateAsync(billingAccountName, productName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates the properties of a Product. Currently, auto renew can be updated. + /// The operation is supported only for billing accounts with agreement type + /// Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a product. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this IProductsOperations operations, string billingAccountName, string productName, Product parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(billingAccountName, productName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Moves a product's charges to a new invoice section. The new invoice section + /// must belong to the same billing profile as the existing invoice section. + /// This operation is supported only for products that are purchased with a + /// recurring charge and for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a product. + /// + public static Product Move(this IProductsOperations operations, string billingAccountName, string productName, TransferProductRequestProperties parameters) + { + return ((IProductsOperations)operations).MoveAsync(billingAccountName, productName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Moves a product's charges to a new invoice section. The new invoice section + /// must belong to the same billing profile as the existing invoice section. + /// This operation is supported only for products that are purchased with a + /// recurring charge and for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a product. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task MoveAsync(this IProductsOperations operations, string billingAccountName, string productName, TransferProductRequestProperties parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.MoveWithHttpMessagesAsync(billingAccountName, productName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Validates if a product's charges can be moved to a new invoice section. + /// This operation is supported only for products that are purchased with a + /// recurring charge and for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a product. + /// + public static ValidateProductTransferEligibilityResult ValidateMove(this IProductsOperations operations, string billingAccountName, string productName, TransferProductRequestProperties parameters) + { + return ((IProductsOperations)operations).ValidateMoveAsync(billingAccountName, productName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Validates if a product's charges can be moved to a new invoice section. + /// This operation is supported only for products that are purchased with a + /// recurring charge and for billing accounts with agreement type Microsoft + /// Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies a product. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task ValidateMoveAsync(this IProductsOperations operations, string billingAccountName, string productName, TransferProductRequestProperties parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ValidateMoveWithHttpMessagesAsync(billingAccountName, productName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the products for a customer. These don't include products billed + /// based on usage.The operation is supported only for billing accounts with + /// agreement type Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByCustomerNext(this IProductsOperations operations, string nextPageLink) + { + return ((IProductsOperations)operations).ListByCustomerNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the products for a customer. These don't include products billed + /// based on usage.The operation is supported only for billing accounts with + /// agreement type Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByCustomerNextAsync(this IProductsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByCustomerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the products for a billing account. These don't include products + /// billed based on usage. The operation is supported for billing accounts with + /// agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingAccountNext(this IProductsOperations operations, string nextPageLink) + { + return ((IProductsOperations)operations).ListByBillingAccountNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the products for a billing account. These don't include products + /// billed based on usage. The operation is supported for billing accounts with + /// agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingAccountNextAsync(this IProductsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingAccountNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the products for a billing profile. These don't include products + /// billed based on usage. The operation is supported for billing accounts with + /// agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByBillingProfileNext(this IProductsOperations operations, string nextPageLink) + { + return ((IProductsOperations)operations).ListByBillingProfileNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the products for a billing profile. These don't include products + /// billed based on usage. The operation is supported for billing accounts with + /// agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByBillingProfileNextAsync(this IProductsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByBillingProfileNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the products for an invoice section. These don't include products + /// billed based on usage. The operation is supported only for billing accounts + /// with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByInvoiceSectionNext(this IProductsOperations operations, string nextPageLink) + { + return ((IProductsOperations)operations).ListByInvoiceSectionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the products for an invoice section. These don't include products + /// billed based on usage. The operation is supported only for billing accounts + /// with agreement type Microsoft Customer Agreement. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByInvoiceSectionNextAsync(this IProductsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByInvoiceSectionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Billing/Billing.Management.Sdk/Generated/TransactionsOperations.cs b/src/Billing/Billing.Management.Sdk/Generated/TransactionsOperations.cs new file mode 100644 index 000000000000..70d13b528cd1 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/TransactionsOperations.cs @@ -0,0 +1,420 @@ +// 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 System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// TransactionsOperations operations. + /// + internal partial class TransactionsOperations : Microsoft.Rest.IServiceOperations, ITransactionsOperations + { + /// + /// Initializes a new instance of the TransactionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal TransactionsOperations (BillingManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the BillingManagementClient + /// + public BillingManagementClient Client { get; private set; } + + /// + /// Lists the transactions for an invoice. Transactions include purchases, + /// refunds and Azure usage charges. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListByInvoiceWithHttpMessagesAsync(string billingAccountName, string invoiceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (billingAccountName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "billingAccountName"); + } + + if (invoiceName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "invoiceName"); + } + + string apiVersion = "2020-05-01"; + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("billingAccountName", billingAccountName); + tracingParameters.Add("invoiceName", invoiceName); + tracingParameters.Add("apiVersion", apiVersion); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByInvoice", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/transactions").ToString(); + _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName)); + _url = _url.Replace("{invoiceName}", System.Uri.EscapeDataString(invoiceName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists the transactions for an invoice. Transactions include purchases, + /// refunds and Azure usage charges. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task>> ListByInvoiceNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByInvoiceNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/Generated/TransactionsOperationsExtensions.cs b/src/Billing/Billing.Management.Sdk/Generated/TransactionsOperationsExtensions.cs new file mode 100644 index 000000000000..a04be1b5cf70 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Generated/TransactionsOperationsExtensions.cs @@ -0,0 +1,92 @@ +// 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.Azure; + using Models; + + /// + /// Extension methods for TransactionsOperations + /// + public static partial class TransactionsOperationsExtensions + { + /// + /// Lists the transactions for an invoice. Transactions include purchases, + /// refunds and Azure usage charges. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + public static Microsoft.Rest.Azure.IPage ListByInvoice(this ITransactionsOperations operations, string billingAccountName, string invoiceName) + { + return ((ITransactionsOperations)operations).ListByInvoiceAsync(billingAccountName, invoiceName).GetAwaiter().GetResult(); + } + + /// + /// Lists the transactions for an invoice. Transactions include purchases, + /// refunds and Azure usage charges. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID that uniquely identifies a billing account. + /// + /// + /// The ID that uniquely identifies an invoice. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByInvoiceAsync(this ITransactionsOperations operations, string billingAccountName, string invoiceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByInvoiceWithHttpMessagesAsync(billingAccountName, invoiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists the transactions for an invoice. Transactions include purchases, + /// refunds and Azure usage charges. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByInvoiceNext(this ITransactionsOperations operations, string nextPageLink) + { + return ((ITransactionsOperations)operations).ListByInvoiceNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the transactions for an invoice. Transactions include purchases, + /// refunds and Azure usage charges. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByInvoiceNextAsync(this ITransactionsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByInvoiceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/Billing/Billing.Management.Sdk/Properties/AssemblyInfo.cs b/src/Billing/Billing.Management.Sdk/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..9b851f0e0fc5 --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/Properties/AssemblyInfo.cs @@ -0,0 +1,29 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("Microsoft Azure Powershell - Billing Management SDK")] +[assembly: AssemblyCompany(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCompany)] +[assembly: AssemblyProduct(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyProduct)] +[assembly: AssemblyCopyright(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCopyright)] + +[assembly: ComVisible(false)] +[assembly: CLSCompliant(false)] + +[assembly: AssemblyVersion("4.0.0.0")] +[assembly: AssemblyFileVersion("4.1.0.0")] \ No newline at end of file diff --git a/src/Billing/Billing.Management.Sdk/README.md b/src/Billing/Billing.Management.Sdk/README.md new file mode 100644 index 000000000000..243cd1b8aa7b --- /dev/null +++ b/src/Billing/Billing.Management.Sdk/README.md @@ -0,0 +1,34 @@ +# Overall +This directory contains management plane service clients of Az.Storage module. + +## Run Generation +In this directory, run AutoRest: +``` +autorest --reset +autorest --use:@autorest/powershell@4.x +``` + +### AutoRest Configuration +> see https://aka.ms/autorest +``` yaml +isSdkGenerator: true +powershell: true +clear-output-folder: true +reflect-api-versions: true +openapi-type: arm +azure-arm: true +license-header: MICROSOFT_MIT_NO_VERSION +payload-flattening-threshold: 0 +``` + +### +``` yaml +commit: bfd326ea58084517f8e9cb2e6bdbcb0c400f6370 +input-file: + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/billing.json + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/billing/resource-manager/Microsoft.Billing/preview/2018-03-01-preview/billingV2.json + +output-folder: Generated + +namespace: Microsoft.Azure.Management.Billing +``` \ No newline at end of file diff --git a/src/Billing/Billing.Test/Billing.Test.csproj b/src/Billing/Billing.Test/Billing.Test.csproj index d8407996b96a..ed59d32342f1 100644 --- a/src/Billing/Billing.Test/Billing.Test.csproj +++ b/src/Billing/Billing.Test/Billing.Test.csproj @@ -11,7 +11,7 @@ - + \ No newline at end of file diff --git a/src/Billing/Billing.sln b/src/Billing/Billing.sln index 830f1f135255..e916a6a3f578 100644 --- a/src/Billing/Billing.sln +++ b/src/Billing/Billing.sln @@ -5,42 +5,41 @@ VisualStudioVersion = 17.0.31903.59 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Accounts", "Accounts", "{311A44F7-E3F9-4D2B-AC76-5C10BB3447F9}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Accounts", "..\Accounts\Accounts\Accounts.csproj", "{B41714D2-DAAA-49D0-940C-D26056956572}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Accounts", "..\Accounts\Accounts\Accounts.csproj", "{B41714D2-DAAA-49D0-940C-D26056956572}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssemblyLoading", "..\Accounts\AssemblyLoading\AssemblyLoading.csproj", "{C54A7430-DB21-4A10-AA15-2529FC3A6A5F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AssemblyLoading", "..\Accounts\AssemblyLoading\AssemblyLoading.csproj", "{C54A7430-DB21-4A10-AA15-2529FC3A6A5F}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication.ResourceManager", "..\Accounts\Authentication.ResourceManager\Authentication.ResourceManager.csproj", "{257DBAA6-F0C7-41AA-810E-B3EB0FC5A14E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authentication.ResourceManager", "..\Accounts\Authentication.ResourceManager\Authentication.ResourceManager.csproj", "{257DBAA6-F0C7-41AA-810E-B3EB0FC5A14E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication", "..\Accounts\Authentication\Authentication.csproj", "{10851341-36EB-4DE6-BF05-AF35BFEAD64C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authentication", "..\Accounts\Authentication\Authentication.csproj", "{10851341-36EB-4DE6-BF05-AF35BFEAD64C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AuthenticationAssemblyLoadContext", "..\Accounts\AuthenticationAssemblyLoadContext\AuthenticationAssemblyLoadContext.csproj", "{CEDEA167-925D-4806-AA23-09E874C5C6A0}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AuthenticationAssemblyLoadContext", "..\Accounts\AuthenticationAssemblyLoadContext\AuthenticationAssemblyLoadContext.csproj", "{CEDEA167-925D-4806-AA23-09E874C5C6A0}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authenticators", "..\Accounts\Authenticators\Authenticators.csproj", "{9FB12028-0B88-429D-8CEF-AAE313818C49}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authenticators", "..\Accounts\Authenticators\Authenticators.csproj", "{9FB12028-0B88-429D-8CEF-AAE313818C49}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{D91557EF-D059-4FFB-86B1-BE1E567C56E8}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Billing.Test", "Billing.Test\Billing.Test.csproj", "{8DE30CD1-B2A6-43C2-A4D3-60E14C0CBCD9}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Billing.Test", "Billing.Test\Billing.Test.csproj", "{8DE30CD1-B2A6-43C2-A4D3-60E14C0CBCD9}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Billing", "Billing\Billing.csproj", "{FDED408F-D9BA-4B98-9CE4-DF89D6991151}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Billing", "Billing\Billing.csproj", "{FDED408F-D9BA-4B98-9CE4-DF89D6991151}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Consumption.Test", "Consumption.Test\Consumption.Test.csproj", "{F56BCD91-DC54-448A-972C-4CB3A755D6BB}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Consumption.Test", "Consumption.Test\Consumption.Test.csproj", "{F56BCD91-DC54-448A-972C-4CB3A755D6BB}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Consumption", "Consumption\Consumption.csproj", "{3BFAF07F-070D-4833-A4E4-8B547FC0C65A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Consumption", "Consumption\Consumption.csproj", "{3BFAF07F-070D-4833-A4E4-8B547FC0C65A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UsageAggregates.Test", "UsageAggregates.Test\UsageAggregates.Test.csproj", "{FB24E8D0-36A2-4138-A567-8B9CE3920E57}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UsageAggregates.Test", "UsageAggregates.Test\UsageAggregates.Test.csproj", "{FB24E8D0-36A2-4138-A567-8B9CE3920E57}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UsageAggregates", "UsageAggregates\UsageAggregates.csproj", "{F06B0A62-71FF-43A9-800D-A390844682E5}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UsageAggregates", "UsageAggregates\UsageAggregates.csproj", "{F06B0A62-71FF-43A9-800D-A390844682E5}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestFx", "..\..\tools\TestFx\TestFx.csproj", "{DC961B46-3B4E-4094-BCD5-C6A5DA300597}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestFx", "..\..\tools\TestFx\TestFx.csproj", "{DC961B46-3B4E-4094-BCD5-C6A5DA300597}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Billing.Management.Sdk", "Billing.Management.Sdk\Billing.Management.Sdk.csproj", "{162555C6-2861-4C0A-879F-1BF3BBFDB281}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {B41714D2-DAAA-49D0-940C-D26056956572}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B41714D2-DAAA-49D0-940C-D26056956572}.Debug|Any CPU.Build.0 = Debug|Any CPU @@ -94,6 +93,13 @@ Global {DC961B46-3B4E-4094-BCD5-C6A5DA300597}.Debug|Any CPU.Build.0 = Debug|Any CPU {DC961B46-3B4E-4094-BCD5-C6A5DA300597}.Release|Any CPU.ActiveCfg = Release|Any CPU {DC961B46-3B4E-4094-BCD5-C6A5DA300597}.Release|Any CPU.Build.0 = Release|Any CPU + {162555C6-2861-4C0A-879F-1BF3BBFDB281}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {162555C6-2861-4C0A-879F-1BF3BBFDB281}.Debug|Any CPU.Build.0 = Debug|Any CPU + {162555C6-2861-4C0A-879F-1BF3BBFDB281}.Release|Any CPU.ActiveCfg = Release|Any CPU + {162555C6-2861-4C0A-879F-1BF3BBFDB281}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {B41714D2-DAAA-49D0-940C-D26056956572} = {311A44F7-E3F9-4D2B-AC76-5C10BB3447F9} diff --git a/src/Billing/Billing/Az.Billing.psd1 b/src/Billing/Billing/Az.Billing.psd1 index 2562dbccaf3f..a21dd3ff097b 100644 --- a/src/Billing/Billing/Az.Billing.psd1 +++ b/src/Billing/Billing/Az.Billing.psd1 @@ -57,7 +57,7 @@ RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '4.0.1'; }) # Assemblies that must be loaded prior to importing this module RequiredAssemblies = 'Microsoft.Azure.Commerce.UsageAggregates.dll', - 'Microsoft.Azure.Management.Billing.dll', + 'Microsoft.Azure.PowerShell.Billing.Management.Sdk.dll', 'Microsoft.Azure.Management.Consumption.dll' # Script files (.ps1) that are run in the caller's environment prior to importing this module. diff --git a/src/Billing/Billing/Billing.csproj b/src/Billing/Billing/Billing.csproj index d071144e34ea..f05a2c4003de 100644 --- a/src/Billing/Billing/Billing.csproj +++ b/src/Billing/Billing/Billing.csproj @@ -11,7 +11,7 @@ - + diff --git a/src/Billing/Billing/ChangeLog.md b/src/Billing/Billing/ChangeLog.md index 893a43543369..8e0a3ee12f85 100644 --- a/src/Billing/Billing/ChangeLog.md +++ b/src/Billing/Billing/ChangeLog.md @@ -18,6 +18,7 @@ - Additional information about change #1 --> ## Upcoming Release +* Removed "Microsoft.Azure.Management.Billing" Version "4.1.0" PackageReference ## Version 2.2.0 * Upgraded nuget package to signed package.