diff --git a/src/SDKs/Consumption/AzSdk.RP.props b/src/SDKs/Consumption/AzSdk.RP.props
index d134a7402ab4..871933d6804d 100644
--- a/src/SDKs/Consumption/AzSdk.RP.props
+++ b/src/SDKs/Consumption/AzSdk.RP.props
@@ -1,7 +1,7 @@
- Billing_2018-11-01-preview;Consumption_2018-11-01-preview;
+ Billing_2019-04-01-preview;Capacity_2019-04-01-preview;Consumption_2019-04-01-preview;Management_2019-04-01-preview;
$(PackageTags);$(CommonTags);$(AzureApiTag);
\ No newline at end of file
diff --git a/src/SDKs/Consumption/Management.Consumption/Generated/AggregatedCostOperations.cs b/src/SDKs/Consumption/Management.Consumption/Generated/AggregatedCostOperations.cs
new file mode 100644
index 000000000000..06f46593332a
--- /dev/null
+++ b/src/SDKs/Consumption/Management.Consumption/Generated/AggregatedCostOperations.cs
@@ -0,0 +1,433 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Consumption
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Net;
+ using System.Net.Http;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// AggregatedCostOperations operations.
+ ///
+ internal partial class AggregatedCostOperations : IServiceOperations, IAggregatedCostOperations
+ {
+ ///
+ /// Initializes a new instance of the AggregatedCostOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal AggregatedCostOperations(ConsumptionManagementClient client)
+ {
+ if (client == null)
+ {
+ throw new System.ArgumentNullException("client");
+ }
+ Client = client;
+ }
+
+ ///
+ /// Gets a reference to the ConsumptionManagementClient
+ ///
+ public ConsumptionManagementClient Client { get; private set; }
+
+ ///
+ /// Provides the aggregate cost of a management group and all child management
+ /// groups by current billing period.
+ ///
+ ///
+ ///
+ /// Azure Management Group ID.
+ ///
+ ///
+ /// May be used to filter aggregated cost by properties/usageStart (Utc time),
+ /// properties/usageEnd (Utc time). The filter supports 'eq', 'lt', 'gt', 'le',
+ /// 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag
+ /// filter is a key value pair string where key and value is separated by a
+ /// colon (:).
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> GetByManagementGroupWithHttpMessagesAsync(string managementGroupId, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (managementGroupId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "managementGroupId");
+ }
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("managementGroupId", managementGroupId);
+ tracingParameters.Add("filter", filter);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "GetByManagementGroup", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Consumption/aggregatedcost").ToString();
+ _url = _url.Replace("{managementGroupId}", System.Uri.EscapeDataString(managementGroupId));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (filter != null)
+ {
+ _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Provides the aggregate cost of a management group and all child management
+ /// groups by specified billing period
+ ///
+ ///
+ ///
+ /// Azure Management Group ID.
+ ///
+ ///
+ /// Billing Period Name.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> GetForBillingPeriodByManagementGroupWithHttpMessagesAsync(string managementGroupId, string billingPeriodName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (managementGroupId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "managementGroupId");
+ }
+ if (billingPeriodName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "billingPeriodName");
+ }
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("managementGroupId", managementGroupId);
+ tracingParameters.Add("billingPeriodName", billingPeriodName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "GetForBillingPeriodByManagementGroup", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/Microsoft.Consumption/aggregatedcost").ToString();
+ _url = _url.Replace("{managementGroupId}", System.Uri.EscapeDataString(managementGroupId));
+ _url = _url.Replace("{billingPeriodName}", System.Uri.EscapeDataString(billingPeriodName));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ }
+}
diff --git a/src/SDKs/Consumption/Management.Consumption/Generated/AggregatedCostOperationsExtensions.cs b/src/SDKs/Consumption/Management.Consumption/Generated/AggregatedCostOperationsExtensions.cs
new file mode 100644
index 000000000000..d3dc3db417f7
--- /dev/null
+++ b/src/SDKs/Consumption/Management.Consumption/Generated/AggregatedCostOperationsExtensions.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.Consumption
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// Extension methods for AggregatedCostOperations.
+ ///
+ public static partial class AggregatedCostOperationsExtensions
+ {
+ ///
+ /// Provides the aggregate cost of a management group and all child management
+ /// groups by current billing period.
+ ///
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Azure Management Group ID.
+ ///
+ ///
+ /// May be used to filter aggregated cost by properties/usageStart (Utc time),
+ /// properties/usageEnd (Utc time). The filter supports 'eq', 'lt', 'gt', 'le',
+ /// 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag
+ /// filter is a key value pair string where key and value is separated by a
+ /// colon (:).
+ ///
+ public static ManagementGroupAggregatedCostResult GetByManagementGroup(this IAggregatedCostOperations operations, string managementGroupId, string filter = default(string))
+ {
+ return operations.GetByManagementGroupAsync(managementGroupId, filter).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Provides the aggregate cost of a management group and all child management
+ /// groups by current billing period.
+ ///
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Azure Management Group ID.
+ ///
+ ///
+ /// May be used to filter aggregated cost by properties/usageStart (Utc time),
+ /// properties/usageEnd (Utc time). The filter supports 'eq', 'lt', 'gt', 'le',
+ /// 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag
+ /// filter is a key value pair string where key and value is separated by a
+ /// colon (:).
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task GetByManagementGroupAsync(this IAggregatedCostOperations operations, string managementGroupId, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.GetByManagementGroupWithHttpMessagesAsync(managementGroupId, filter, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Provides the aggregate cost of a management group and all child management
+ /// groups by specified billing period
+ ///
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Azure Management Group ID.
+ ///
+ ///
+ /// Billing Period Name.
+ ///
+ public static ManagementGroupAggregatedCostResult GetForBillingPeriodByManagementGroup(this IAggregatedCostOperations operations, string managementGroupId, string billingPeriodName)
+ {
+ return operations.GetForBillingPeriodByManagementGroupAsync(managementGroupId, billingPeriodName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Provides the aggregate cost of a management group and all child management
+ /// groups by specified billing period
+ ///
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Azure Management Group ID.
+ ///
+ ///
+ /// Billing Period Name.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task GetForBillingPeriodByManagementGroupAsync(this IAggregatedCostOperations operations, string managementGroupId, string billingPeriodName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.GetForBillingPeriodByManagementGroupWithHttpMessagesAsync(managementGroupId, billingPeriodName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ }
+}
diff --git a/src/SDKs/Consumption/Management.Consumption/Generated/ChargesByBillingProfileOperations.cs b/src/SDKs/Consumption/Management.Consumption/Generated/BalancesOperations.cs
similarity index 50%
rename from src/SDKs/Consumption/Management.Consumption/Generated/ChargesByBillingProfileOperations.cs
rename to src/SDKs/Consumption/Management.Consumption/Generated/BalancesOperations.cs
index cca6ddd6ea9c..82d6e57578be 100644
--- a/src/SDKs/Consumption/Management.Consumption/Generated/ChargesByBillingProfileOperations.cs
+++ b/src/SDKs/Consumption/Management.Consumption/Generated/BalancesOperations.cs
@@ -23,12 +23,12 @@ namespace Microsoft.Azure.Management.Consumption
using System.Threading.Tasks;
///
- /// ChargesByBillingProfileOperations operations.
+ /// BalancesOperations operations.
///
- internal partial class ChargesByBillingProfileOperations : IServiceOperations, IChargesByBillingProfileOperations
+ internal partial class BalancesOperations : IServiceOperations, IBalancesOperations
{
///
- /// Initializes a new instance of the ChargesByBillingProfileOperations class.
+ /// Initializes a new instance of the BalancesOperations class.
///
///
/// Reference to the service client.
@@ -36,7 +36,7 @@ internal partial class ChargesByBillingProfileOperations : IServiceOperations
/// Thrown when a required parameter is null
///
- internal ChargesByBillingProfileOperations(ConsumptionManagementClient client)
+ internal BalancesOperations(ConsumptionManagementClient client)
{
if (client == null)
{
@@ -51,24 +51,13 @@ internal ChargesByBillingProfileOperations(ConsumptionManagementClient client)
public ConsumptionManagementClient Client { get; private set; }
///
- /// Lists the charges by billing profile id for given start and end date. Start
- /// and end date are used to determine the billing period. For current month,
- /// the data will be provided from month to date. If there are no chages for a
- /// month then that month will show all zeroes.
+ /// Gets the balances for a scope by billingAccountId. Balances are available
+ /// via this API only for May 1, 2014 or later.
///
///
///
/// BillingAccount ID
///
- ///
- /// Billing Profile Id.
- ///
- ///
- /// Start date
- ///
- ///
- /// End date
- ///
///
/// Headers that will be added to request.
///
@@ -90,27 +79,201 @@ internal ChargesByBillingProfileOperations(ConsumptionManagementClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> ListWithHttpMessagesAsync(string billingAccountId, string billingProfileId, string startDate, string endDate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> GetByBillingAccountWithHttpMessagesAsync(string billingAccountId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
if (billingAccountId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountId");
}
- if (billingProfileId == null)
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("billingAccountId", billingAccountId);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "GetByBillingAccount", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/balances").ToString();
+ _url = _url.Replace("{billingAccountId}", System.Uri.EscapeDataString(billingAccountId));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileId");
+ ServiceClientTracing.Exit(_invocationId, _result);
}
+ return _result;
+ }
+
+ ///
+ /// Gets the balances for a scope by billing period and billingAccountId.
+ /// Balances are available via this API only for May 1, 2014 or later.
+ ///
+ ///
+ ///
+ /// BillingAccount ID
+ ///
+ ///
+ /// Billing Period Name.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> GetForBillingPeriodByBillingAccountWithHttpMessagesAsync(string billingAccountId, string billingPeriodName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
if (Client.ApiVersion == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
- if (startDate == null)
+ if (billingAccountId == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "startDate");
+ throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountId");
}
- if (endDate == null)
+ if (billingPeriodName == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "endDate");
+ throw new ValidationException(ValidationRules.CannotBeNull, "billingPeriodName");
}
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
@@ -120,30 +283,20 @@ internal ChargesByBillingProfileOperations(ConsumptionManagementClient client)
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("billingAccountId", billingAccountId);
- tracingParameters.Add("billingProfileId", billingProfileId);
- tracingParameters.Add("startDate", startDate);
- tracingParameters.Add("endDate", endDate);
+ tracingParameters.Add("billingPeriodName", billingPeriodName);
tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "GetForBillingPeriodByBillingAccount", tracingParameters);
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.Consumption/charges").ToString();
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/balances").ToString();
_url = _url.Replace("{billingAccountId}", System.Uri.EscapeDataString(billingAccountId));
- _url = _url.Replace("{billingProfileId}", System.Uri.EscapeDataString(billingProfileId));
+ _url = _url.Replace("{billingPeriodName}", System.Uri.EscapeDataString(billingPeriodName));
List _queryParameters = new List();
if (Client.ApiVersion != null)
{
_queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
}
- if (startDate != null)
- {
- _queryParameters.Add(string.Format("startDate={0}", System.Uri.EscapeDataString(startDate)));
- }
- if (endDate != null)
- {
- _queryParameters.Add(string.Format("endDate={0}", System.Uri.EscapeDataString(endDate)));
- }
if (_queryParameters.Count > 0)
{
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
@@ -232,7 +385,7 @@ internal ChargesByBillingProfileOperations(ConsumptionManagementClient client)
throw ex;
}
// Create Result
- var _result = new AzureOperationResponse();
+ var _result = new AzureOperationResponse();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -245,7 +398,7 @@ internal ChargesByBillingProfileOperations(ConsumptionManagementClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
diff --git a/src/SDKs/Consumption/Management.Consumption/Generated/BalancesOperationsExtensions.cs b/src/SDKs/Consumption/Management.Consumption/Generated/BalancesOperationsExtensions.cs
new file mode 100644
index 000000000000..1f21932cf3ae
--- /dev/null
+++ b/src/SDKs/Consumption/Management.Consumption/Generated/BalancesOperationsExtensions.cs
@@ -0,0 +1,107 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Consumption
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// Extension methods for BalancesOperations.
+ ///
+ public static partial class BalancesOperationsExtensions
+ {
+ ///
+ /// Gets the balances for a scope by billingAccountId. Balances are available
+ /// via this API only for May 1, 2014 or later.
+ ///
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// BillingAccount ID
+ ///
+ public static Balance GetByBillingAccount(this IBalancesOperations operations, string billingAccountId)
+ {
+ return operations.GetByBillingAccountAsync(billingAccountId).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Gets the balances for a scope by billingAccountId. Balances are available
+ /// via this API only for May 1, 2014 or later.
+ ///
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// BillingAccount ID
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task GetByBillingAccountAsync(this IBalancesOperations operations, string billingAccountId, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.GetByBillingAccountWithHttpMessagesAsync(billingAccountId, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Gets the balances for a scope by billing period and billingAccountId.
+ /// Balances are available via this API only for May 1, 2014 or later.
+ ///
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// BillingAccount ID
+ ///
+ ///
+ /// Billing Period Name.
+ ///
+ public static Balance GetForBillingPeriodByBillingAccount(this IBalancesOperations operations, string billingAccountId, string billingPeriodName)
+ {
+ return operations.GetForBillingPeriodByBillingAccountAsync(billingAccountId, billingPeriodName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Gets the balances for a scope by billing period and billingAccountId.
+ /// Balances are available via this API only for May 1, 2014 or later.
+ ///
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// BillingAccount ID
+ ///
+ ///
+ /// Billing Period Name.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task GetForBillingPeriodByBillingAccountAsync(this IBalancesOperations operations, string billingAccountId, string billingPeriodName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.GetForBillingPeriodByBillingAccountWithHttpMessagesAsync(billingAccountId, billingPeriodName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ }
+}
diff --git a/src/SDKs/Consumption/Management.Consumption/Generated/BillingProfilePricesheetOperations.cs b/src/SDKs/Consumption/Management.Consumption/Generated/BillingProfilePricesheetOperations.cs
deleted file mode 100644
index e635f89f2539..000000000000
--- a/src/SDKs/Consumption/Management.Consumption/Generated/BillingProfilePricesheetOperations.cs
+++ /dev/null
@@ -1,275 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.Consumption
-{
- using Microsoft.Rest;
- using Microsoft.Rest.Azure;
- using Models;
- using Newtonsoft.Json;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using System.Net;
- using System.Net.Http;
- using System.Threading;
- using System.Threading.Tasks;
-
- ///
- /// BillingProfilePricesheetOperations operations.
- ///
- internal partial class BillingProfilePricesheetOperations : IServiceOperations, IBillingProfilePricesheetOperations
- {
- ///
- /// Initializes a new instance of the BillingProfilePricesheetOperations class.
- ///
- ///
- /// Reference to the service client.
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- internal BillingProfilePricesheetOperations(ConsumptionManagementClient client)
- {
- if (client == null)
- {
- throw new System.ArgumentNullException("client");
- }
- Client = client;
- }
-
- ///
- /// Gets a reference to the ConsumptionManagementClient
- ///
- public ConsumptionManagementClient Client { get; private set; }
-
- ///
- /// Get pricesheet data for invoice id (invoiceName).
- ///
- ///
- /// Azure Billing Account Id.
- ///
- ///
- /// Azure Billing Profile Id.
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- public async Task> DownloadWithHttpMessagesAsync(string billingAccountId, string billingProfileId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- // Send request
- AzureOperationResponse _response = await BeginDownloadWithHttpMessagesAsync(billingAccountId, billingProfileId, customHeaders, cancellationToken).ConfigureAwait(false);
- return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
- }
-
- ///
- /// Get pricesheet data for invoice id (invoiceName).
- ///
- ///
- /// Azure Billing Account Id.
- ///
- ///
- /// Azure Billing Profile Id.
- ///
- ///
- /// Headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when unable to deserialize the response
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// A response object containing the response body and response headers.
- ///
- public async Task> BeginDownloadWithHttpMessagesAsync(string billingAccountId, string billingProfileId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- if (Client.ApiVersion == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
- }
- if (billingAccountId == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountId");
- }
- if (billingProfileId == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileId");
- }
- // Tracing
- bool _shouldTrace = ServiceClientTracing.IsEnabled;
- string _invocationId = null;
- if (_shouldTrace)
- {
- _invocationId = ServiceClientTracing.NextInvocationId.ToString();
- Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("billingAccountId", billingAccountId);
- tracingParameters.Add("billingProfileId", billingProfileId);
- tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "BeginDownload", tracingParameters);
- }
- // Construct URL
- var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Consumption/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/pricesheet/default/download").ToString();
- _url = _url.Replace("{billingAccountId}", System.Uri.EscapeDataString(billingAccountId));
- _url = _url.Replace("{billingProfileId}", System.Uri.EscapeDataString(billingProfileId));
- List _queryParameters = new List();
- if (Client.ApiVersion != null)
- {
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
- }
- if (_queryParameters.Count > 0)
- {
- _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
- }
- // Create HTTP transport objects
- var _httpRequest = new HttpRequestMessage();
- HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("POST");
- _httpRequest.RequestUri = new System.Uri(_url);
- // Set Headers
- if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
- {
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
- }
- if (Client.AcceptLanguage != null)
- {
- if (_httpRequest.Headers.Contains("accept-language"))
- {
- _httpRequest.Headers.Remove("accept-language");
- }
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
- }
-
-
- if (customHeaders != null)
- {
- foreach(var _header in customHeaders)
- {
- if (_httpRequest.Headers.Contains(_header.Key))
- {
- _httpRequest.Headers.Remove(_header.Key);
- }
- _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
- }
- }
-
- // Serialize Request
- string _requestContent = null;
- // Set Credentials
- if (Client.Credentials != null)
- {
- cancellationToken.ThrowIfCancellationRequested();
- await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- }
- // Send Request
- if (_shouldTrace)
- {
- ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
- }
- cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- if (_shouldTrace)
- {
- ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
- }
- HttpStatusCode _statusCode = _httpResponse.StatusCode;
- cancellationToken.ThrowIfCancellationRequested();
- string _responseContent = null;
- if ((int)_statusCode != 200 && (int)_statusCode != 202)
- {
- var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- try
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- if (_errorBody != null)
- {
- ex.Body = _errorBody;
- }
- }
- catch (JsonException)
- {
- // Ignore the exception
- }
- ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
- if (_shouldTrace)
- {
- ServiceClientTracing.Error(_invocationId, ex);
- }
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw ex;
- }
- // Create Result
- var _result = new AzureOperationResponse();
- _result.Request = _httpRequest;
- _result.Response = _httpResponse;
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- // Deserialize Response
- if ((int)_statusCode == 200)
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- try
- {
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- }
- catch (JsonException ex)
- {
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
- }
- }
- try
- {
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
- }
- catch (JsonException ex)
- {
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex);
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Exit(_invocationId, _result);
- }
- return _result;
- }
-
- }
-}
diff --git a/src/SDKs/Consumption/Management.Consumption/Generated/BillingProfilePricesheetOperationsExtensions.cs b/src/SDKs/Consumption/Management.Consumption/Generated/BillingProfilePricesheetOperationsExtensions.cs
deleted file mode 100644
index 91a279a79944..000000000000
--- a/src/SDKs/Consumption/Management.Consumption/Generated/BillingProfilePricesheetOperationsExtensions.cs
+++ /dev/null
@@ -1,105 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.Consumption
-{
- using Microsoft.Rest;
- using Microsoft.Rest.Azure;
- using Models;
- using System.Threading;
- using System.Threading.Tasks;
-
- ///
- /// Extension methods for BillingProfilePricesheetOperations.
- ///
- public static partial class BillingProfilePricesheetOperationsExtensions
- {
- ///
- /// Get pricesheet data for invoice id (invoiceName).
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// Azure Billing Account Id.
- ///
- ///
- /// Azure Billing Profile Id.
- ///
- public static PricesheetDownloadResponse Download(this IBillingProfilePricesheetOperations operations, string billingAccountId, string billingProfileId)
- {
- return operations.DownloadAsync(billingAccountId, billingProfileId).GetAwaiter().GetResult();
- }
-
- ///
- /// Get pricesheet data for invoice id (invoiceName).
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// Azure Billing Account Id.
- ///
- ///
- /// Azure Billing Profile Id.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task DownloadAsync(this IBillingProfilePricesheetOperations operations, string billingAccountId, string billingProfileId, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.DownloadWithHttpMessagesAsync(billingAccountId, billingProfileId, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// Get pricesheet data for invoice id (invoiceName).
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// Azure Billing Account Id.
- ///
- ///
- /// Azure Billing Profile Id.
- ///
- public static PricesheetDownloadResponse BeginDownload(this IBillingProfilePricesheetOperations operations, string billingAccountId, string billingProfileId)
- {
- return operations.BeginDownloadAsync(billingAccountId, billingProfileId).GetAwaiter().GetResult();
- }
-
- ///
- /// Get pricesheet data for invoice id (invoiceName).
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// Azure Billing Account Id.
- ///
- ///
- /// Azure Billing Profile Id.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task BeginDownloadAsync(this IBillingProfilePricesheetOperations operations, string billingAccountId, string billingProfileId, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.BeginDownloadWithHttpMessagesAsync(billingAccountId, billingProfileId, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- }
-}
diff --git a/src/SDKs/Consumption/Management.Consumption/Generated/BudgetsOperations.cs b/src/SDKs/Consumption/Management.Consumption/Generated/BudgetsOperations.cs
new file mode 100644
index 000000000000..24145668de18
--- /dev/null
+++ b/src/SDKs/Consumption/Management.Consumption/Generated/BudgetsOperations.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.Consumption
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Net;
+ using System.Net.Http;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// BudgetsOperations operations.
+ ///
+ internal partial class BudgetsOperations : IServiceOperations, IBudgetsOperations
+ {
+ ///
+ /// Initializes a new instance of the BudgetsOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal BudgetsOperations(ConsumptionManagementClient client)
+ {
+ if (client == null)
+ {
+ throw new System.ArgumentNullException("client");
+ }
+ Client = client;
+ }
+
+ ///
+ /// Gets a reference to the ConsumptionManagementClient
+ ///
+ public ConsumptionManagementClient Client { get; private set; }
+
+ ///
+ /// Lists all budgets for the defined scope.
+ ///
+ ///
+ ///
+ /// The scope associated with budget operations. This includes
+ /// '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
+ /// resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
+ /// Billing Account scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}'
+ /// for Department scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
+ /// for EnrollmentAccount scope,
+ /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for
+ /// Management Group scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
+ /// for billingProfile scope,
+ /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListWithHttpMessagesAsync(string scope, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (scope == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "scope");
+ }
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("scope", scope);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Consumption/budgets").ToString();
+ _url = _url.Replace("{scope}", scope);
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Gets the budget for the scope by budget name.
+ ///
+ ///
+ ///
+ /// The scope associated with budget operations. This includes
+ /// '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
+ /// resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
+ /// Billing Account scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}'
+ /// for Department scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
+ /// for EnrollmentAccount scope,
+ /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for
+ /// Management Group scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
+ /// for billingProfile scope,
+ /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope.
+ ///
+ ///
+ /// Budget Name.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> GetWithHttpMessagesAsync(string scope, string budgetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (scope == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "scope");
+ }
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (budgetName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "budgetName");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("scope", scope);
+ tracingParameters.Add("budgetName", budgetName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Consumption/budgets/{budgetName}").ToString();
+ _url = _url.Replace("{scope}", scope);
+ _url = _url.Replace("{budgetName}", System.Uri.EscapeDataString(budgetName));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// The operation to create or update a budget. Update operation requires
+ /// latest eTag to be set in the request mandatorily. You may obtain the latest
+ /// eTag by performing a get operation. Create operation does not require eTag.
+ ///
+ ///
+ ///
+ /// The scope associated with budget operations. This includes
+ /// '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
+ /// resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
+ /// Billing Account scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}'
+ /// for Department scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
+ /// for EnrollmentAccount scope,
+ /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for
+ /// Management Group scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
+ /// for billingProfile scope,
+ /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope.
+ ///
+ ///
+ /// Budget Name.
+ ///
+ ///
+ /// Parameters supplied to the Create Budget operation.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> CreateOrUpdateWithHttpMessagesAsync(string scope, string budgetName, Budget parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (scope == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "scope");
+ }
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (budgetName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "budgetName");
+ }
+ if (parameters == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
+ }
+ if (parameters != null)
+ {
+ parameters.Validate();
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("scope", scope);
+ tracingParameters.Add("budgetName", budgetName);
+ tracingParameters.Add("parameters", parameters);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Consumption/budgets/{budgetName}").ToString();
+ _url = _url.Replace("{scope}", scope);
+ _url = _url.Replace("{budgetName}", System.Uri.EscapeDataString(budgetName));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("PUT");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ if(parameters != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200 && (int)_statusCode != 201)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 201)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// The operation to delete a budget.
+ ///
+ ///
+ ///
+ /// The scope associated with budget operations. This includes
+ /// '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
+ /// resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
+ /// Billing Account scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}'
+ /// for Department scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
+ /// for EnrollmentAccount scope,
+ /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for
+ /// Management Group scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
+ /// for billingProfile scope,
+ /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope.
+ ///
+ ///
+ /// Budget Name.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task DeleteWithHttpMessagesAsync(string scope, string budgetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (scope == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "scope");
+ }
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (budgetName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "budgetName");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("scope", scope);
+ tracingParameters.Add("budgetName", budgetName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Consumption/budgets/{budgetName}").ToString();
+ _url = _url.Replace("{scope}", scope);
+ _url = _url.Replace("{budgetName}", System.Uri.EscapeDataString(budgetName));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("DELETE");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Lists all budgets for the defined scope.
+ ///
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (nextPageLink == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("nextPageLink", nextPageLink);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters);
+ }
+ // Construct URL
+ string _url = "{nextLink}";
+ _url = _url.Replace("{nextLink}", nextPageLink);
+ List _queryParameters = new List();
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ }
+}
diff --git a/src/SDKs/Consumption/Management.Consumption/Generated/BudgetsOperationsExtensions.cs b/src/SDKs/Consumption/Management.Consumption/Generated/BudgetsOperationsExtensions.cs
new file mode 100644
index 000000000000..af57b5143cf4
--- /dev/null
+++ b/src/SDKs/Consumption/Management.Consumption/Generated/BudgetsOperationsExtensions.cs
@@ -0,0 +1,350 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Consumption
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// Extension methods for BudgetsOperations.
+ ///
+ public static partial class BudgetsOperationsExtensions
+ {
+ ///
+ /// Lists all budgets for the defined scope.
+ ///
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The scope associated with budget operations. This includes
+ /// '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
+ /// resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
+ /// Billing Account scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}'
+ /// for Department scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
+ /// for EnrollmentAccount scope,
+ /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for
+ /// Management Group scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
+ /// for billingProfile scope,
+ /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope.
+ ///
+ public static IPage List(this IBudgetsOperations operations, string scope)
+ {
+ return operations.ListAsync(scope).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Lists all budgets for the defined scope.
+ ///
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The scope associated with budget operations. This includes
+ /// '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
+ /// resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
+ /// Billing Account scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}'
+ /// for Department scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
+ /// for EnrollmentAccount scope,
+ /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for
+ /// Management Group scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
+ /// for billingProfile scope,
+ /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListAsync(this IBudgetsOperations operations, string scope, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListWithHttpMessagesAsync(scope, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Gets the budget for the scope by budget name.
+ ///
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The scope associated with budget operations. This includes
+ /// '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
+ /// resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
+ /// Billing Account scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}'
+ /// for Department scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
+ /// for EnrollmentAccount scope,
+ /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for
+ /// Management Group scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
+ /// for billingProfile scope,
+ /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope.
+ ///
+ ///
+ /// Budget Name.
+ ///
+ public static Budget Get(this IBudgetsOperations operations, string scope, string budgetName)
+ {
+ return operations.GetAsync(scope, budgetName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Gets the budget for the scope by budget name.
+ ///
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The scope associated with budget operations. This includes
+ /// '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
+ /// resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
+ /// Billing Account scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}'
+ /// for Department scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
+ /// for EnrollmentAccount scope,
+ /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for
+ /// Management Group scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
+ /// for billingProfile scope,
+ /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope.
+ ///
+ ///
+ /// Budget Name.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task GetAsync(this IBudgetsOperations operations, string scope, string budgetName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.GetWithHttpMessagesAsync(scope, budgetName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// The operation to create or update a budget. Update operation requires
+ /// latest eTag to be set in the request mandatorily. You may obtain the latest
+ /// eTag by performing a get operation. Create operation does not require eTag.
+ ///
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The scope associated with budget operations. This includes
+ /// '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
+ /// resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
+ /// Billing Account scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}'
+ /// for Department scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
+ /// for EnrollmentAccount scope,
+ /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for
+ /// Management Group scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
+ /// for billingProfile scope,
+ /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope.
+ ///
+ ///
+ /// Budget Name.
+ ///
+ ///
+ /// Parameters supplied to the Create Budget operation.
+ ///
+ public static Budget CreateOrUpdate(this IBudgetsOperations operations, string scope, string budgetName, Budget parameters)
+ {
+ return operations.CreateOrUpdateAsync(scope, budgetName, parameters).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// The operation to create or update a budget. Update operation requires
+ /// latest eTag to be set in the request mandatorily. You may obtain the latest
+ /// eTag by performing a get operation. Create operation does not require eTag.
+ ///
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The scope associated with budget operations. This includes
+ /// '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
+ /// resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
+ /// Billing Account scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}'
+ /// for Department scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
+ /// for EnrollmentAccount scope,
+ /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for
+ /// Management Group scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
+ /// for billingProfile scope,
+ /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope.
+ ///
+ ///
+ /// Budget Name.
+ ///
+ ///
+ /// Parameters supplied to the Create Budget operation.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task CreateOrUpdateAsync(this IBudgetsOperations operations, string scope, string budgetName, Budget parameters, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(scope, budgetName, parameters, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// The operation to delete a budget.
+ ///
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The scope associated with budget operations. This includes
+ /// '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
+ /// resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
+ /// Billing Account scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}'
+ /// for Department scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
+ /// for EnrollmentAccount scope,
+ /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for
+ /// Management Group scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
+ /// for billingProfile scope,
+ /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope.
+ ///
+ ///
+ /// Budget Name.
+ ///
+ public static void Delete(this IBudgetsOperations operations, string scope, string budgetName)
+ {
+ operations.DeleteAsync(scope, budgetName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// The operation to delete a budget.
+ ///
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The scope associated with budget operations. This includes
+ /// '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
+ /// resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
+ /// Billing Account scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}'
+ /// for Department scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
+ /// for EnrollmentAccount scope,
+ /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}' for
+ /// Management Group scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
+ /// for billingProfile scope,
+ /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope.
+ ///
+ ///
+ /// Budget Name.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task DeleteAsync(this IBudgetsOperations operations, string scope, string budgetName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ (await operations.DeleteWithHttpMessagesAsync(scope, budgetName, null, cancellationToken).ConfigureAwait(false)).Dispose();
+ }
+
+ ///
+ /// Lists all budgets for the defined scope.
+ ///
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ public static IPage ListNext(this IBudgetsOperations operations, string nextPageLink)
+ {
+ return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Lists all budgets for the defined scope.
+ ///
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListNextAsync(this IBudgetsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ }
+}
diff --git a/src/SDKs/Consumption/Management.Consumption/Generated/ChargesByBillingAccountOperations.cs b/src/SDKs/Consumption/Management.Consumption/Generated/ChargesByBillingAccountOperations.cs
deleted file mode 100644
index b1815d12c0a1..000000000000
--- a/src/SDKs/Consumption/Management.Consumption/Generated/ChargesByBillingAccountOperations.cs
+++ /dev/null
@@ -1,268 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.Consumption
-{
- using Microsoft.Rest;
- using Microsoft.Rest.Azure;
- using Models;
- using Newtonsoft.Json;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using System.Net;
- using System.Net.Http;
- using System.Threading;
- using System.Threading.Tasks;
-
- ///
- /// ChargesByBillingAccountOperations operations.
- ///
- internal partial class ChargesByBillingAccountOperations : IServiceOperations, IChargesByBillingAccountOperations
- {
- ///
- /// Initializes a new instance of the ChargesByBillingAccountOperations class.
- ///
- ///
- /// Reference to the service client.
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- internal ChargesByBillingAccountOperations(ConsumptionManagementClient client)
- {
- if (client == null)
- {
- throw new System.ArgumentNullException("client");
- }
- Client = client;
- }
-
- ///
- /// Gets a reference to the ConsumptionManagementClient
- ///
- public ConsumptionManagementClient Client { get; private set; }
-
- ///
- /// Lists the charges by billingAccountId for given start and end date. Start
- /// and end date are used to determine the billing period. For current month,
- /// the data will be provided from month to date. If there are no chages for a
- /// month then that month will show all zeroes.
- ///
- ///
- ///
- /// BillingAccount ID
- ///
- ///
- /// Start date
- ///
- ///
- /// End date
- ///
- ///
- /// May be used to group charges by properties/billingProfileId, or
- /// properties/invoiceSectionId.
- ///
- ///
- /// Headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when unable to deserialize the response
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// A response object containing the response body and response headers.
- ///
- public async Task> ListWithHttpMessagesAsync(string billingAccountId, string startDate, string endDate, string apply = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- if (billingAccountId == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountId");
- }
- if (Client.ApiVersion == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
- }
- if (startDate == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "startDate");
- }
- if (endDate == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "endDate");
- }
- // Tracing
- bool _shouldTrace = ServiceClientTracing.IsEnabled;
- string _invocationId = null;
- if (_shouldTrace)
- {
- _invocationId = ServiceClientTracing.NextInvocationId.ToString();
- Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("billingAccountId", billingAccountId);
- tracingParameters.Add("startDate", startDate);
- tracingParameters.Add("endDate", endDate);
- tracingParameters.Add("apply", apply);
- tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
- }
- // Construct URL
- var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/charges").ToString();
- _url = _url.Replace("{billingAccountId}", System.Uri.EscapeDataString(billingAccountId));
- List _queryParameters = new List();
- if (Client.ApiVersion != null)
- {
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
- }
- if (startDate != null)
- {
- _queryParameters.Add(string.Format("startDate={0}", System.Uri.EscapeDataString(startDate)));
- }
- if (endDate != null)
- {
- _queryParameters.Add(string.Format("endDate={0}", System.Uri.EscapeDataString(endDate)));
- }
- if (apply != null)
- {
- _queryParameters.Add(string.Format("$apply={0}", System.Uri.EscapeDataString(apply)));
- }
- if (_queryParameters.Count > 0)
- {
- _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
- }
- // Create HTTP transport objects
- var _httpRequest = new HttpRequestMessage();
- HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("GET");
- _httpRequest.RequestUri = new System.Uri(_url);
- // Set Headers
- if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
- {
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
- }
- if (Client.AcceptLanguage != null)
- {
- if (_httpRequest.Headers.Contains("accept-language"))
- {
- _httpRequest.Headers.Remove("accept-language");
- }
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
- }
-
-
- if (customHeaders != null)
- {
- foreach(var _header in customHeaders)
- {
- if (_httpRequest.Headers.Contains(_header.Key))
- {
- _httpRequest.Headers.Remove(_header.Key);
- }
- _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
- }
- }
-
- // Serialize Request
- string _requestContent = null;
- // Set Credentials
- if (Client.Credentials != null)
- {
- cancellationToken.ThrowIfCancellationRequested();
- await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- }
- // Send Request
- if (_shouldTrace)
- {
- ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
- }
- cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- if (_shouldTrace)
- {
- ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
- }
- HttpStatusCode _statusCode = _httpResponse.StatusCode;
- cancellationToken.ThrowIfCancellationRequested();
- string _responseContent = null;
- if ((int)_statusCode != 200)
- {
- var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- try
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- if (_errorBody != null)
- {
- ex.Body = _errorBody;
- }
- }
- catch (JsonException)
- {
- // Ignore the exception
- }
- ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
- if (_shouldTrace)
- {
- ServiceClientTracing.Error(_invocationId, ex);
- }
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw ex;
- }
- // Create Result
- var _result = new AzureOperationResponse();
- _result.Request = _httpRequest;
- _result.Response = _httpResponse;
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- // Deserialize Response
- if ((int)_statusCode == 200)
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- try
- {
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- }
- catch (JsonException ex)
- {
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
- }
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Exit(_invocationId, _result);
- }
- return _result;
- }
-
- }
-}
diff --git a/src/SDKs/Consumption/Management.Consumption/Generated/ChargesByBillingAccountOperationsExtensions.cs b/src/SDKs/Consumption/Management.Consumption/Generated/ChargesByBillingAccountOperationsExtensions.cs
deleted file mode 100644
index 865d0a82b179..000000000000
--- a/src/SDKs/Consumption/Management.Consumption/Generated/ChargesByBillingAccountOperationsExtensions.cs
+++ /dev/null
@@ -1,87 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.Consumption
-{
- using Microsoft.Rest;
- using Microsoft.Rest.Azure;
- using Models;
- using System.Threading;
- using System.Threading.Tasks;
-
- ///
- /// Extension methods for ChargesByBillingAccountOperations.
- ///
- public static partial class ChargesByBillingAccountOperationsExtensions
- {
- ///
- /// Lists the charges by billingAccountId for given start and end date. Start
- /// and end date are used to determine the billing period. For current month,
- /// the data will be provided from month to date. If there are no chages for a
- /// month then that month will show all zeroes.
- ///
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// BillingAccount ID
- ///
- ///
- /// Start date
- ///
- ///
- /// End date
- ///
- ///
- /// May be used to group charges by properties/billingProfileId, or
- /// properties/invoiceSectionId.
- ///
- public static ChargesListByBillingAccount List(this IChargesByBillingAccountOperations operations, string billingAccountId, string startDate, string endDate, string apply = default(string))
- {
- return operations.ListAsync(billingAccountId, startDate, endDate, apply).GetAwaiter().GetResult();
- }
-
- ///
- /// Lists the charges by billingAccountId for given start and end date. Start
- /// and end date are used to determine the billing period. For current month,
- /// the data will be provided from month to date. If there are no chages for a
- /// month then that month will show all zeroes.
- ///
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// BillingAccount ID
- ///
- ///
- /// Start date
- ///
- ///
- /// End date
- ///
- ///
- /// May be used to group charges by properties/billingProfileId, or
- /// properties/invoiceSectionId.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task ListAsync(this IChargesByBillingAccountOperations operations, string billingAccountId, string startDate, string endDate, string apply = default(string), CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.ListWithHttpMessagesAsync(billingAccountId, startDate, endDate, apply, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- }
-}
diff --git a/src/SDKs/Consumption/Management.Consumption/Generated/ChargesByBillingProfileOperationsExtensions.cs b/src/SDKs/Consumption/Management.Consumption/Generated/ChargesByBillingProfileOperationsExtensions.cs
deleted file mode 100644
index 770d5ff2b493..000000000000
--- a/src/SDKs/Consumption/Management.Consumption/Generated/ChargesByBillingProfileOperationsExtensions.cs
+++ /dev/null
@@ -1,85 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.Consumption
-{
- using Microsoft.Rest;
- using Microsoft.Rest.Azure;
- using Models;
- using System.Threading;
- using System.Threading.Tasks;
-
- ///
- /// Extension methods for ChargesByBillingProfileOperations.
- ///
- public static partial class ChargesByBillingProfileOperationsExtensions
- {
- ///
- /// Lists the charges by billing profile id for given start and end date. Start
- /// and end date are used to determine the billing period. For current month,
- /// the data will be provided from month to date. If there are no chages for a
- /// month then that month will show all zeroes.
- ///
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// BillingAccount ID
- ///
- ///
- /// Billing Profile Id.
- ///
- ///
- /// Start date
- ///
- ///
- /// End date
- ///
- public static ChargesListByBillingProfile List(this IChargesByBillingProfileOperations operations, string billingAccountId, string billingProfileId, string startDate, string endDate)
- {
- return operations.ListAsync(billingAccountId, billingProfileId, startDate, endDate).GetAwaiter().GetResult();
- }
-
- ///
- /// Lists the charges by billing profile id for given start and end date. Start
- /// and end date are used to determine the billing period. For current month,
- /// the data will be provided from month to date. If there are no chages for a
- /// month then that month will show all zeroes.
- ///
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// BillingAccount ID
- ///
- ///
- /// Billing Profile Id.
- ///
- ///
- /// Start date
- ///
- ///
- /// End date
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task ListAsync(this IChargesByBillingProfileOperations operations, string billingAccountId, string billingProfileId, string startDate, string endDate, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.ListWithHttpMessagesAsync(billingAccountId, billingProfileId, startDate, endDate, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- }
-}
diff --git a/src/SDKs/Consumption/Management.Consumption/Generated/ChargesByInvoiceSectionOperations.cs b/src/SDKs/Consumption/Management.Consumption/Generated/ChargesByInvoiceSectionOperations.cs
deleted file mode 100644
index 6d0337c8a4eb..000000000000
--- a/src/SDKs/Consumption/Management.Consumption/Generated/ChargesByInvoiceSectionOperations.cs
+++ /dev/null
@@ -1,276 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.Consumption
-{
- using Microsoft.Rest;
- using Microsoft.Rest.Azure;
- using Models;
- using Newtonsoft.Json;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using System.Net;
- using System.Net.Http;
- using System.Threading;
- using System.Threading.Tasks;
-
- ///
- /// ChargesByInvoiceSectionOperations operations.
- ///
- internal partial class ChargesByInvoiceSectionOperations : IServiceOperations, IChargesByInvoiceSectionOperations
- {
- ///
- /// Initializes a new instance of the ChargesByInvoiceSectionOperations class.
- ///
- ///
- /// Reference to the service client.
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- internal ChargesByInvoiceSectionOperations(ConsumptionManagementClient client)
- {
- if (client == null)
- {
- throw new System.ArgumentNullException("client");
- }
- Client = client;
- }
-
- ///
- /// Gets a reference to the ConsumptionManagementClient
- ///
- public ConsumptionManagementClient Client { get; private set; }
-
- ///
- /// Lists the charges by invoice section id for given start and end date. Start
- /// and end date are used to determine the billing period. For current month,
- /// the data will be provided from month to date. If there are no chages for a
- /// month then that month will show all zeroes.
- ///
- ///
- ///
- /// BillingAccount ID
- ///
- ///
- /// Invoice Section Id.
- ///
- ///
- /// Start date
- ///
- ///
- /// End date
- ///
- ///
- /// May be used to group charges by properties/productName.
- ///
- ///
- /// Headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when unable to deserialize the response
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// A response object containing the response body and response headers.
- ///
- public async Task> ListWithHttpMessagesAsync(string billingAccountId, string invoiceSectionId, string startDate, string endDate, string apply = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- if (billingAccountId == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountId");
- }
- if (invoiceSectionId == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionId");
- }
- if (Client.ApiVersion == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
- }
- if (startDate == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "startDate");
- }
- if (endDate == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "endDate");
- }
- // Tracing
- bool _shouldTrace = ServiceClientTracing.IsEnabled;
- string _invocationId = null;
- if (_shouldTrace)
- {
- _invocationId = ServiceClientTracing.NextInvocationId.ToString();
- Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("billingAccountId", billingAccountId);
- tracingParameters.Add("invoiceSectionId", invoiceSectionId);
- tracingParameters.Add("startDate", startDate);
- tracingParameters.Add("endDate", endDate);
- tracingParameters.Add("apply", apply);
- tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
- }
- // Construct URL
- var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}/providers/Microsoft.Consumption/charges").ToString();
- _url = _url.Replace("{billingAccountId}", System.Uri.EscapeDataString(billingAccountId));
- _url = _url.Replace("{invoiceSectionId}", System.Uri.EscapeDataString(invoiceSectionId));
- List _queryParameters = new List();
- if (Client.ApiVersion != null)
- {
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
- }
- if (startDate != null)
- {
- _queryParameters.Add(string.Format("startDate={0}", System.Uri.EscapeDataString(startDate)));
- }
- if (endDate != null)
- {
- _queryParameters.Add(string.Format("endDate={0}", System.Uri.EscapeDataString(endDate)));
- }
- if (apply != null)
- {
- _queryParameters.Add(string.Format("$apply={0}", System.Uri.EscapeDataString(apply)));
- }
- if (_queryParameters.Count > 0)
- {
- _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
- }
- // Create HTTP transport objects
- var _httpRequest = new HttpRequestMessage();
- HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("GET");
- _httpRequest.RequestUri = new System.Uri(_url);
- // Set Headers
- if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
- {
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
- }
- if (Client.AcceptLanguage != null)
- {
- if (_httpRequest.Headers.Contains("accept-language"))
- {
- _httpRequest.Headers.Remove("accept-language");
- }
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
- }
-
-
- if (customHeaders != null)
- {
- foreach(var _header in customHeaders)
- {
- if (_httpRequest.Headers.Contains(_header.Key))
- {
- _httpRequest.Headers.Remove(_header.Key);
- }
- _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
- }
- }
-
- // Serialize Request
- string _requestContent = null;
- // Set Credentials
- if (Client.Credentials != null)
- {
- cancellationToken.ThrowIfCancellationRequested();
- await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- }
- // Send Request
- if (_shouldTrace)
- {
- ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
- }
- cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- if (_shouldTrace)
- {
- ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
- }
- HttpStatusCode _statusCode = _httpResponse.StatusCode;
- cancellationToken.ThrowIfCancellationRequested();
- string _responseContent = null;
- if ((int)_statusCode != 200)
- {
- var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- try
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- if (_errorBody != null)
- {
- ex.Body = _errorBody;
- }
- }
- catch (JsonException)
- {
- // Ignore the exception
- }
- ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
- if (_shouldTrace)
- {
- ServiceClientTracing.Error(_invocationId, ex);
- }
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw ex;
- }
- // Create Result
- var _result = new AzureOperationResponse();
- _result.Request = _httpRequest;
- _result.Response = _httpResponse;
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- // Deserialize Response
- if ((int)_statusCode == 200)
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- try
- {
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- }
- catch (JsonException ex)
- {
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
- }
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Exit(_invocationId, _result);
- }
- return _result;
- }
-
- }
-}
diff --git a/src/SDKs/Consumption/Management.Consumption/Generated/ChargesByInvoiceSectionOperationsExtensions.cs b/src/SDKs/Consumption/Management.Consumption/Generated/ChargesByInvoiceSectionOperationsExtensions.cs
deleted file mode 100644
index a83886630464..000000000000
--- a/src/SDKs/Consumption/Management.Consumption/Generated/ChargesByInvoiceSectionOperationsExtensions.cs
+++ /dev/null
@@ -1,91 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.Consumption
-{
- using Microsoft.Rest;
- using Microsoft.Rest.Azure;
- using Models;
- using System.Threading;
- using System.Threading.Tasks;
-
- ///
- /// Extension methods for ChargesByInvoiceSectionOperations.
- ///
- public static partial class ChargesByInvoiceSectionOperationsExtensions
- {
- ///
- /// Lists the charges by invoice section id for given start and end date. Start
- /// and end date are used to determine the billing period. For current month,
- /// the data will be provided from month to date. If there are no chages for a
- /// month then that month will show all zeroes.
- ///
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// BillingAccount ID
- ///
- ///
- /// Invoice Section Id.
- ///
- ///
- /// Start date
- ///
- ///
- /// End date
- ///
- ///
- /// May be used to group charges by properties/productName.
- ///
- public static ChargesListByInvoiceSection List(this IChargesByInvoiceSectionOperations operations, string billingAccountId, string invoiceSectionId, string startDate, string endDate, string apply = default(string))
- {
- return operations.ListAsync(billingAccountId, invoiceSectionId, startDate, endDate, apply).GetAwaiter().GetResult();
- }
-
- ///
- /// Lists the charges by invoice section id for given start and end date. Start
- /// and end date are used to determine the billing period. For current month,
- /// the data will be provided from month to date. If there are no chages for a
- /// month then that month will show all zeroes.
- ///
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// BillingAccount ID
- ///
- ///
- /// Invoice Section Id.
- ///
- ///
- /// Start date
- ///
- ///
- /// End date
- ///
- ///
- /// May be used to group charges by properties/productName.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task ListAsync(this IChargesByInvoiceSectionOperations operations, string billingAccountId, string invoiceSectionId, string startDate, string endDate, string apply = default(string), CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.ListWithHttpMessagesAsync(billingAccountId, invoiceSectionId, startDate, endDate, apply, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- }
-}
diff --git a/src/SDKs/Consumption/Management.Consumption/Generated/EventsByBillingProfileOperations.cs b/src/SDKs/Consumption/Management.Consumption/Generated/ChargesOperations.cs
similarity index 75%
rename from src/SDKs/Consumption/Management.Consumption/Generated/EventsByBillingProfileOperations.cs
rename to src/SDKs/Consumption/Management.Consumption/Generated/ChargesOperations.cs
index 98aa303a40a8..6f1cd72d0302 100644
--- a/src/SDKs/Consumption/Management.Consumption/Generated/EventsByBillingProfileOperations.cs
+++ b/src/SDKs/Consumption/Management.Consumption/Generated/ChargesOperations.cs
@@ -23,12 +23,12 @@ namespace Microsoft.Azure.Management.Consumption
using System.Threading.Tasks;
///
- /// EventsByBillingProfileOperations operations.
+ /// ChargesOperations operations.
///
- internal partial class EventsByBillingProfileOperations : IServiceOperations, IEventsByBillingProfileOperations
+ internal partial class ChargesOperations : IServiceOperations, IChargesOperations
{
///
- /// Initializes a new instance of the EventsByBillingProfileOperations class.
+ /// Initializes a new instance of the ChargesOperations class.
///
///
/// Reference to the service client.
@@ -36,7 +36,7 @@ internal partial class EventsByBillingProfileOperations : IServiceOperations
/// Thrown when a required parameter is null
///
- internal EventsByBillingProfileOperations(ConsumptionManagementClient client)
+ internal ChargesOperations(ConsumptionManagementClient client)
{
if (client == null)
{
@@ -51,21 +51,26 @@ internal EventsByBillingProfileOperations(ConsumptionManagementClient client)
public ConsumptionManagementClient Client { get; private set; }
///
- /// Lists the events by billingAccountId and billingProfileId for given start
- /// and end date.
+ /// Lists the charges based for the defined scope.
///
///
- ///
- /// BillingAccount ID
+ ///
+ /// The scope associated with usage details operations. This includes
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}'
+ /// for Department scope and
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
+ /// for EnrollmentAccount scope. For department and enrollment accounts, you
+ /// can also add billing period to the scope using
+ /// '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g.
+ /// to specify billing period at department scope use
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'
///
- ///
- /// Billing Profile Id.
- ///
- ///
- /// Start date
- ///
- ///
- /// End date
+ ///
+ /// May be used to filter charges by properties/usageEnd (Utc time),
+ /// properties/usageStart (Utc time). The filter supports 'eq', 'lt', 'gt',
+ /// 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'.
+ /// Tag filter is a key value pair string where key and value is separated by a
+ /// colon (:).
///
///
/// Headers that will be added to request.
@@ -88,28 +93,16 @@ internal EventsByBillingProfileOperations(ConsumptionManagementClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> ListWithHttpMessagesAsync(string billingAccountId, string billingProfileId, string startDate, string endDate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> ListByScopeWithHttpMessagesAsync(string scope, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (billingAccountId == null)
+ if (scope == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountId");
- }
- if (billingProfileId == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "scope");
}
if (Client.ApiVersion == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
- if (startDate == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "startDate");
- }
- if (endDate == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "endDate");
- }
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -117,30 +110,23 @@ internal EventsByBillingProfileOperations(ConsumptionManagementClient client)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("billingAccountId", billingAccountId);
- tracingParameters.Add("billingProfileId", billingProfileId);
- tracingParameters.Add("startDate", startDate);
- tracingParameters.Add("endDate", endDate);
+ tracingParameters.Add("scope", scope);
+ tracingParameters.Add("filter", filter);
tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "ListByScope", tracingParameters);
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.Consumption/events").ToString();
- _url = _url.Replace("{billingAccountId}", System.Uri.EscapeDataString(billingAccountId));
- _url = _url.Replace("{billingProfileId}", System.Uri.EscapeDataString(billingProfileId));
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Consumption/charges").ToString();
+ _url = _url.Replace("{scope}", scope);
List _queryParameters = new List();
if (Client.ApiVersion != null)
{
_queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
}
- if (startDate != null)
- {
- _queryParameters.Add(string.Format("startDate={0}", System.Uri.EscapeDataString(startDate)));
- }
- if (endDate != null)
+ if (filter != null)
{
- _queryParameters.Add(string.Format("endDate={0}", System.Uri.EscapeDataString(endDate)));
+ _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter)));
}
if (_queryParameters.Count > 0)
{
@@ -230,7 +216,7 @@ internal EventsByBillingProfileOperations(ConsumptionManagementClient client)
throw ex;
}
// Create Result
- var _result = new AzureOperationResponse();
+ var _result = new AzureOperationResponse();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -243,7 +229,7 @@ internal EventsByBillingProfileOperations(ConsumptionManagementClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
diff --git a/src/SDKs/Consumption/Management.Consumption/Generated/ChargesOperationsExtensions.cs b/src/SDKs/Consumption/Management.Consumption/Generated/ChargesOperationsExtensions.cs
new file mode 100644
index 000000000000..9183e30378ad
--- /dev/null
+++ b/src/SDKs/Consumption/Management.Consumption/Generated/ChargesOperationsExtensions.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.Consumption
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// Extension methods for ChargesOperations.
+ ///
+ public static partial class ChargesOperationsExtensions
+ {
+ ///
+ /// Lists the charges based for the defined scope.
+ ///
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The scope associated with usage details operations. This includes
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}'
+ /// for Department scope and
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
+ /// for EnrollmentAccount scope. For department and enrollment accounts, you
+ /// can also add billing period to the scope using
+ /// '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g.
+ /// to specify billing period at department scope use
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'
+ ///
+ ///
+ /// May be used to filter charges by properties/usageEnd (Utc time),
+ /// properties/usageStart (Utc time). The filter supports 'eq', 'lt', 'gt',
+ /// 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'.
+ /// Tag filter is a key value pair string where key and value is separated by a
+ /// colon (:).
+ ///
+ public static ChargeSummary ListByScope(this IChargesOperations operations, string scope, string filter = default(string))
+ {
+ return operations.ListByScopeAsync(scope, filter).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Lists the charges based for the defined scope.
+ ///
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The scope associated with usage details operations. This includes
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}'
+ /// for Department scope and
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
+ /// for EnrollmentAccount scope. For department and enrollment accounts, you
+ /// can also add billing period to the scope using
+ /// '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'. For e.g.
+ /// to specify billing period at department scope use
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'
+ ///
+ ///
+ /// May be used to filter charges by properties/usageEnd (Utc time),
+ /// properties/usageStart (Utc time). The filter supports 'eq', 'lt', 'gt',
+ /// 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'.
+ /// Tag filter is a key value pair string where key and value is separated by a
+ /// colon (:).
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task ListByScopeAsync(this IChargesOperations operations, string scope, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListByScopeWithHttpMessagesAsync(scope, filter, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ }
+}
diff --git a/src/SDKs/Consumption/Management.Consumption/Generated/ConsumptionManagementClient.cs b/src/SDKs/Consumption/Management.Consumption/Generated/ConsumptionManagementClient.cs
index 687e86cd013e..5f4ccf5c72a2 100644
--- a/src/SDKs/Consumption/Management.Consumption/Generated/ConsumptionManagementClient.cs
+++ b/src/SDKs/Consumption/Management.Consumption/Generated/ConsumptionManagementClient.cs
@@ -49,10 +49,15 @@ public partial class ConsumptionManagementClient : ServiceClient
/// Version of the API to be used with the client request. The current version
- /// is 2018-11-01-preview.
+ /// is 2019-04-01-preview.
///
public string ApiVersion { get; private set; }
+ ///
+ /// Azure Subscription ID.
+ ///
+ public string SubscriptionId { get; set; }
+
///
/// The preferred language for the response.
///
@@ -72,49 +77,69 @@ public partial class ConsumptionManagementClient : ServiceClient
- /// Gets the IOperations.
+ /// Gets the IUsageDetailsOperations.
///
- public virtual IOperations Operations { get; private set; }
+ public virtual IUsageDetailsOperations UsageDetails { get; private set; }
///
- /// Gets the ICreditSummaryByBillingProfileOperations.
+ /// Gets the IMarketplacesOperations.
///
- public virtual ICreditSummaryByBillingProfileOperations CreditSummaryByBillingProfile { get; private set; }
+ public virtual IMarketplacesOperations Marketplaces { get; private set; }
///
- /// Gets the IEventsByBillingProfileOperations.
+ /// Gets the IBudgetsOperations.
///
- public virtual IEventsByBillingProfileOperations EventsByBillingProfile { get; private set; }
+ public virtual IBudgetsOperations Budgets { get; private set; }
///
- /// Gets the ILotsByBillingProfileOperations.
+ /// Gets the ITagsOperations.
///
- public virtual ILotsByBillingProfileOperations LotsByBillingProfile { get; private set; }
+ public virtual ITagsOperations Tags { get; private set; }
///
- /// Gets the IInvoicePricesheetOperations.
+ /// Gets the IChargesOperations.
///
- public virtual IInvoicePricesheetOperations InvoicePricesheet { get; private set; }
+ public virtual IChargesOperations Charges { get; private set; }
///
- /// Gets the IBillingProfilePricesheetOperations.
+ /// Gets the IBalancesOperations.
///
- public virtual IBillingProfilePricesheetOperations BillingProfilePricesheet { get; private set; }
+ public virtual IBalancesOperations Balances { get; private set; }
///
- /// Gets the IChargesByBillingAccountOperations.
+ /// Gets the IReservationsSummariesOperations.
///
- public virtual IChargesByBillingAccountOperations ChargesByBillingAccount { get; private set; }
+ public virtual IReservationsSummariesOperations ReservationsSummaries { get; private set; }
///
- /// Gets the IChargesByBillingProfileOperations.
+ /// Gets the IReservationsDetailsOperations.
///
- public virtual IChargesByBillingProfileOperations ChargesByBillingProfile { get; private set; }
+ public virtual IReservationsDetailsOperations ReservationsDetails { get; private set; }
+
+ ///
+ /// Gets the IReservationRecommendationsOperations.
+ ///
+ public virtual IReservationRecommendationsOperations ReservationRecommendations { get; private set; }
+
+ ///
+ /// Gets the IPriceSheetOperations.
+ ///
+ public virtual IPriceSheetOperations PriceSheet { get; private set; }
+
+ ///
+ /// Gets the IForecastsOperations.
+ ///
+ public virtual IForecastsOperations Forecasts { get; private set; }
+
+ ///
+ /// Gets the IOperations.
+ ///
+ public virtual IOperations Operations { get; private set; }
///
- /// Gets the IChargesByInvoiceSectionOperations.
+ /// Gets the IAggregatedCostOperations.
///
- public virtual IChargesByInvoiceSectionOperations ChargesByInvoiceSection { get; private set; }
+ public virtual IAggregatedCostOperations AggregatedCost { get; private set; }
///
/// Initializes a new instance of the ConsumptionManagementClient class.
@@ -357,17 +382,21 @@ public ConsumptionManagementClient(System.Uri baseUri, ServiceClientCredentials
///
private void Initialize()
{
+ UsageDetails = new UsageDetailsOperations(this);
+ Marketplaces = new MarketplacesOperations(this);
+ Budgets = new BudgetsOperations(this);
+ Tags = new TagsOperations(this);
+ Charges = new ChargesOperations(this);
+ Balances = new BalancesOperations(this);
+ ReservationsSummaries = new ReservationsSummariesOperations(this);
+ ReservationsDetails = new ReservationsDetailsOperations(this);
+ ReservationRecommendations = new ReservationRecommendationsOperations(this);
+ PriceSheet = new PriceSheetOperations(this);
+ Forecasts = new ForecastsOperations(this);
Operations = new Operations(this);
- CreditSummaryByBillingProfile = new CreditSummaryByBillingProfileOperations(this);
- EventsByBillingProfile = new EventsByBillingProfileOperations(this);
- LotsByBillingProfile = new LotsByBillingProfileOperations(this);
- InvoicePricesheet = new InvoicePricesheetOperations(this);
- BillingProfilePricesheet = new BillingProfilePricesheetOperations(this);
- ChargesByBillingAccount = new ChargesByBillingAccountOperations(this);
- ChargesByBillingProfile = new ChargesByBillingProfileOperations(this);
- ChargesByInvoiceSection = new ChargesByInvoiceSectionOperations(this);
+ AggregatedCost = new AggregatedCostOperations(this);
BaseUri = new System.Uri("https://management.azure.com");
- ApiVersion = "2018-11-01-preview";
+ ApiVersion = "2019-04-01-preview";
AcceptLanguage = "en-US";
LongRunningOperationRetryTimeout = 30;
GenerateClientRequestId = true;
diff --git a/src/SDKs/Consumption/Management.Consumption/Generated/CreditSummaryByBillingProfileOperationsExtensions.cs b/src/SDKs/Consumption/Management.Consumption/Generated/CreditSummaryByBillingProfileOperationsExtensions.cs
deleted file mode 100644
index 5af489d05016..000000000000
--- a/src/SDKs/Consumption/Management.Consumption/Generated/CreditSummaryByBillingProfileOperationsExtensions.cs
+++ /dev/null
@@ -1,69 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.Consumption
-{
- using Microsoft.Rest;
- using Microsoft.Rest.Azure;
- using Models;
- using System.Threading;
- using System.Threading.Tasks;
-
- ///
- /// Extension methods for CreditSummaryByBillingProfileOperations.
- ///
- public static partial class CreditSummaryByBillingProfileOperationsExtensions
- {
- ///
- /// The credit summary by billingAccountId and billingProfileId for given start
- /// and end date.
- ///
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// BillingAccount ID
- ///
- ///
- /// Billing Profile Id.
- ///
- public static CreditSummary Get(this ICreditSummaryByBillingProfileOperations operations, string billingAccountId, string billingProfileId)
- {
- return operations.GetAsync(billingAccountId, billingProfileId).GetAwaiter().GetResult();
- }
-
- ///
- /// The credit summary by billingAccountId and billingProfileId for given start
- /// and end date.
- ///
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// BillingAccount ID
- ///
- ///
- /// Billing Profile Id.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task GetAsync(this ICreditSummaryByBillingProfileOperations operations, string billingAccountId, string billingProfileId, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.GetWithHttpMessagesAsync(billingAccountId, billingProfileId, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- }
-}
diff --git a/src/SDKs/Consumption/Management.Consumption/Generated/EventsByBillingProfileOperationsExtensions.cs b/src/SDKs/Consumption/Management.Consumption/Generated/EventsByBillingProfileOperationsExtensions.cs
deleted file mode 100644
index 5b0ee0a7902e..000000000000
--- a/src/SDKs/Consumption/Management.Consumption/Generated/EventsByBillingProfileOperationsExtensions.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.Consumption
-{
- using Microsoft.Rest;
- using Microsoft.Rest.Azure;
- using Models;
- using System.Threading;
- using System.Threading.Tasks;
-
- ///
- /// Extension methods for EventsByBillingProfileOperations.
- ///
- public static partial class EventsByBillingProfileOperationsExtensions
- {
- ///
- /// Lists the events by billingAccountId and billingProfileId for given start
- /// and end date.
- ///
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// BillingAccount ID
- ///
- ///
- /// Billing Profile Id.
- ///
- ///
- /// Start date
- ///
- ///
- /// End date
- ///
- public static Events List(this IEventsByBillingProfileOperations operations, string billingAccountId, string billingProfileId, string startDate, string endDate)
- {
- return operations.ListAsync(billingAccountId, billingProfileId, startDate, endDate).GetAwaiter().GetResult();
- }
-
- ///
- /// Lists the events by billingAccountId and billingProfileId for given start
- /// and end date.
- ///
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// BillingAccount ID
- ///
- ///
- /// Billing Profile Id.
- ///
- ///
- /// Start date
- ///
- ///
- /// End date
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task ListAsync(this IEventsByBillingProfileOperations operations, string billingAccountId, string billingProfileId, string startDate, string endDate, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.ListWithHttpMessagesAsync(billingAccountId, billingProfileId, startDate, endDate, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- }
-}
diff --git a/src/SDKs/Consumption/Management.Consumption/Generated/LotsByBillingProfileOperations.cs b/src/SDKs/Consumption/Management.Consumption/Generated/ForecastsOperations.cs
similarity index 82%
rename from src/SDKs/Consumption/Management.Consumption/Generated/LotsByBillingProfileOperations.cs
rename to src/SDKs/Consumption/Management.Consumption/Generated/ForecastsOperations.cs
index cb80611cfb72..e6b0aa3b31a4 100644
--- a/src/SDKs/Consumption/Management.Consumption/Generated/LotsByBillingProfileOperations.cs
+++ b/src/SDKs/Consumption/Management.Consumption/Generated/ForecastsOperations.cs
@@ -12,6 +12,7 @@ namespace Microsoft.Azure.Management.Consumption
{
using Microsoft.Rest;
using Microsoft.Rest.Azure;
+ using Microsoft.Rest.Azure.OData;
using Models;
using Newtonsoft.Json;
using System.Collections;
@@ -23,12 +24,12 @@ namespace Microsoft.Azure.Management.Consumption
using System.Threading.Tasks;
///
- /// LotsByBillingProfileOperations operations.
+ /// ForecastsOperations operations.
///
- internal partial class LotsByBillingProfileOperations : IServiceOperations, ILotsByBillingProfileOperations
+ internal partial class ForecastsOperations : IServiceOperations, IForecastsOperations
{
///
- /// Initializes a new instance of the LotsByBillingProfileOperations class.
+ /// Initializes a new instance of the ForecastsOperations class.
///
///
/// Reference to the service client.
@@ -36,7 +37,7 @@ internal partial class LotsByBillingProfileOperations : IServiceOperations
/// Thrown when a required parameter is null
///
- internal LotsByBillingProfileOperations(ConsumptionManagementClient client)
+ internal ForecastsOperations(ConsumptionManagementClient client)
{
if (client == null)
{
@@ -51,15 +52,11 @@ internal LotsByBillingProfileOperations(ConsumptionManagementClient client)
public ConsumptionManagementClient Client { get; private set; }
///
- /// Lists the lots by billingAccountId and billingProfileId for given start and
- /// end date.
+ /// Lists the forecast charges by subscriptionId.
///
///
- ///
- /// BillingAccount ID
- ///
- ///
- /// Billing Profile Id.
+ ///
+ /// OData parameters to apply to the operation.
///
///
/// Headers that will be added to request.
@@ -82,20 +79,16 @@ internal LotsByBillingProfileOperations(ConsumptionManagementClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> ListWithHttpMessagesAsync(string billingAccountId, string billingProfileId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task>> ListWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (billingAccountId == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountId");
- }
- if (billingProfileId == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileId");
- }
if (Client.ApiVersion == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -103,17 +96,23 @@ internal LotsByBillingProfileOperations(ConsumptionManagementClient client)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("billingAccountId", billingAccountId);
- tracingParameters.Add("billingProfileId", billingProfileId);
+ tracingParameters.Add("odataQuery", odataQuery);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}/providers/Microsoft.Consumption/lots").ToString();
- _url = _url.Replace("{billingAccountId}", System.Uri.EscapeDataString(billingAccountId));
- _url = _url.Replace("{billingProfileId}", System.Uri.EscapeDataString(billingProfileId));
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Consumption/forecasts").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
List _queryParameters = new List();
+ if (odataQuery != null)
+ {
+ var _odataFilter = odataQuery.ToString();
+ if (!string.IsNullOrEmpty(_odataFilter))
+ {
+ _queryParameters.Add(_odataFilter);
+ }
+ }
if (Client.ApiVersion != null)
{
_queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
@@ -206,7 +205,7 @@ internal LotsByBillingProfileOperations(ConsumptionManagementClient client)
throw ex;
}
// Create Result
- var _result = new AzureOperationResponse();
+ var _result = new AzureOperationResponse>();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -219,7 +218,7 @@ internal LotsByBillingProfileOperations(ConsumptionManagementClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
diff --git a/src/SDKs/Consumption/Management.Consumption/Generated/LotsByBillingProfileOperationsExtensions.cs b/src/SDKs/Consumption/Management.Consumption/Generated/ForecastsOperationsExtensions.cs
similarity index 53%
rename from src/SDKs/Consumption/Management.Consumption/Generated/LotsByBillingProfileOperationsExtensions.cs
rename to src/SDKs/Consumption/Management.Consumption/Generated/ForecastsOperationsExtensions.cs
index fbaffe1fa149..a131026558b6 100644
--- a/src/SDKs/Consumption/Management.Consumption/Generated/LotsByBillingProfileOperationsExtensions.cs
+++ b/src/SDKs/Consumption/Management.Consumption/Generated/ForecastsOperationsExtensions.cs
@@ -12,54 +12,49 @@ namespace Microsoft.Azure.Management.Consumption
{
using Microsoft.Rest;
using Microsoft.Rest.Azure;
+ using Microsoft.Rest.Azure.OData;
using Models;
+ using System.Collections;
+ using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
///
- /// Extension methods for LotsByBillingProfileOperations.
+ /// Extension methods for ForecastsOperations.
///
- public static partial class LotsByBillingProfileOperationsExtensions
+ public static partial class ForecastsOperationsExtensions
{
///
- /// Lists the lots by billingAccountId and billingProfileId for given start and
- /// end date.
+ /// Lists the forecast charges by subscriptionId.
///
///
///
/// The operations group for this extension method.
///
- ///
- /// BillingAccount ID
+ ///
+ /// OData parameters to apply to the operation.
///
- ///
- /// Billing Profile Id.
- ///
- public static Lots List(this ILotsByBillingProfileOperations operations, string billingAccountId, string billingProfileId)
+ public static IEnumerable List(this IForecastsOperations operations, ODataQuery odataQuery = default(ODataQuery))
{
- return operations.ListAsync(billingAccountId, billingProfileId).GetAwaiter().GetResult();
+ return operations.ListAsync(odataQuery).GetAwaiter().GetResult();
}
///
- /// Lists the lots by billingAccountId and billingProfileId for given start and
- /// end date.
+ /// Lists the forecast charges by subscriptionId.
///
///
///
/// The operations group for this extension method.
///
- ///
- /// BillingAccount ID
- ///
- ///
- /// Billing Profile Id.
+ ///
+ /// OData parameters to apply to the operation.
///
///
/// The cancellation token.
///
- public static async Task ListAsync(this ILotsByBillingProfileOperations operations, string billingAccountId, string billingProfileId, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task> ListAsync(this IForecastsOperations operations, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.ListWithHttpMessagesAsync(billingAccountId, billingProfileId, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.ListWithHttpMessagesAsync(odataQuery, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
diff --git a/src/SDKs/Consumption/Management.Consumption/Generated/IAggregatedCostOperations.cs b/src/SDKs/Consumption/Management.Consumption/Generated/IAggregatedCostOperations.cs
new file mode 100644
index 000000000000..3d10ce32b94d
--- /dev/null
+++ b/src/SDKs/Consumption/Management.Consumption/Generated/IAggregatedCostOperations.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.Consumption
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// AggregatedCostOperations operations.
+ ///
+ public partial interface IAggregatedCostOperations
+ {
+ ///
+ /// Provides the aggregate cost of a management group and all child
+ /// management groups by current billing period.
+ ///
+ ///
+ ///
+ /// Azure Management Group ID.
+ ///
+ ///
+ /// May be used to filter aggregated cost by properties/usageStart (Utc
+ /// time), properties/usageEnd (Utc time). The filter supports 'eq',
+ /// 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support
+ /// 'ne', 'or', or 'not'. Tag filter is a key value pair string where
+ /// key and value is separated by a colon (:).
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> GetByManagementGroupWithHttpMessagesAsync(string managementGroupId, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Provides the aggregate cost of a management group and all child
+ /// management groups by specified billing period
+ ///
+ ///
+ ///
+ /// Azure Management Group ID.
+ ///
+ ///
+ /// Billing Period Name.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> GetForBillingPeriodByManagementGroupWithHttpMessagesAsync(string managementGroupId, string billingPeriodName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ }
+}
diff --git a/src/SDKs/Consumption/Management.Consumption/Generated/IInvoicePricesheetOperations.cs b/src/SDKs/Consumption/Management.Consumption/Generated/IBalancesOperations.cs
similarity index 64%
rename from src/SDKs/Consumption/Management.Consumption/Generated/IInvoicePricesheetOperations.cs
rename to src/SDKs/Consumption/Management.Consumption/Generated/IBalancesOperations.cs
index 6fc082c252f1..b64b92001e05 100644
--- a/src/SDKs/Consumption/Management.Consumption/Generated/IInvoicePricesheetOperations.cs
+++ b/src/SDKs/Consumption/Management.Consumption/Generated/IBalancesOperations.cs
@@ -19,18 +19,17 @@ namespace Microsoft.Azure.Management.Consumption
using System.Threading.Tasks;
///
- /// InvoicePricesheetOperations operations.
+ /// BalancesOperations operations.
///
- public partial interface IInvoicePricesheetOperations
+ public partial interface IBalancesOperations
{
///
- /// Get pricesheet data for invoice id (invoiceName).
+ /// Gets the balances for a scope by billingAccountId. Balances are
+ /// available via this API only for May 1, 2014 or later.
+ ///
///
///
- /// Azure Billing Account Id.
- ///
- ///
- /// The name of an invoice resource.
+ /// BillingAccount ID
///
///
/// The headers that will be added to request.
@@ -47,15 +46,18 @@ public partial interface IInvoicePricesheetOperations
///
/// Thrown when a required parameter is null
///
- Task> DownloadWithHttpMessagesAsync(string billingAccountId, string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ Task> GetByBillingAccountWithHttpMessagesAsync(string billingAccountId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
///
- /// Get pricesheet data for invoice id (invoiceName).
+ /// Gets the balances for a scope by billing period and
+ /// billingAccountId. Balances are available via this API only for May
+ /// 1, 2014 or later.
+ ///
///
///
- /// Azure Billing Account Id.
+ /// BillingAccount ID
///
- ///
- /// The name of an invoice resource.
+ ///
+ /// Billing Period Name.
///
///
/// The headers that will be added to request.
@@ -72,6 +74,6 @@ public partial interface IInvoicePricesheetOperations
///
/// Thrown when a required parameter is null
///
- Task> BeginDownloadWithHttpMessagesAsync(string billingAccountId, string invoiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ Task> GetForBillingPeriodByBillingAccountWithHttpMessagesAsync(string billingAccountId, string billingPeriodName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
}
}
diff --git a/src/SDKs/Consumption/Management.Consumption/Generated/IBudgetsOperations.cs b/src/SDKs/Consumption/Management.Consumption/Generated/IBudgetsOperations.cs
new file mode 100644
index 000000000000..6e5fcfd6f474
--- /dev/null
+++ b/src/SDKs/Consumption/Management.Consumption/Generated/IBudgetsOperations.cs
@@ -0,0 +1,214 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Consumption
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// BudgetsOperations operations.
+ ///
+ public partial interface IBudgetsOperations
+ {
+ ///
+ /// Lists all budgets for the defined scope.
+ ///
+ ///
+ ///
+ /// The scope associated with budget operations. This includes
+ /// '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}'
+ /// for resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}'
+ /// for Billing Account scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}'
+ /// for Department scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
+ /// for EnrollmentAccount scope,
+ /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}'
+ /// for Management Group scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
+ /// for billingProfile scope,
+ /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListWithHttpMessagesAsync(string scope, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Gets the budget for the scope by budget name.
+ ///
+ ///
+ ///
+ /// The scope associated with budget operations. This includes
+ /// '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}'
+ /// for resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}'
+ /// for Billing Account scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}'
+ /// for Department scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
+ /// for EnrollmentAccount scope,
+ /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}'
+ /// for Management Group scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
+ /// for billingProfile scope,
+ /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope.
+ ///
+ ///
+ /// Budget Name.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> GetWithHttpMessagesAsync(string scope, string budgetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// The operation to create or update a budget. Update operation
+ /// requires latest eTag to be set in the request mandatorily. You may
+ /// obtain the latest eTag by performing a get operation. Create
+ /// operation does not require eTag.
+ ///
+ ///
+ ///
+ /// The scope associated with budget operations. This includes
+ /// '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}'
+ /// for resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}'
+ /// for Billing Account scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}'
+ /// for Department scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
+ /// for EnrollmentAccount scope,
+ /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}'
+ /// for Management Group scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
+ /// for billingProfile scope,
+ /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope.
+ ///
+ ///
+ /// Budget Name.
+ ///
+ ///
+ /// Parameters supplied to the Create Budget operation.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> CreateOrUpdateWithHttpMessagesAsync(string scope, string budgetName, Budget parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// The operation to delete a budget.
+ ///
+ ///
+ ///
+ /// The scope associated with budget operations. This includes
+ /// '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}'
+ /// for resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}'
+ /// for Billing Account scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}'
+ /// for Department scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
+ /// for EnrollmentAccount scope,
+ /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}'
+ /// for Management Group scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
+ /// for billingProfile scope,
+ /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope.
+ ///
+ ///
+ /// Budget Name.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task DeleteWithHttpMessagesAsync(string scope, string budgetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Lists all budgets for the defined scope.
+ ///
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ }
+}
diff --git a/src/SDKs/Consumption/Management.Consumption/Generated/IChargesByBillingProfileOperations.cs b/src/SDKs/Consumption/Management.Consumption/Generated/IChargesByBillingProfileOperations.cs
deleted file mode 100644
index ef0aa9745cab..000000000000
--- a/src/SDKs/Consumption/Management.Consumption/Generated/IChargesByBillingProfileOperations.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.Consumption
-{
- using Microsoft.Rest;
- using Microsoft.Rest.Azure;
- using Models;
- using System.Collections;
- using System.Collections.Generic;
- using System.Threading;
- using System.Threading.Tasks;
-
- ///
- /// ChargesByBillingProfileOperations operations.
- ///
- public partial interface IChargesByBillingProfileOperations
- {
- ///
- /// Lists the charges by billing profile id for given start and end
- /// date. Start and end date are used to determine the billing period.
- /// For current month, the data will be provided from month to date. If
- /// there are no chages for a month then that month will show all
- /// zeroes.
- ///
- ///
- ///
- /// BillingAccount ID
- ///
- ///
- /// Billing Profile Id.
- ///
- ///
- /// Start date
- ///
- ///
- /// End date
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when unable to deserialize the response
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- Task> ListWithHttpMessagesAsync(string billingAccountId, string billingProfileId, string startDate, string endDate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- }
-}
diff --git a/src/SDKs/Consumption/Management.Consumption/Generated/IChargesByInvoiceSectionOperations.cs b/src/SDKs/Consumption/Management.Consumption/Generated/IChargesByInvoiceSectionOperations.cs
deleted file mode 100644
index 82deacc0990e..000000000000
--- a/src/SDKs/Consumption/Management.Consumption/Generated/IChargesByInvoiceSectionOperations.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.Consumption
-{
- using Microsoft.Rest;
- using Microsoft.Rest.Azure;
- using Models;
- using System.Collections;
- using System.Collections.Generic;
- using System.Threading;
- using System.Threading.Tasks;
-
- ///
- /// ChargesByInvoiceSectionOperations operations.
- ///
- public partial interface IChargesByInvoiceSectionOperations
- {
- ///
- /// Lists the charges by invoice section id for given start and end
- /// date. Start and end date are used to determine the billing period.
- /// For current month, the data will be provided from month to date. If
- /// there are no chages for a month then that month will show all
- /// zeroes.
- ///
- ///
- ///
- /// BillingAccount ID
- ///
- ///
- /// Invoice Section Id.
- ///
- ///
- /// Start date
- ///
- ///
- /// End date
- ///
- ///
- /// May be used to group charges by properties/productName.
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when unable to deserialize the response
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- Task> ListWithHttpMessagesAsync(string billingAccountId, string invoiceSectionId, string startDate, string endDate, string apply = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- }
-}
diff --git a/src/SDKs/Consumption/Management.Consumption/Generated/IChargesOperations.cs b/src/SDKs/Consumption/Management.Consumption/Generated/IChargesOperations.cs
new file mode 100644
index 000000000000..2504a13be935
--- /dev/null
+++ b/src/SDKs/Consumption/Management.Consumption/Generated/IChargesOperations.cs
@@ -0,0 +1,65 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Consumption
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// ChargesOperations operations.
+ ///
+ public partial interface IChargesOperations
+ {
+ ///
+ /// Lists the charges based for the defined scope.
+ ///
+ ///
+ ///
+ /// The scope associated with usage details operations. This includes
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}'
+ /// for Department scope and
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}'
+ /// for EnrollmentAccount scope. For department and enrollment
+ /// accounts, you can also add billing period to the scope using
+ /// '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'.
+ /// For e.g. to specify billing period at department scope use
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'
+ ///
+ ///
+ /// May be used to filter charges by properties/usageEnd (Utc time),
+ /// properties/usageStart (Utc time). The filter supports 'eq', 'lt',
+ /// 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne',
+ /// 'or', or 'not'. Tag filter is a key value pair string where key and
+ /// value is separated by a colon (:).
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> ListByScopeWithHttpMessagesAsync(string scope, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ }
+}
diff --git a/src/SDKs/Consumption/Management.Consumption/Generated/IConsumptionManagementClient.cs b/src/SDKs/Consumption/Management.Consumption/Generated/IConsumptionManagementClient.cs
index e2c4c4de2e23..e222d81ba322 100644
--- a/src/SDKs/Consumption/Management.Consumption/Generated/IConsumptionManagementClient.cs
+++ b/src/SDKs/Consumption/Management.Consumption/Generated/IConsumptionManagementClient.cs
@@ -43,10 +43,15 @@ public partial interface IConsumptionManagementClient : System.IDisposable
///
/// Version of the API to be used with the client request. The current
- /// version is 2018-11-01-preview.
+ /// version is 2019-04-01-preview.
///
string ApiVersion { get; }
+ ///
+ /// Azure Subscription ID.
+ ///
+ string SubscriptionId { get; set; }
+
///
/// The preferred language for the response.
///
@@ -67,49 +72,69 @@ public partial interface IConsumptionManagementClient : System.IDisposable
///
- /// Gets the IOperations.
+ /// Gets the IUsageDetailsOperations.
///
- IOperations Operations { get; }
+ IUsageDetailsOperations UsageDetails { get; }
///
- /// Gets the ICreditSummaryByBillingProfileOperations.
+ /// Gets the IMarketplacesOperations.
///
- ICreditSummaryByBillingProfileOperations CreditSummaryByBillingProfile { get; }
+ IMarketplacesOperations Marketplaces { get; }
///
- /// Gets the IEventsByBillingProfileOperations.
+ /// Gets the IBudgetsOperations.
///
- IEventsByBillingProfileOperations EventsByBillingProfile { get; }
+ IBudgetsOperations Budgets { get; }
///
- /// Gets the ILotsByBillingProfileOperations.
+ /// Gets the ITagsOperations.
///
- ILotsByBillingProfileOperations LotsByBillingProfile { get; }
+ ITagsOperations Tags { get; }
///
- /// Gets the IInvoicePricesheetOperations.
+ /// Gets the IChargesOperations.
///
- IInvoicePricesheetOperations InvoicePricesheet { get; }
+ IChargesOperations Charges { get; }
///
- /// Gets the IBillingProfilePricesheetOperations.
+ /// Gets the IBalancesOperations.
///
- IBillingProfilePricesheetOperations BillingProfilePricesheet { get; }
+ IBalancesOperations Balances { get; }
///
- /// Gets the IChargesByBillingAccountOperations.
+ /// Gets the IReservationsSummariesOperations.
///
- IChargesByBillingAccountOperations ChargesByBillingAccount { get; }
+ IReservationsSummariesOperations ReservationsSummaries { get; }
///
- /// Gets the IChargesByBillingProfileOperations.
+ /// Gets the IReservationsDetailsOperations.
///
- IChargesByBillingProfileOperations ChargesByBillingProfile { get; }
+ IReservationsDetailsOperations ReservationsDetails { get; }
+
+ ///
+ /// Gets the IReservationRecommendationsOperations.
+ ///
+ IReservationRecommendationsOperations ReservationRecommendations { get; }
+
+ ///
+ /// Gets the IPriceSheetOperations.
+ ///
+ IPriceSheetOperations PriceSheet { get; }
+
+ ///
+ /// Gets the IForecastsOperations.
+ ///
+ IForecastsOperations Forecasts { get; }
+
+ ///
+ /// Gets the IOperations.
+ ///
+ IOperations Operations { get; }
///
- /// Gets the IChargesByInvoiceSectionOperations.
+ /// Gets the IAggregatedCostOperations.
///
- IChargesByInvoiceSectionOperations ChargesByInvoiceSection { get; }
+ IAggregatedCostOperations AggregatedCost { get; }
}
}
diff --git a/src/SDKs/Consumption/Management.Consumption/Generated/ICreditSummaryByBillingProfileOperations.cs b/src/SDKs/Consumption/Management.Consumption/Generated/ICreditSummaryByBillingProfileOperations.cs
deleted file mode 100644
index 0cc2ec0c64aa..000000000000
--- a/src/SDKs/Consumption/Management.Consumption/Generated/ICreditSummaryByBillingProfileOperations.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.Consumption
-{
- using Microsoft.Rest;
- using Microsoft.Rest.Azure;
- using Models;
- using System.Collections;
- using System.Collections.Generic;
- using System.Threading;
- using System.Threading.Tasks;
-
- ///
- /// CreditSummaryByBillingProfileOperations operations.
- ///
- public partial interface ICreditSummaryByBillingProfileOperations
- {
- ///
- /// The credit summary by billingAccountId and billingProfileId for
- /// given start and end date.
- ///
- ///
- ///
- /// BillingAccount ID
- ///
- ///
- /// Billing Profile Id.
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when unable to deserialize the response
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- Task> GetWithHttpMessagesAsync(string billingAccountId, string billingProfileId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- }
-}
diff --git a/src/SDKs/Consumption/Management.Consumption/Generated/IEventsByBillingProfileOperations.cs b/src/SDKs/Consumption/Management.Consumption/Generated/IEventsByBillingProfileOperations.cs
deleted file mode 100644
index f9ab85fe602d..000000000000
--- a/src/SDKs/Consumption/Management.Consumption/Generated/IEventsByBillingProfileOperations.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.Consumption
-{
- using Microsoft.Rest;
- using Microsoft.Rest.Azure;
- using Models;
- using System.Collections;
- using System.Collections.Generic;
- using System.Threading;
- using System.Threading.Tasks;
-
- ///
- /// EventsByBillingProfileOperations operations.
- ///
- public partial interface IEventsByBillingProfileOperations
- {
- ///
- /// Lists the events by billingAccountId and billingProfileId for given
- /// start and end date.
- ///
- ///
- ///
- /// BillingAccount ID
- ///
- ///
- /// Billing Profile Id.
- ///
- ///
- /// Start date
- ///
- ///
- /// End date
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when unable to deserialize the response
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- Task> ListWithHttpMessagesAsync(string billingAccountId, string billingProfileId, string startDate, string endDate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- }
-}
diff --git a/src/SDKs/Consumption/Management.Consumption/Generated/ILotsByBillingProfileOperations.cs b/src/SDKs/Consumption/Management.Consumption/Generated/IForecastsOperations.cs
similarity index 69%
rename from src/SDKs/Consumption/Management.Consumption/Generated/ILotsByBillingProfileOperations.cs
rename to src/SDKs/Consumption/Management.Consumption/Generated/IForecastsOperations.cs
index b7b03a95a81b..348fe562c412 100644
--- a/src/SDKs/Consumption/Management.Consumption/Generated/ILotsByBillingProfileOperations.cs
+++ b/src/SDKs/Consumption/Management.Consumption/Generated/IForecastsOperations.cs
@@ -12,6 +12,7 @@ namespace Microsoft.Azure.Management.Consumption
{
using Microsoft.Rest;
using Microsoft.Rest.Azure;
+ using Microsoft.Rest.Azure.OData;
using Models;
using System.Collections;
using System.Collections.Generic;
@@ -19,20 +20,16 @@ namespace Microsoft.Azure.Management.Consumption
using System.Threading.Tasks;
///
- /// LotsByBillingProfileOperations operations.
+ /// ForecastsOperations operations.
///
- public partial interface ILotsByBillingProfileOperations
+ public partial interface IForecastsOperations
{
///
- /// Lists the lots by billingAccountId and billingProfileId for given
- /// start and end date.
+ /// Lists the forecast charges by subscriptionId.
///
///
- ///
- /// BillingAccount ID
- ///
- ///
- /// Billing Profile Id.
+ ///
+ /// OData parameters to apply to the operation.
///
///
/// The headers that will be added to request.
@@ -49,6 +46,6 @@ public partial interface ILotsByBillingProfileOperations
///
/// Thrown when a required parameter is null
///
- Task> ListWithHttpMessagesAsync(string billingAccountId, string billingProfileId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ Task>> ListWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
}
}
diff --git a/src/SDKs/Consumption/Management.Consumption/Generated/IMarketplacesOperations.cs b/src/SDKs/Consumption/Management.Consumption/Generated/IMarketplacesOperations.cs
new file mode 100644
index 000000000000..78a4d29037a9
--- /dev/null
+++ b/src/SDKs/Consumption/Management.Consumption/Generated/IMarketplacesOperations.cs
@@ -0,0 +1,103 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Consumption
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Microsoft.Rest.Azure.OData;
+ using Models;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// MarketplacesOperations operations.
+ ///
+ public partial interface IMarketplacesOperations
+ {
+ ///
+ /// Lists the marketplaces for a scope at the defined scope.
+ /// Marketplaces are available via this API only for May 1, 2014 or
+ /// later.
+ ///
+ ///
+ ///
+ /// The scope associated with marketplace operations. This includes
+ /// '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}'
+ /// for resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}'
+ /// for Billing Account scope,
+ /// '/providers/Microsoft.Billing/departments/{departmentId}' for
+ /// Department scope,
+ /// '/providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}'
+ /// for EnrollmentAccount scope and
+ /// '/providers/Microsoft.Management/managementGroups/{managementGroupId}'
+ /// for Management Group scope. For subscription, billing account,
+ /// department, enrollment account and ManagementGroup, you can also
+ /// add billing period to the scope using
+ /// '/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'.
+ /// For e.g. to specify billing period at department scope use
+ /// '/providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}'
+ ///
+ ///
+ /// OData parameters to apply to the operation.
+ ///
+ ///
+ /// Skiptoken is only used if a previous operation returned a partial
+ /// result. If a previous response contains a nextLink element, the
+ /// value of the nextLink element will include a skiptoken parameter
+ /// that specifies a starting point to use for subsequent calls.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListWithHttpMessagesAsync(string scope, ODataQuery odataQuery = default(ODataQuery), string skiptoken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Lists the marketplaces for a scope at the defined scope.
+ /// Marketplaces are available via this API only for May 1, 2014 or
+ /// later.
+ ///
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ }
+}
diff --git a/src/SDKs/Consumption/Management.Consumption/Generated/IPriceSheetOperations.cs b/src/SDKs/Consumption/Management.Consumption/Generated/IPriceSheetOperations.cs
new file mode 100644
index 000000000000..06289b05f713
--- /dev/null
+++ b/src/SDKs/Consumption/Management.Consumption/Generated/IPriceSheetOperations.cs
@@ -0,0 +1,101 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Consumption
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// PriceSheetOperations operations.
+ ///
+ public partial interface IPriceSheetOperations
+ {
+ ///
+ /// Gets the price sheet for a scope by subscriptionId. Price sheet is
+ /// available via this API only for May 1, 2014 or later.
+ ///
+ ///
+ ///
+ /// May be used to expand the properties/meterDetails within a price
+ /// sheet. By default, these fields are not included when returning
+ /// price sheet.
+ ///
+ ///
+ /// 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 top N results.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> GetWithHttpMessagesAsync(string expand = default(string), string skiptoken = default(string), int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Get the price sheet for a scope by subscriptionId and billing
+ /// period. Price sheet is available via this API only for May 1, 2014
+ /// or later.
+ ///
+ ///
+ ///
+ /// Billing Period Name.
+ ///
+ ///
+ /// May be used to expand the properties/meterDetails within a price
+ /// sheet. By default, these fields are not included when returning
+ /// price sheet.
+ ///
+ ///
+ /// 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 top N results.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> GetByBillingPeriodWithHttpMessagesAsync(string billingPeriodName, string expand = default(string), string skiptoken = default(string), int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ }
+}
diff --git a/src/SDKs/Consumption/Management.Consumption/Generated/IBillingProfilePricesheetOperations.cs b/src/SDKs/Consumption/Management.Consumption/Generated/IReservationRecommendationsOperations.cs
similarity index 63%
rename from src/SDKs/Consumption/Management.Consumption/Generated/IBillingProfilePricesheetOperations.cs
rename to src/SDKs/Consumption/Management.Consumption/Generated/IReservationRecommendationsOperations.cs
index d60b8b363778..9c9af6f5a790 100644
--- a/src/SDKs/Consumption/Management.Consumption/Generated/IBillingProfilePricesheetOperations.cs
+++ b/src/SDKs/Consumption/Management.Consumption/Generated/IReservationRecommendationsOperations.cs
@@ -19,18 +19,17 @@ namespace Microsoft.Azure.Management.Consumption
using System.Threading.Tasks;
///
- /// BillingProfilePricesheetOperations operations.
+ /// ReservationRecommendationsOperations operations.
///
- public partial interface IBillingProfilePricesheetOperations
+ public partial interface IReservationRecommendationsOperations
{
///
- /// Get pricesheet data for invoice id (invoiceName).
+ /// List of recommendations for purchasing reserved instances.
+ ///
///
- ///
- /// Azure Billing Account Id.
- ///
- ///
- /// Azure Billing Profile Id.
+ ///
+ /// May be used to filter reservationRecommendations by
+ /// properties/scope and properties/lookBackPeriod.
///
///
/// The headers that will be added to request.
@@ -47,15 +46,13 @@ public partial interface IBillingProfilePricesheetOperations
///
/// Thrown when a required parameter is null
///
- Task> DownloadWithHttpMessagesAsync(string billingAccountId, string billingProfileId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ Task>> ListWithHttpMessagesAsync(string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
///
- /// Get pricesheet data for invoice id (invoiceName).
+ /// List of recommendations for purchasing reserved instances.
+ ///
///
- ///
- /// Azure Billing Account Id.
- ///
- ///
- /// Azure Billing Profile Id.
+ ///
+ /// The NextLink from the previous successful call to List operation.
///
///
/// The headers that will be added to request.
@@ -72,6 +69,6 @@ public partial interface IBillingProfilePricesheetOperations
///
/// Thrown when a required parameter is null
///
- Task> BeginDownloadWithHttpMessagesAsync(string billingAccountId, string billingProfileId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
}
}
diff --git a/src/SDKs/Consumption/Management.Consumption/Generated/IReservationsDetailsOperations.cs b/src/SDKs/Consumption/Management.Consumption/Generated/IReservationsDetailsOperations.cs
new file mode 100644
index 000000000000..d3ff2f1edd4d
--- /dev/null
+++ b/src/SDKs/Consumption/Management.Consumption/Generated/IReservationsDetailsOperations.cs
@@ -0,0 +1,130 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Consumption
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// ReservationsDetailsOperations operations.
+ ///
+ public partial interface IReservationsDetailsOperations
+ {
+ ///
+ /// Lists the reservations details for provided date range.
+ ///
+ ///
+ ///
+ /// Order Id of the reservation
+ ///
+ ///
+ /// Filter reservation details by date range. The properties/UsageDate
+ /// for start date and end date. The filter supports 'le' and 'ge'
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListByReservationOrderWithHttpMessagesAsync(string reservationOrderId, string filter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Lists the reservations details for provided date range.
+ ///
+ ///
+ ///
+ /// Order Id of the reservation
+ ///
+ ///
+ /// Id of the reservation
+ ///
+ ///
+ /// Filter reservation details by date range. The properties/UsageDate
+ /// for start date and end date. The filter supports 'le' and 'ge'
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListByReservationOrderAndReservationWithHttpMessagesAsync(string reservationOrderId, string reservationId, string filter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Lists the reservations details for provided date range.
+ ///
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListByReservationOrderNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Lists the reservations details for provided date range.
+ ///
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListByReservationOrderAndReservationNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ }
+}
diff --git a/src/SDKs/Consumption/Management.Consumption/Generated/IReservationsSummariesOperations.cs b/src/SDKs/Consumption/Management.Consumption/Generated/IReservationsSummariesOperations.cs
new file mode 100644
index 000000000000..dc422c9c9743
--- /dev/null
+++ b/src/SDKs/Consumption/Management.Consumption/Generated/IReservationsSummariesOperations.cs
@@ -0,0 +1,138 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Consumption
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// ReservationsSummariesOperations operations.
+ ///
+ public partial interface IReservationsSummariesOperations
+ {
+ ///
+ /// Lists the reservations summaries for daily or monthly grain.
+ ///
+ ///
+ ///
+ /// Order Id of the reservation
+ ///
+ ///
+ /// Can be daily or monthly. Possible values include: 'DailyGrain',
+ /// 'MonthlyGrain'
+ ///
+ ///
+ /// Required only for daily grain. The properties/UsageDate for start
+ /// date and end date. The filter supports 'le' and 'ge'
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListByReservationOrderWithHttpMessagesAsync(string reservationOrderId, string grain, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Lists the reservations summaries for daily or monthly grain.
+ ///
+ ///
+ ///
+ /// Order Id of the reservation
+ ///
+ ///
+ /// Id of the reservation
+ ///
+ ///
+ /// Can be daily or monthly. Possible values include: 'DailyGrain',
+ /// 'MonthlyGrain'
+ ///
+ ///
+ /// Required only for daily grain. The properties/UsageDate for start
+ /// date and end date. The filter supports 'le' and 'ge'
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListByReservationOrderAndReservationWithHttpMessagesAsync(string reservationOrderId, string reservationId, string grain, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Lists the reservations summaries for daily or monthly grain.
+ ///
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListByReservationOrderNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Lists the reservations summaries for daily or monthly grain.
+ ///
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListByReservationOrderAndReservationNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ }
+}
diff --git a/src/SDKs/Consumption/Management.Consumption/Generated/IChargesByBillingAccountOperations.cs b/src/SDKs/Consumption/Management.Consumption/Generated/ITagsOperations.cs
similarity index 55%
rename from src/SDKs/Consumption/Management.Consumption/Generated/IChargesByBillingAccountOperations.cs
rename to src/SDKs/Consumption/Management.Consumption/Generated/ITagsOperations.cs
index 0df31fa1eb97..7ed8213de366 100644
--- a/src/SDKs/Consumption/Management.Consumption/Generated/IChargesByBillingAccountOperations.cs
+++ b/src/SDKs/Consumption/Management.Consumption/Generated/ITagsOperations.cs
@@ -19,30 +19,27 @@ namespace Microsoft.Azure.Management.Consumption
using System.Threading.Tasks;
///
- /// ChargesByBillingAccountOperations operations.
+ /// TagsOperations operations.
///
- public partial interface IChargesByBillingAccountOperations
+ public partial interface ITagsOperations
{
///
- /// Lists the charges by billingAccountId for given start and end date.
- /// Start and end date are used to determine the billing period. For
- /// current month, the data will be provided from month to date. If
- /// there are no chages for a month then that month will show all
- /// zeroes.
+ /// Get all available tag keys for the defined scope
///