From 890e3cbbf788e1fa3ebd44d0d31ba437b539ebec Mon Sep 17 00:00:00 2001
From: "openapi-bot[bot]" <37845953+openapi-bot[bot]@users.noreply.github.com>
Date: Tue, 8 Oct 2019 03:10:48 +0000
Subject: [PATCH] [AutoPR Microsoft.Azure.Management.CostManagement] Supporting
Management Group scope for Exports (#94)
* Update swagger_to_sdk_config.json
* Update swagger_to_sdk_config.json
* Update swagger_to_sdk_config.json
* Update swagger_to_sdk_config.json
* Generated from 967f9659d62a831649ef83f6a52cf2e35dbb87bd
Fixed model validation
---
.../src/Generated/BudgetOperations.cs | 673 ++++++
.../Generated/BudgetOperationsExtensions.cs | 248 +++
.../src/Generated/BudgetsOperations.cs | 416 ++++
.../Generated/BudgetsOperationsExtensions.cs | 127 ++
.../src/Generated/CostManagementClient.cs | 376 ++++
.../src/Generated/IBudgetOperations.cs | 153 ++
.../src/Generated/IBudgetsOperations.cs | 88 +
.../src/Generated/ICostManagementClient.cs | 93 +
.../src/Generated/IOperations.cs | 68 +
.../src/Generated/IViewsOperations.cs | 345 +++
.../src/Generated/Models/AccumulatedType.cs | 22 +
.../src/Generated/Models/BudgetModel.cs | 172 ++
.../src/Generated/Models/BudgetTimePeriod.cs | 71 +
.../src/Generated/Models/CategoryType.cs | 22 +
.../src/Generated/Models/ChartType.cs | 25 +
.../src/Generated/Models/CurrentSpend.cs | 61 +
.../src/Generated/Models/ErrorBase.cs | 69 +
.../src/Generated/Models/ErrorDetails.cs | 79 +
.../src/Generated/Models/ErrorResponse.cs | 52 +
.../Models/ErrorResponseException.cs | 62 +
.../src/Generated/Models/GranularityType.cs | 22 +
.../src/Generated/Models/KpiProperties.cs | 69 +
.../src/Generated/Models/KpiTypeType.cs | 22 +
.../src/Generated/Models/MetricType.cs | 23 +
.../src/Generated/Models/Notification.cs | 147 ++
.../Models/NotificationOperatorType.cs | 23 +
.../src/Generated/Models/Operation.cs | 61 +
.../src/Generated/Models/OperationDisplay.cs | 71 +
.../src/Generated/Models/OperatorType.cs | 22 +
.../src/Generated/Models/Page.cs | 53 +
.../src/Generated/Models/PivotProperties.cs | 61 +
.../src/Generated/Models/PivotTypeType.cs | 22 +
.../src/Generated/Models/ProxyResource.cs | 81 +
.../Models/ReportConfigAggregation.cs | 78 +
.../Models/ReportConfigColumnType.cs | 22 +
.../ReportConfigComparisonExpression.cs | 103 +
.../Generated/Models/ReportConfigDataset.cs | 156 ++
.../ReportConfigDatasetConfiguration.cs | 59 +
.../Generated/Models/ReportConfigFilter.cs | 140 ++
.../Generated/Models/ReportConfigGrouping.cs | 81 +
.../Generated/Models/ReportConfigSorting.cs | 75 +
.../Models/ReportConfigTimePeriod.cs | 70 +
.../src/Generated/Models/Resource.cs | 79 +
.../src/Generated/Models/Scope.cs | 73 +
.../src/Generated/Models/TimeGrainType.cs | 23 +
.../src/Generated/Models/TimeframeType.cs | 24 +
.../src/Generated/Models/View.cs | 245 +++
.../src/Generated/Operations.cs | 390 ++++
.../src/Generated/OperationsExtensions.cs | 87 +
.../Generated/SdkInfo_CostManagementClient.cs | 30 +
.../src/Generated/ViewsOperations.cs | 1944 +++++++++++++++++
.../Generated/ViewsOperationsExtensions.cs | 563 +++++
52 files changed, 8141 insertions(+)
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetOperations.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetOperationsExtensions.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetsOperations.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetsOperationsExtensions.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/CostManagementClient.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IBudgetOperations.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IBudgetsOperations.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ICostManagementClient.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IOperations.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IViewsOperations.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/AccumulatedType.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/BudgetModel.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/BudgetTimePeriod.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/CategoryType.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ChartType.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/CurrentSpend.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorBase.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorDetails.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorResponse.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorResponseException.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/GranularityType.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/KpiProperties.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/KpiTypeType.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/MetricType.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Notification.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/NotificationOperatorType.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Operation.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/OperationDisplay.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/OperatorType.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Page.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/PivotProperties.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/PivotTypeType.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ProxyResource.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigAggregation.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigColumnType.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigComparisonExpression.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigDataset.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigDatasetConfiguration.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigFilter.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigGrouping.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigSorting.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigTimePeriod.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Resource.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Scope.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/TimeGrainType.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/TimeframeType.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/View.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Operations.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/OperationsExtensions.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/SdkInfo_CostManagementClient.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ViewsOperations.cs
create mode 100644 sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ViewsOperationsExtensions.cs
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetOperations.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetOperations.cs
new file mode 100644
index 000000000000..1488b669385c
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetOperations.cs
@@ -0,0 +1,673 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement
+{
+ 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;
+
+ ///
+ /// BudgetOperations operations.
+ ///
+ internal partial class BudgetOperations : IServiceOperations, IBudgetOperations
+ {
+ ///
+ /// Initializes a new instance of the BudgetOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal BudgetOperations(CostManagementClient client)
+ {
+ if (client == null)
+ {
+ throw new System.ArgumentNullException("client");
+ }
+ Client = client;
+ }
+
+ ///
+ /// Gets a reference to the CostManagementClient
+ ///
+ public CostManagementClient Client { get; private set; }
+
+ ///
+ /// 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.CostManagement/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, BudgetModel parameters = default(BudgetModel), 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)
+ {
+ 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.CostManagement/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.CostManagement/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 && (int)_statusCode != 204)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetOperationsExtensions.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetOperationsExtensions.cs
new file mode 100644
index 000000000000..5919a270dc00
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetOperationsExtensions.cs
@@ -0,0 +1,248 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// Extension methods for BudgetOperations.
+ ///
+ public static partial class BudgetOperationsExtensions
+ {
+ ///
+ /// 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 BudgetModel Get(this IBudgetOperations 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 IBudgetOperations 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 BudgetModel CreateOrUpdate(this IBudgetOperations operations, string scope, string budgetName, BudgetModel parameters = default(BudgetModel))
+ {
+ 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 IBudgetOperations operations, string scope, string budgetName, BudgetModel parameters = default(BudgetModel), 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 IBudgetOperations 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 IBudgetOperations operations, string scope, string budgetName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ (await operations.DeleteWithHttpMessagesAsync(scope, budgetName, null, cancellationToken).ConfigureAwait(false)).Dispose();
+ }
+
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetsOperations.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetsOperations.cs
new file mode 100644
index 000000000000..740ee449c11c
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetsOperations.cs
@@ -0,0 +1,416 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement
+{
+ 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(CostManagementClient client)
+ {
+ if (client == null)
+ {
+ throw new System.ArgumentNullException("client");
+ }
+ Client = client;
+ }
+
+ ///
+ /// Gets a reference to the CostManagementClient
+ ///
+ public CostManagementClient 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.CostManagement/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;
+ }
+
+ ///
+ /// 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/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetsOperationsExtensions.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetsOperationsExtensions.cs
new file mode 100644
index 000000000000..49ef9a595787
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/BudgetsOperationsExtensions.cs
@@ -0,0 +1,127 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement
+{
+ 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;
+ }
+ }
+
+ ///
+ /// 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/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/CostManagementClient.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/CostManagementClient.cs
new file mode 100644
index 000000000000..8ff8db2530de
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/CostManagementClient.cs
@@ -0,0 +1,376 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Microsoft.Rest.Serialization;
+ using Models;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Net;
+ using System.Net.Http;
+
+ public partial class CostManagementClient : ServiceClient, ICostManagementClient, IAzureClient
+ {
+ ///
+ /// The base URI of the service.
+ ///
+ public System.Uri BaseUri { get; set; }
+
+ ///
+ /// Gets or sets json serialization settings.
+ ///
+ public JsonSerializerSettings SerializationSettings { get; private set; }
+
+ ///
+ /// Gets or sets json deserialization settings.
+ ///
+ public JsonSerializerSettings DeserializationSettings { get; private set; }
+
+ ///
+ /// Credentials needed for the client to connect to Azure.
+ ///
+ public ServiceClientCredentials Credentials { get; private set; }
+
+ ///
+ /// Version of the API to be used with the client request. The current version
+ /// 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.
+ ///
+ public string AcceptLanguage { get; set; }
+
+ ///
+ /// The retry timeout in seconds for Long Running Operations. Default value is
+ /// 30.
+ ///
+ public int? LongRunningOperationRetryTimeout { get; set; }
+
+ ///
+ /// Whether a unique x-ms-client-request-id should be generated. When set to
+ /// true a unique x-ms-client-request-id value is generated and included in
+ /// each request. Default is true.
+ ///
+ public bool? GenerateClientRequestId { get; set; }
+
+ ///
+ /// Gets the IViewsOperations.
+ ///
+ public virtual IViewsOperations Views { get; private set; }
+
+ ///
+ /// Gets the IBudgetsOperations.
+ ///
+ public virtual IBudgetsOperations Budgets { get; private set; }
+
+ ///
+ /// Gets the IBudgetOperations.
+ ///
+ public virtual IBudgetOperations Budget { get; private set; }
+
+ ///
+ /// Gets the IOperations.
+ ///
+ public virtual IOperations Operations { get; private set; }
+
+ ///
+ /// Initializes a new instance of the CostManagementClient class.
+ ///
+ ///
+ /// HttpClient to be used
+ ///
+ ///
+ /// True: will dispose the provided httpClient on calling CostManagementClient.Dispose(). False: will not dispose provided httpClient
+ protected CostManagementClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient)
+ {
+ Initialize();
+ }
+
+ ///
+ /// Initializes a new instance of the CostManagementClient class.
+ ///
+ ///
+ /// Optional. The delegating handlers to add to the http client pipeline.
+ ///
+ protected CostManagementClient(params DelegatingHandler[] handlers) : base(handlers)
+ {
+ Initialize();
+ }
+
+ ///
+ /// Initializes a new instance of the CostManagementClient class.
+ ///
+ ///
+ /// Optional. The http client handler used to handle http transport.
+ ///
+ ///
+ /// Optional. The delegating handlers to add to the http client pipeline.
+ ///
+ protected CostManagementClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers)
+ {
+ Initialize();
+ }
+
+ ///
+ /// Initializes a new instance of the CostManagementClient class.
+ ///
+ ///
+ /// Optional. The base URI of the service.
+ ///
+ ///
+ /// Optional. The delegating handlers to add to the http client pipeline.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ protected CostManagementClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers)
+ {
+ if (baseUri == null)
+ {
+ throw new System.ArgumentNullException("baseUri");
+ }
+ BaseUri = baseUri;
+ }
+
+ ///
+ /// Initializes a new instance of the CostManagementClient class.
+ ///
+ ///
+ /// Optional. The base URI of the service.
+ ///
+ ///
+ /// Optional. The http client handler used to handle http transport.
+ ///
+ ///
+ /// Optional. The delegating handlers to add to the http client pipeline.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ protected CostManagementClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers)
+ {
+ if (baseUri == null)
+ {
+ throw new System.ArgumentNullException("baseUri");
+ }
+ BaseUri = baseUri;
+ }
+
+ ///
+ /// Initializes a new instance of the CostManagementClient class.
+ ///
+ ///
+ /// Required. Credentials needed for the client to connect to Azure.
+ ///
+ ///
+ /// Optional. The delegating handlers to add to the http client pipeline.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ public CostManagementClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers)
+ {
+ if (credentials == null)
+ {
+ throw new System.ArgumentNullException("credentials");
+ }
+ Credentials = credentials;
+ if (Credentials != null)
+ {
+ Credentials.InitializeServiceClient(this);
+ }
+ }
+
+ ///
+ /// Initializes a new instance of the CostManagementClient class.
+ ///
+ ///
+ /// Required. Credentials needed for the client to connect to Azure.
+ ///
+ ///
+ /// HttpClient to be used
+ ///
+ ///
+ /// True: will dispose the provided httpClient on calling CostManagementClient.Dispose(). False: will not dispose provided httpClient
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ public CostManagementClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient)
+ {
+ if (credentials == null)
+ {
+ throw new System.ArgumentNullException("credentials");
+ }
+ Credentials = credentials;
+ if (Credentials != null)
+ {
+ Credentials.InitializeServiceClient(this);
+ }
+ }
+
+ ///
+ /// Initializes a new instance of the CostManagementClient class.
+ ///
+ ///
+ /// Required. Credentials needed for the client to connect to Azure.
+ ///
+ ///
+ /// Optional. The http client handler used to handle http transport.
+ ///
+ ///
+ /// Optional. The delegating handlers to add to the http client pipeline.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ public CostManagementClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers)
+ {
+ if (credentials == null)
+ {
+ throw new System.ArgumentNullException("credentials");
+ }
+ Credentials = credentials;
+ if (Credentials != null)
+ {
+ Credentials.InitializeServiceClient(this);
+ }
+ }
+
+ ///
+ /// Initializes a new instance of the CostManagementClient class.
+ ///
+ ///
+ /// Optional. The base URI of the service.
+ ///
+ ///
+ /// Required. Credentials needed for the client to connect to Azure.
+ ///
+ ///
+ /// Optional. The delegating handlers to add to the http client pipeline.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ public CostManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers)
+ {
+ if (baseUri == null)
+ {
+ throw new System.ArgumentNullException("baseUri");
+ }
+ if (credentials == null)
+ {
+ throw new System.ArgumentNullException("credentials");
+ }
+ BaseUri = baseUri;
+ Credentials = credentials;
+ if (Credentials != null)
+ {
+ Credentials.InitializeServiceClient(this);
+ }
+ }
+
+ ///
+ /// Initializes a new instance of the CostManagementClient class.
+ ///
+ ///
+ /// Optional. The base URI of the service.
+ ///
+ ///
+ /// Required. Credentials needed for the client to connect to Azure.
+ ///
+ ///
+ /// Optional. The http client handler used to handle http transport.
+ ///
+ ///
+ /// Optional. The delegating handlers to add to the http client pipeline.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ public CostManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers)
+ {
+ if (baseUri == null)
+ {
+ throw new System.ArgumentNullException("baseUri");
+ }
+ if (credentials == null)
+ {
+ throw new System.ArgumentNullException("credentials");
+ }
+ BaseUri = baseUri;
+ Credentials = credentials;
+ if (Credentials != null)
+ {
+ Credentials.InitializeServiceClient(this);
+ }
+ }
+
+ ///
+ /// An optional partial-method to perform custom initialization.
+ ///
+ partial void CustomInitialize();
+ ///
+ /// Initializes client properties.
+ ///
+ private void Initialize()
+ {
+ Views = new ViewsOperations(this);
+ Budgets = new BudgetsOperations(this);
+ Budget = new BudgetOperations(this);
+ Operations = new Operations(this);
+ BaseUri = new System.Uri("https://management.azure.com");
+ ApiVersion = "2019-04-01-preview";
+ AcceptLanguage = "en-US";
+ LongRunningOperationRetryTimeout = 30;
+ GenerateClientRequestId = true;
+ SerializationSettings = new JsonSerializerSettings
+ {
+ Formatting = Newtonsoft.Json.Formatting.Indented,
+ DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
+ DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
+ NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
+ ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
+ ContractResolver = new ReadOnlyJsonContractResolver(),
+ Converters = new List
+ {
+ new Iso8601TimeSpanConverter()
+ }
+ };
+ SerializationSettings.Converters.Add(new TransformationJsonConverter());
+ DeserializationSettings = new JsonSerializerSettings
+ {
+ DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
+ DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
+ NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
+ ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
+ ContractResolver = new ReadOnlyJsonContractResolver(),
+ Converters = new List
+ {
+ new Iso8601TimeSpanConverter()
+ }
+ };
+ CustomInitialize();
+ DeserializationSettings.Converters.Add(new TransformationJsonConverter());
+ DeserializationSettings.Converters.Add(new CloudErrorJsonConverter());
+ }
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IBudgetOperations.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IBudgetOperations.cs
new file mode 100644
index 000000000000..743b05022b2e
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IBudgetOperations.cs
@@ -0,0 +1,153 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// BudgetOperations operations.
+ ///
+ public partial interface IBudgetOperations
+ {
+ ///
+ /// 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, BudgetModel parameters = default(BudgetModel), 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));
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IBudgetsOperations.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IBudgetsOperations.cs
new file mode 100644
index 000000000000..099bc5547849
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IBudgetsOperations.cs
@@ -0,0 +1,88 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement
+{
+ 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));
+ ///
+ /// 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/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ICostManagementClient.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ICostManagementClient.cs
new file mode 100644
index 000000000000..40487d0d7060
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ICostManagementClient.cs
@@ -0,0 +1,93 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using Newtonsoft.Json;
+
+ ///
+ ///
+ public partial interface ICostManagementClient : System.IDisposable
+ {
+ ///
+ /// The base URI of the service.
+ ///
+ System.Uri BaseUri { get; set; }
+
+ ///
+ /// Gets or sets json serialization settings.
+ ///
+ JsonSerializerSettings SerializationSettings { get; }
+
+ ///
+ /// Gets or sets json deserialization settings.
+ ///
+ JsonSerializerSettings DeserializationSettings { get; }
+
+ ///
+ /// Credentials needed for the client to connect to Azure.
+ ///
+ ServiceClientCredentials Credentials { get; }
+
+ ///
+ /// Version of the API to be used with the client request. The current
+ /// version is 2019-04-01-preview
+ ///
+ string ApiVersion { get; }
+
+ ///
+ /// Azure Subscription ID.
+ ///
+ string SubscriptionId { get; set; }
+
+ ///
+ /// The preferred language for the response.
+ ///
+ string AcceptLanguage { get; set; }
+
+ ///
+ /// The retry timeout in seconds for Long Running Operations. Default
+ /// value is 30.
+ ///
+ int? LongRunningOperationRetryTimeout { get; set; }
+
+ ///
+ /// Whether a unique x-ms-client-request-id should be generated. When
+ /// set to true a unique x-ms-client-request-id value is generated and
+ /// included in each request. Default is true.
+ ///
+ bool? GenerateClientRequestId { get; set; }
+
+
+ ///
+ /// Gets the IViewsOperations.
+ ///
+ IViewsOperations Views { get; }
+
+ ///
+ /// Gets the IBudgetsOperations.
+ ///
+ IBudgetsOperations Budgets { get; }
+
+ ///
+ /// Gets the IBudgetOperations.
+ ///
+ IBudgetOperations Budget { get; }
+
+ ///
+ /// Gets the IOperations.
+ ///
+ IOperations Operations { get; }
+
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IOperations.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IOperations.cs
new file mode 100644
index 000000000000..9efcc4fb3e1b
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IOperations.cs
@@ -0,0 +1,68 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// Operations operations.
+ ///
+ public partial interface IOperations
+ {
+ ///
+ /// Lists all of the available consumption REST API operations.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Lists all of the available consumption REST API operations.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IViewsOperations.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IViewsOperations.cs
new file mode 100644
index 000000000000..113b114257aa
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IViewsOperations.cs
@@ -0,0 +1,345 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// ViewsOperations operations.
+ ///
+ public partial interface IViewsOperations
+ {
+ ///
+ /// Lists all views by tenant and object.
+ ///
+ ///
+ ///
+ /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Lists all views at the given scope.
+ ///
+ ///
+ ///
+ /// The scope associated with view 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.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
+ /// for BillingProfile scope,
+ /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}'
+ /// for InvoiceSection scope,
+ /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}'
+ /// for Management Group scope,
+ /// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}'
+ /// for External Billing Account scope and
+ /// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}'
+ /// for External Subscription 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>> ListByScopeWithHttpMessagesAsync(string scope, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Gets the view by view name.
+ ///
+ ///
+ ///
+ /// View 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 viewName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// The operation to create or update a view. Update operation requires
+ /// latest eTag to be set in the request. You may obtain the latest
+ /// eTag by performing a get operation. Create operation does not
+ /// require eTag.
+ ///
+ ///
+ ///
+ /// View name
+ ///
+ ///
+ /// Parameters supplied to the CreateOrUpdate View 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 viewName, View parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// The operation to delete a view.
+ ///
+ ///
+ ///
+ /// View 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 viewName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Gets the view for the defined scope by view name.
+ ///
+ ///
+ ///
+ /// The scope associated with view 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.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
+ /// for BillingProfile scope,
+ /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}'
+ /// for InvoiceSection scope,
+ /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}'
+ /// for Management Group scope,
+ /// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}'
+ /// for External Billing Account scope and
+ /// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}'
+ /// for External Subscription scope.
+ ///
+ ///
+ /// View 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> GetByScopeWithHttpMessagesAsync(string scope, string viewName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// The operation to create or update a view. Update operation requires
+ /// latest eTag to be set in the request. You may obtain the latest
+ /// eTag by performing a get operation. Create operation does not
+ /// require eTag.
+ ///
+ ///
+ ///
+ /// The scope associated with view 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.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
+ /// for BillingProfile scope,
+ /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}'
+ /// for InvoiceSection scope,
+ /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}'
+ /// for Management Group scope,
+ /// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}'
+ /// for External Billing Account scope and
+ /// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}'
+ /// for External Subscription scope.
+ ///
+ ///
+ /// View name
+ ///
+ ///
+ /// Parameters supplied to the CreateOrUpdate View 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> CreateOrUpdateByScopeWithHttpMessagesAsync(string scope, string viewName, View parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// The operation to delete a view.
+ ///
+ ///
+ ///
+ /// The scope associated with view 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.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
+ /// for BillingProfile scope,
+ /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}'
+ /// for InvoiceSection scope,
+ /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}'
+ /// for Management Group scope,
+ /// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}'
+ /// for External Billing Account scope and
+ /// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}'
+ /// for External Subscription scope.
+ ///
+ ///
+ /// View 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 DeleteByScopeWithHttpMessagesAsync(string scope, string viewName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Lists all views by tenant and object.
+ ///
+ ///
+ ///
+ /// 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));
+ ///
+ /// Lists all views at the given 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>> ListByScopeNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/AccumulatedType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/AccumulatedType.cs
new file mode 100644
index 000000000000..a2e19985def0
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/AccumulatedType.cs
@@ -0,0 +1,22 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+
+ ///
+ /// Defines values for AccumulatedType.
+ ///
+ public static class AccumulatedType
+ {
+ public const string True = "true";
+ public const string False = "false";
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/BudgetModel.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/BudgetModel.cs
new file mode 100644
index 000000000000..1ac6c00a01c0
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/BudgetModel.cs
@@ -0,0 +1,172 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Serialization;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ ///
+ /// A budget resource.
+ ///
+ [Rest.Serialization.JsonTransformation]
+ public partial class BudgetModel : ProxyResource
+ {
+ ///
+ /// Initializes a new instance of the BudgetModel class.
+ ///
+ public BudgetModel()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the BudgetModel class.
+ ///
+ /// The category of the budget, whether the
+ /// budget tracks cost or usage. Possible values include: 'Cost',
+ /// 'Usage'
+ /// The total amount of cost to track with the
+ /// budget
+ /// The time covered by a budget. Tracking of
+ /// the amount will be reset based on the time grain. Possible values
+ /// include: 'Monthly', 'Quarterly', 'Annually'
+ /// Has start and end date of the budget. The
+ /// start date must be first of the month and should be less than the
+ /// end date. Budget start date must be on or after June 1, 2017.
+ /// Future start date should not be more than three months. Past start
+ /// date should be selected within the timegrain period. There are no
+ /// restrictions on the end date.
+ /// Resource Id.
+ /// Resource name.
+ /// Resource type.
+ /// eTag of the resource. To handle concurrent
+ /// update scenario, this field will be used to determine whether the
+ /// user is updating the latest version or not.
+ /// May be used to filter budgets.
+ /// The current amount of cost which is
+ /// being tracked for a budget.
+ /// Dictionary of notifications associated
+ /// with the budget. Budget can have up to five notifications.
+ public BudgetModel(string category, decimal amount, string timeGrain, BudgetTimePeriod timePeriod, string id = default(string), string name = default(string), string type = default(string), string eTag = default(string), ReportConfigFilter filter = default(ReportConfigFilter), CurrentSpend currentSpend = default(CurrentSpend), IDictionary notifications = default(IDictionary))
+ : base(id, name, type, eTag)
+ {
+ Category = category;
+ Amount = amount;
+ TimeGrain = timeGrain;
+ TimePeriod = timePeriod;
+ Filter = filter;
+ CurrentSpend = currentSpend;
+ Notifications = notifications;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets the category of the budget, whether the budget tracks
+ /// cost or usage. Possible values include: 'Cost', 'Usage'
+ ///
+ [JsonProperty(PropertyName = "properties.category")]
+ public string Category { get; set; }
+
+ ///
+ /// Gets or sets the total amount of cost to track with the budget
+ ///
+ [JsonProperty(PropertyName = "properties.amount")]
+ public decimal Amount { get; set; }
+
+ ///
+ /// Gets or sets the time covered by a budget. Tracking of the amount
+ /// will be reset based on the time grain. Possible values include:
+ /// 'Monthly', 'Quarterly', 'Annually'
+ ///
+ [JsonProperty(PropertyName = "properties.timeGrain")]
+ public string TimeGrain { get; set; }
+
+ ///
+ /// Gets or sets has start and end date of the budget. The start date
+ /// must be first of the month and should be less than the end date.
+ /// Budget start date must be on or after June 1, 2017. Future start
+ /// date should not be more than three months. Past start date should
+ /// be selected within the timegrain period. There are no restrictions
+ /// on the end date.
+ ///
+ [JsonProperty(PropertyName = "properties.timePeriod")]
+ public BudgetTimePeriod TimePeriod { get; set; }
+
+ ///
+ /// Gets or sets may be used to filter budgets.
+ ///
+ [JsonProperty(PropertyName = "properties.filter")]
+ public ReportConfigFilter Filter { get; set; }
+
+ ///
+ /// Gets the current amount of cost which is being tracked for a
+ /// budget.
+ ///
+ [JsonProperty(PropertyName = "properties.currentSpend")]
+ public CurrentSpend CurrentSpend { get; private set; }
+
+ ///
+ /// Gets or sets dictionary of notifications associated with the
+ /// budget. Budget can have up to five notifications.
+ ///
+ [JsonProperty(PropertyName = "properties.notifications")]
+ public IDictionary Notifications { get; set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public virtual void Validate()
+ {
+ if (Category == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "Category");
+ }
+ if (TimeGrain == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "TimeGrain");
+ }
+ if (TimePeriod == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "TimePeriod");
+ }
+ if (TimePeriod != null)
+ {
+ TimePeriod.Validate();
+ }
+ if (Filter != null)
+ {
+ Filter.Validate();
+ }
+ if (Notifications != null)
+ {
+ foreach (var valueElement in Notifications.Values)
+ {
+ if (valueElement != null)
+ {
+ valueElement.Validate();
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/BudgetTimePeriod.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/BudgetTimePeriod.cs
new file mode 100644
index 000000000000..eabff2337f19
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/BudgetTimePeriod.cs
@@ -0,0 +1,71 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// The start and end date for a budget.
+ ///
+ public partial class BudgetTimePeriod
+ {
+ ///
+ /// Initializes a new instance of the BudgetTimePeriod class.
+ ///
+ public BudgetTimePeriod()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the BudgetTimePeriod class.
+ ///
+ /// The start date for the budget.
+ /// The end date for the budget. If not provided,
+ /// we default this to 10 years from the start date.
+ public BudgetTimePeriod(System.DateTime startDate, System.DateTime? endDate = default(System.DateTime?))
+ {
+ StartDate = startDate;
+ EndDate = endDate;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets the start date for the budget.
+ ///
+ [JsonProperty(PropertyName = "startDate")]
+ public System.DateTime StartDate { get; set; }
+
+ ///
+ /// Gets or sets the end date for the budget. If not provided, we
+ /// default this to 10 years from the start date.
+ ///
+ [JsonProperty(PropertyName = "endDate")]
+ public System.DateTime? EndDate { get; set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public virtual void Validate()
+ {
+ //Nothing to validate
+ }
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/CategoryType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/CategoryType.cs
new file mode 100644
index 000000000000..4851e4efbf90
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/CategoryType.cs
@@ -0,0 +1,22 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+
+ ///
+ /// Defines values for CategoryType.
+ ///
+ public static class CategoryType
+ {
+ public const string Cost = "Cost";
+ public const string Usage = "Usage";
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ChartType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ChartType.cs
new file mode 100644
index 000000000000..0e72be35a68f
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ChartType.cs
@@ -0,0 +1,25 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+
+ ///
+ /// Defines values for ChartType.
+ ///
+ public static class ChartType
+ {
+ public const string Area = "Area";
+ public const string Line = "Line";
+ public const string StackedColumn = "StackedColumn";
+ public const string GroupedColumn = "GroupedColumn";
+ public const string Table = "Table";
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/CurrentSpend.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/CurrentSpend.cs
new file mode 100644
index 000000000000..800a08039911
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/CurrentSpend.cs
@@ -0,0 +1,61 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// The current amount of cost which is being tracked for a budget.
+ ///
+ public partial class CurrentSpend
+ {
+ ///
+ /// Initializes a new instance of the CurrentSpend class.
+ ///
+ public CurrentSpend()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the CurrentSpend class.
+ ///
+ /// The total amount of cost which is being
+ /// tracked by the budget.
+ /// The unit of measure for the budget
+ /// amount.
+ public CurrentSpend(decimal? amount = default(decimal?), string unit = default(string))
+ {
+ Amount = amount;
+ Unit = unit;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets the total amount of cost which is being tracked by the budget.
+ ///
+ [JsonProperty(PropertyName = "amount")]
+ public decimal? Amount { get; private set; }
+
+ ///
+ /// Gets the unit of measure for the budget amount.
+ ///
+ [JsonProperty(PropertyName = "unit")]
+ public string Unit { get; private set; }
+
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorBase.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorBase.cs
new file mode 100644
index 000000000000..e01c15ea507b
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorBase.cs
@@ -0,0 +1,69 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// The details of the error.
+ ///
+ public partial class ErrorBase
+ {
+ ///
+ /// Initializes a new instance of the ErrorBase class.
+ ///
+ public ErrorBase()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the ErrorBase class.
+ ///
+ /// A machine readable error code.
+ /// A human readable error message.
+ /// Indicates which property in the request is
+ /// responsible for the error.
+ public ErrorBase(string code = default(string), string message = default(string), string target = default(string))
+ {
+ Code = code;
+ Message = message;
+ Target = target;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets a machine readable error code.
+ ///
+ [JsonProperty(PropertyName = "code")]
+ public string Code { get; private set; }
+
+ ///
+ /// Gets a human readable error message.
+ ///
+ [JsonProperty(PropertyName = "message")]
+ public string Message { get; private set; }
+
+ ///
+ /// Gets indicates which property in the request is responsible for the
+ /// error.
+ ///
+ [JsonProperty(PropertyName = "target")]
+ public string Target { get; private set; }
+
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorDetails.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorDetails.cs
new file mode 100644
index 000000000000..1386766cdbb3
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorDetails.cs
@@ -0,0 +1,79 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ ///
+ /// The details of the error.
+ ///
+ public partial class ErrorDetails
+ {
+ ///
+ /// Initializes a new instance of the ErrorDetails class.
+ ///
+ public ErrorDetails()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the ErrorDetails class.
+ ///
+ /// A machine readable error code.
+ /// A human readable error message.
+ /// Indicates which property in the request is
+ /// responsible for the error.
+ /// error details.
+ public ErrorDetails(string code = default(string), string message = default(string), string target = default(string), IList details = default(IList))
+ {
+ Code = code;
+ Message = message;
+ Target = target;
+ Details = details;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets a machine readable error code.
+ ///
+ [JsonProperty(PropertyName = "code")]
+ public string Code { get; private set; }
+
+ ///
+ /// Gets a human readable error message.
+ ///
+ [JsonProperty(PropertyName = "message")]
+ public string Message { get; private set; }
+
+ ///
+ /// Gets or sets indicates which property in the request is responsible
+ /// for the error.
+ ///
+ [JsonProperty(PropertyName = "target")]
+ public string Target { get; set; }
+
+ ///
+ /// Gets or sets error details.
+ ///
+ [JsonProperty(PropertyName = "details")]
+ public IList Details { get; set; }
+
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorResponse.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorResponse.cs
new file mode 100644
index 000000000000..de6105c004da
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorResponse.cs
@@ -0,0 +1,52 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// Error response indicates that the service is not able to process the
+ /// incoming request. The reason is provided in the error message.
+ ///
+ public partial class ErrorResponse
+ {
+ ///
+ /// Initializes a new instance of the ErrorResponse class.
+ ///
+ public ErrorResponse()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the ErrorResponse class.
+ ///
+ /// The details of the error.
+ public ErrorResponse(ErrorDetails error = default(ErrorDetails))
+ {
+ Error = error;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets the details of the error.
+ ///
+ [JsonProperty(PropertyName = "error")]
+ public ErrorDetails Error { get; set; }
+
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorResponseException.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorResponseException.cs
new file mode 100644
index 000000000000..a464dabb029b
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorResponseException.cs
@@ -0,0 +1,62 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+ using Microsoft.Rest;
+
+ ///
+ /// Exception thrown for an invalid response with ErrorResponse
+ /// information.
+ ///
+ public partial class ErrorResponseException : RestException
+ {
+ ///
+ /// Gets information about the associated HTTP request.
+ ///
+ public HttpRequestMessageWrapper Request { get; set; }
+
+ ///
+ /// Gets information about the associated HTTP response.
+ ///
+ public HttpResponseMessageWrapper Response { get; set; }
+
+ ///
+ /// Gets or sets the body object.
+ ///
+ public ErrorResponse Body { get; set; }
+
+ ///
+ /// Initializes a new instance of the ErrorResponseException class.
+ ///
+ public ErrorResponseException()
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the ErrorResponseException class.
+ ///
+ /// The exception message.
+ public ErrorResponseException(string message)
+ : this(message, null)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the ErrorResponseException class.
+ ///
+ /// The exception message.
+ /// Inner exception.
+ public ErrorResponseException(string message, System.Exception innerException)
+ : base(message, innerException)
+ {
+ }
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/GranularityType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/GranularityType.cs
new file mode 100644
index 000000000000..b259cfb98f3d
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/GranularityType.cs
@@ -0,0 +1,22 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+
+ ///
+ /// Defines values for GranularityType.
+ ///
+ public static class GranularityType
+ {
+ public const string Daily = "Daily";
+ public const string Monthly = "Monthly";
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/KpiProperties.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/KpiProperties.cs
new file mode 100644
index 000000000000..2b73b6d962e2
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/KpiProperties.cs
@@ -0,0 +1,69 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// Each KPI must contain a 'type' and 'enabled' key.
+ ///
+ public partial class KpiProperties
+ {
+ ///
+ /// Initializes a new instance of the KpiProperties class.
+ ///
+ public KpiProperties()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the KpiProperties class.
+ ///
+ /// KPI type (Forecast, Budget). Possible values
+ /// include: 'Forecast', 'Budget'
+ /// ID of resource related to metric (budget).
+ /// show the KPI in the UI?
+ public KpiProperties(string type = default(string), string id = default(string), bool? enabled = default(bool?))
+ {
+ Type = type;
+ Id = id;
+ Enabled = enabled;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets KPI type (Forecast, Budget). Possible values include:
+ /// 'Forecast', 'Budget'
+ ///
+ [JsonProperty(PropertyName = "type")]
+ public string Type { get; set; }
+
+ ///
+ /// Gets or sets ID of resource related to metric (budget).
+ ///
+ [JsonProperty(PropertyName = "id")]
+ public string Id { get; set; }
+
+ ///
+ /// Gets or sets show the KPI in the UI?
+ ///
+ [JsonProperty(PropertyName = "enabled")]
+ public bool? Enabled { get; set; }
+
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/KpiTypeType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/KpiTypeType.cs
new file mode 100644
index 000000000000..735baa7d36b3
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/KpiTypeType.cs
@@ -0,0 +1,22 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+
+ ///
+ /// Defines values for KpiTypeType.
+ ///
+ public static class KpiTypeType
+ {
+ public const string Forecast = "Forecast";
+ public const string Budget = "Budget";
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/MetricType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/MetricType.cs
new file mode 100644
index 000000000000..746d4df6e4d8
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/MetricType.cs
@@ -0,0 +1,23 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+
+ ///
+ /// Defines values for MetricType.
+ ///
+ public static class MetricType
+ {
+ public const string ActualCost = "ActualCost";
+ public const string AmortizedCost = "AmortizedCost";
+ public const string AHUB = "AHUB";
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Notification.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Notification.cs
new file mode 100644
index 000000000000..a208ee8129c4
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Notification.cs
@@ -0,0 +1,147 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+ using Microsoft.Rest;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ ///
+ /// The notification associated with a budget.
+ ///
+ public partial class Notification
+ {
+ ///
+ /// Initializes a new instance of the Notification class.
+ ///
+ public Notification()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the Notification class.
+ ///
+ /// The notification is enabled or not.
+ /// The comparison operator. Possible
+ /// values include: 'EqualTo', 'GreaterThan',
+ /// 'GreaterThanOrEqualTo'
+ /// Threshold value associated with a
+ /// notification. Notification is sent when the cost exceeded the
+ /// threshold. It is always percent and has to be between 0 and
+ /// 1000.
+ /// Email addresses to send the budget
+ /// notification to when the threshold is exceeded.
+ /// Contact roles to send the budget
+ /// notification to when the threshold is exceeded.
+ /// Action groups to send the budget
+ /// notification to when the threshold is exceeded.
+ public Notification(bool enabled, string operatorProperty, decimal threshold, IList contactEmails, IList contactRoles = default(IList), IList contactGroups = default(IList))
+ {
+ Enabled = enabled;
+ OperatorProperty = operatorProperty;
+ Threshold = threshold;
+ ContactEmails = contactEmails;
+ ContactRoles = contactRoles;
+ ContactGroups = contactGroups;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets the notification is enabled or not.
+ ///
+ [JsonProperty(PropertyName = "enabled")]
+ public bool Enabled { get; set; }
+
+ ///
+ /// Gets or sets the comparison operator. Possible values include:
+ /// 'EqualTo', 'GreaterThan', 'GreaterThanOrEqualTo'
+ ///
+ [JsonProperty(PropertyName = "operator")]
+ public string OperatorProperty { get; set; }
+
+ ///
+ /// Gets or sets threshold value associated with a notification.
+ /// Notification is sent when the cost exceeded the threshold. It is
+ /// always percent and has to be between 0 and 1000.
+ ///
+ [JsonProperty(PropertyName = "threshold")]
+ public decimal Threshold { get; set; }
+
+ ///
+ /// Gets or sets email addresses to send the budget notification to
+ /// when the threshold is exceeded.
+ ///
+ [JsonProperty(PropertyName = "contactEmails")]
+ public IList ContactEmails { get; set; }
+
+ ///
+ /// Gets or sets contact roles to send the budget notification to when
+ /// the threshold is exceeded.
+ ///
+ [JsonProperty(PropertyName = "contactRoles")]
+ public IList ContactRoles { get; set; }
+
+ ///
+ /// Gets or sets action groups to send the budget notification to when
+ /// the threshold is exceeded.
+ ///
+ [JsonProperty(PropertyName = "contactGroups")]
+ public IList ContactGroups { get; set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public virtual void Validate()
+ {
+ if (OperatorProperty == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "OperatorProperty");
+ }
+ if (ContactEmails == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "ContactEmails");
+ }
+ if (ContactEmails != null)
+ {
+ if (ContactEmails.Count > 50)
+ {
+ throw new ValidationException(ValidationRules.MaxItems, "ContactEmails", 50);
+ }
+ if (ContactEmails.Count < 1)
+ {
+ throw new ValidationException(ValidationRules.MinItems, "ContactEmails", 1);
+ }
+ }
+ if (ContactGroups != null)
+ {
+ if (ContactGroups.Count > 50)
+ {
+ throw new ValidationException(ValidationRules.MaxItems, "ContactGroups", 50);
+ }
+ if (ContactGroups.Count < 0)
+ {
+ throw new ValidationException(ValidationRules.MinItems, "ContactGroups", 0);
+ }
+ }
+ }
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/NotificationOperatorType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/NotificationOperatorType.cs
new file mode 100644
index 000000000000..e5b8501977e2
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/NotificationOperatorType.cs
@@ -0,0 +1,23 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+
+ ///
+ /// Defines values for NotificationOperatorType.
+ ///
+ public static class NotificationOperatorType
+ {
+ public const string EqualTo = "EqualTo";
+ public const string GreaterThan = "GreaterThan";
+ public const string GreaterThanOrEqualTo = "GreaterThanOrEqualTo";
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Operation.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Operation.cs
new file mode 100644
index 000000000000..bed6fe698a61
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Operation.cs
@@ -0,0 +1,61 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// A Cost management REST API operation.
+ ///
+ public partial class Operation
+ {
+ ///
+ /// Initializes a new instance of the Operation class.
+ ///
+ public Operation()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the Operation class.
+ ///
+ /// Operation name:
+ /// {provider}/{resource}/{operation}.
+ /// The object that represents the
+ /// operation.
+ public Operation(string name = default(string), OperationDisplay display = default(OperationDisplay))
+ {
+ Name = name;
+ Display = display;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets operation name: {provider}/{resource}/{operation}.
+ ///
+ [JsonProperty(PropertyName = "name")]
+ public string Name { get; private set; }
+
+ ///
+ /// Gets or sets the object that represents the operation.
+ ///
+ [JsonProperty(PropertyName = "display")]
+ public OperationDisplay Display { get; set; }
+
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/OperationDisplay.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/OperationDisplay.cs
new file mode 100644
index 000000000000..b8731cf3636b
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/OperationDisplay.cs
@@ -0,0 +1,71 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// The object that represents the operation.
+ ///
+ public partial class OperationDisplay
+ {
+ ///
+ /// Initializes a new instance of the OperationDisplay class.
+ ///
+ public OperationDisplay()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the OperationDisplay class.
+ ///
+ /// Service provider:
+ /// Microsoft.CostManagement.
+ /// Resource on which the operation is
+ /// performed: Dimensions, Query.
+ /// Operation type: Read, write, delete,
+ /// etc.
+ public OperationDisplay(string provider = default(string), string resource = default(string), string operation = default(string))
+ {
+ Provider = provider;
+ Resource = resource;
+ Operation = operation;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets service provider: Microsoft.CostManagement.
+ ///
+ [JsonProperty(PropertyName = "provider")]
+ public string Provider { get; private set; }
+
+ ///
+ /// Gets resource on which the operation is performed: Dimensions,
+ /// Query.
+ ///
+ [JsonProperty(PropertyName = "resource")]
+ public string Resource { get; private set; }
+
+ ///
+ /// Gets operation type: Read, write, delete, etc.
+ ///
+ [JsonProperty(PropertyName = "operation")]
+ public string Operation { get; private set; }
+
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/OperatorType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/OperatorType.cs
new file mode 100644
index 000000000000..04835817077f
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/OperatorType.cs
@@ -0,0 +1,22 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+
+ ///
+ /// Defines values for OperatorType.
+ ///
+ public static class OperatorType
+ {
+ public const string In = "In";
+ public const string Contains = "Contains";
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Page.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Page.cs
new file mode 100644
index 000000000000..a431dbedbb4d
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Page.cs
@@ -0,0 +1,53 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+
+ ///
+ /// Defines a page in Azure responses.
+ ///
+ /// Type of the page content items
+ [JsonObject]
+ public class Page : IPage
+ {
+ ///
+ /// Gets the link to the next page.
+ ///
+ [JsonProperty("nextLink")]
+ public string NextPageLink { get; private set; }
+
+ [JsonProperty("value")]
+ private IList Items{ get; set; }
+
+ ///
+ /// Returns an enumerator that iterates through the collection.
+ ///
+ /// A an enumerator that can be used to iterate through the collection.
+ public IEnumerator GetEnumerator()
+ {
+ return Items == null ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator();
+ }
+
+ ///
+ /// Returns an enumerator that iterates through the collection.
+ ///
+ /// A an enumerator that can be used to iterate through the collection.
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/PivotProperties.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/PivotProperties.cs
new file mode 100644
index 000000000000..7761b4a3ea87
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/PivotProperties.cs
@@ -0,0 +1,61 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// Each pivot must contain a 'type' and 'name'.
+ ///
+ public partial class PivotProperties
+ {
+ ///
+ /// Initializes a new instance of the PivotProperties class.
+ ///
+ public PivotProperties()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the PivotProperties class.
+ ///
+ /// Data type to show in view. Possible values
+ /// include: 'Dimension', 'TagKey'
+ /// Data field to show in view.
+ public PivotProperties(string type = default(string), string name = default(string))
+ {
+ Type = type;
+ Name = name;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets data type to show in view. Possible values include:
+ /// 'Dimension', 'TagKey'
+ ///
+ [JsonProperty(PropertyName = "type")]
+ public string Type { get; set; }
+
+ ///
+ /// Gets or sets data field to show in view.
+ ///
+ [JsonProperty(PropertyName = "name")]
+ public string Name { get; set; }
+
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/PivotTypeType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/PivotTypeType.cs
new file mode 100644
index 000000000000..01ce2abd7bb7
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/PivotTypeType.cs
@@ -0,0 +1,22 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+
+ ///
+ /// Defines values for PivotTypeType.
+ ///
+ public static class PivotTypeType
+ {
+ public const string Dimension = "Dimension";
+ public const string TagKey = "TagKey";
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ProxyResource.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ProxyResource.cs
new file mode 100644
index 000000000000..d38be096c86a
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ProxyResource.cs
@@ -0,0 +1,81 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// The Resource model definition.
+ ///
+ public partial class ProxyResource : IResource
+ {
+ ///
+ /// Initializes a new instance of the ProxyResource class.
+ ///
+ public ProxyResource()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the ProxyResource class.
+ ///
+ /// Resource Id.
+ /// Resource name.
+ /// Resource type.
+ /// eTag of the resource. To handle concurrent
+ /// update scenario, this field will be used to determine whether the
+ /// user is updating the latest version or not.
+ public ProxyResource(string id = default(string), string name = default(string), string type = default(string), string eTag = default(string))
+ {
+ Id = id;
+ Name = name;
+ Type = type;
+ ETag = eTag;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets resource Id.
+ ///
+ [JsonProperty(PropertyName = "id")]
+ public string Id { get; private set; }
+
+ ///
+ /// Gets resource name.
+ ///
+ [JsonProperty(PropertyName = "name")]
+ public string Name { get; private set; }
+
+ ///
+ /// Gets resource type.
+ ///
+ [JsonProperty(PropertyName = "type")]
+ public string Type { get; private set; }
+
+ ///
+ /// Gets or sets eTag of the resource. To handle concurrent update
+ /// scenario, this field will be used to determine whether the user is
+ /// updating the latest version or not.
+ ///
+ [JsonProperty(PropertyName = "eTag")]
+ public string ETag { get; set; }
+
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigAggregation.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigAggregation.cs
new file mode 100644
index 000000000000..0f65a66d0699
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigAggregation.cs
@@ -0,0 +1,78 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+ using Microsoft.Rest;
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// The aggregation expression to be used in the report.
+ ///
+ public partial class ReportConfigAggregation
+ {
+ ///
+ /// Initializes a new instance of the ReportConfigAggregation class.
+ ///
+ public ReportConfigAggregation()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the ReportConfigAggregation class.
+ ///
+ /// The name of the column to aggregate.
+ public ReportConfigAggregation(string name)
+ {
+ Name = name;
+ CustomInit();
+ }
+ ///
+ /// Static constructor for ReportConfigAggregation class.
+ ///
+ static ReportConfigAggregation()
+ {
+ Function = "Sum";
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets the name of the column to aggregate.
+ ///
+ [JsonProperty(PropertyName = "name")]
+ public string Name { get; set; }
+
+ ///
+ /// The name of the aggregation function to use.
+ ///
+ [JsonProperty(PropertyName = "function")]
+ public static string Function { get; private set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public virtual void Validate()
+ {
+ if (Name == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "Name");
+ }
+ }
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigColumnType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigColumnType.cs
new file mode 100644
index 000000000000..1f891b17234d
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigColumnType.cs
@@ -0,0 +1,22 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+
+ ///
+ /// Defines values for ReportConfigColumnType.
+ ///
+ public static class ReportConfigColumnType
+ {
+ public const string Tag = "Tag";
+ public const string Dimension = "Dimension";
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigComparisonExpression.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigComparisonExpression.cs
new file mode 100644
index 000000000000..61dc4e845a91
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigComparisonExpression.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.CostManagement.Models
+{
+ using Microsoft.Rest;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ ///
+ /// The comparison expression to be used in the report.
+ ///
+ public partial class ReportConfigComparisonExpression
+ {
+ ///
+ /// Initializes a new instance of the ReportConfigComparisonExpression
+ /// class.
+ ///
+ public ReportConfigComparisonExpression()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the ReportConfigComparisonExpression
+ /// class.
+ ///
+ /// The name of the column to use in
+ /// comparison.
+ /// The operator to use for comparison.
+ /// Possible values include: 'In', 'Contains'
+ /// Array of values to use for comparison
+ public ReportConfigComparisonExpression(string name, string operatorProperty, IList values)
+ {
+ Name = name;
+ OperatorProperty = operatorProperty;
+ Values = values;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets the name of the column to use in comparison.
+ ///
+ [JsonProperty(PropertyName = "name")]
+ public string Name { get; set; }
+
+ ///
+ /// Gets or sets the operator to use for comparison. Possible values
+ /// include: 'In', 'Contains'
+ ///
+ [JsonProperty(PropertyName = "operator")]
+ public string OperatorProperty { get; set; }
+
+ ///
+ /// Gets or sets array of values to use for comparison
+ ///
+ [JsonProperty(PropertyName = "values")]
+ public IList Values { get; set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public virtual void Validate()
+ {
+ if (Name == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "Name");
+ }
+ if (OperatorProperty == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "OperatorProperty");
+ }
+ if (Values == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "Values");
+ }
+ if (Values != null)
+ {
+ if (Values.Count < 1)
+ {
+ throw new ValidationException(ValidationRules.MinItems, "Values", 1);
+ }
+ }
+ }
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigDataset.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigDataset.cs
new file mode 100644
index 000000000000..605ea38bf627
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigDataset.cs
@@ -0,0 +1,156 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+ using Microsoft.Rest;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ ///
+ /// The definition of data present in the report.
+ ///
+ public partial class ReportConfigDataset
+ {
+ ///
+ /// Initializes a new instance of the ReportConfigDataset class.
+ ///
+ public ReportConfigDataset()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the ReportConfigDataset class.
+ ///
+ /// The granularity of rows in the report.
+ /// Possible values include: 'Daily', 'Monthly'
+ /// Has configuration information for the
+ /// data in the report. The configuration will be ignored if
+ /// aggregation and grouping are provided.
+ /// Dictionary of aggregation expression to
+ /// use in the report. The key of each item in the dictionary is the
+ /// alias for the aggregated column. Report can have up to 2
+ /// aggregation clauses.
+ /// Array of group by expression to use in the
+ /// report. Report can have up to 2 group by clauses.
+ /// Array of order by expression to use in the
+ /// report.
+ /// Has filter expression to use in the
+ /// report.
+ public ReportConfigDataset(string granularity = default(string), ReportConfigDatasetConfiguration configuration = default(ReportConfigDatasetConfiguration), IDictionary aggregation = default(IDictionary), IList grouping = default(IList), IList sorting = default(IList), ReportConfigFilter filter = default(ReportConfigFilter))
+ {
+ Granularity = granularity;
+ Configuration = configuration;
+ Aggregation = aggregation;
+ Grouping = grouping;
+ Sorting = sorting;
+ Filter = filter;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets the granularity of rows in the report. Possible values
+ /// include: 'Daily', 'Monthly'
+ ///
+ [JsonProperty(PropertyName = "granularity")]
+ public string Granularity { get; set; }
+
+ ///
+ /// Gets or sets has configuration information for the data in the
+ /// report. The configuration will be ignored if aggregation and
+ /// grouping are provided.
+ ///
+ [JsonProperty(PropertyName = "configuration")]
+ public ReportConfigDatasetConfiguration Configuration { get; set; }
+
+ ///
+ /// Gets or sets dictionary of aggregation expression to use in the
+ /// report. The key of each item in the dictionary is the alias for the
+ /// aggregated column. Report can have up to 2 aggregation clauses.
+ ///
+ [JsonProperty(PropertyName = "aggregation")]
+ public IDictionary Aggregation { get; set; }
+
+ ///
+ /// Gets or sets array of group by expression to use in the report.
+ /// Report can have up to 2 group by clauses.
+ ///
+ [JsonProperty(PropertyName = "grouping")]
+ public IList Grouping { get; set; }
+
+ ///
+ /// Gets or sets array of order by expression to use in the report.
+ ///
+ [JsonProperty(PropertyName = "sorting")]
+ public IList Sorting { get; set; }
+
+ ///
+ /// Gets or sets has filter expression to use in the report.
+ ///
+ [JsonProperty(PropertyName = "filter")]
+ public ReportConfigFilter Filter { get; set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public virtual void Validate()
+ {
+ if (Aggregation != null)
+ {
+ foreach (var valueElement in Aggregation.Values)
+ {
+ if (valueElement != null)
+ {
+ valueElement.Validate();
+ }
+ }
+ }
+ if (Grouping != null)
+ {
+ if (Grouping.Count > 2)
+ {
+ throw new ValidationException(ValidationRules.MaxItems, "Grouping", 2);
+ }
+ foreach (var element in Grouping)
+ {
+ if (element != null)
+ {
+ element.Validate();
+ }
+ }
+ }
+ if (Sorting != null)
+ {
+ foreach (var element1 in Sorting)
+ {
+ if (element1 != null)
+ {
+ element1.Validate();
+ }
+ }
+ }
+ if (Filter != null)
+ {
+ Filter.Validate();
+ }
+ }
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigDatasetConfiguration.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigDatasetConfiguration.cs
new file mode 100644
index 000000000000..eeb8dc20dc98
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigDatasetConfiguration.cs
@@ -0,0 +1,59 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ ///
+ /// The configuration of dataset in the report.
+ ///
+ public partial class ReportConfigDatasetConfiguration
+ {
+ ///
+ /// Initializes a new instance of the ReportConfigDatasetConfiguration
+ /// class.
+ ///
+ public ReportConfigDatasetConfiguration()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the ReportConfigDatasetConfiguration
+ /// class.
+ ///
+ /// Array of column names to be included in the
+ /// report. Any valid report column name is allowed. If not provided,
+ /// then report includes all columns.
+ public ReportConfigDatasetConfiguration(IList columns = default(IList))
+ {
+ Columns = columns;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets array of column names to be included in the report.
+ /// Any valid report column name is allowed. If not provided, then
+ /// report includes all columns.
+ ///
+ [JsonProperty(PropertyName = "columns")]
+ public IList Columns { get; set; }
+
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigFilter.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigFilter.cs
new file mode 100644
index 000000000000..501c07680265
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigFilter.cs
@@ -0,0 +1,140 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+ using Microsoft.Rest;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ ///
+ /// The filter expression to be used in the report.
+ ///
+ public partial class ReportConfigFilter
+ {
+ ///
+ /// Initializes a new instance of the ReportConfigFilter class.
+ ///
+ public ReportConfigFilter()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the ReportConfigFilter class.
+ ///
+ /// The logical "AND" expression. Must have at least
+ /// 2 items.
+ /// The logical "OR" expression. Must have at least 2
+ /// items.
+ /// The logical "NOT" expression.
+ /// Has comparison expression for a
+ /// dimension
+ /// Has comparison expression for a tag
+ public ReportConfigFilter(IList and = default(IList), IList or = default(IList), ReportConfigFilter not = default(ReportConfigFilter), ReportConfigComparisonExpression dimension = default(ReportConfigComparisonExpression), ReportConfigComparisonExpression tag = default(ReportConfigComparisonExpression))
+ {
+ And = and;
+ Or = or;
+ Not = not;
+ Dimension = dimension;
+ Tag = tag;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets the logical "AND" expression. Must have at least 2
+ /// items.
+ ///
+ [JsonProperty(PropertyName = "and")]
+ public IList And { get; set; }
+
+ ///
+ /// Gets or sets the logical "OR" expression. Must have at least 2
+ /// items.
+ ///
+ [JsonProperty(PropertyName = "or")]
+ public IList Or { get; set; }
+
+ ///
+ /// Gets or sets the logical "NOT" expression.
+ ///
+ [JsonProperty(PropertyName = "not")]
+ public ReportConfigFilter Not { get; set; }
+
+ ///
+ /// Gets or sets has comparison expression for a dimension
+ ///
+ [JsonProperty(PropertyName = "dimension")]
+ public ReportConfigComparisonExpression Dimension { get; set; }
+
+ ///
+ /// Gets or sets has comparison expression for a tag
+ ///
+ [JsonProperty(PropertyName = "tag")]
+ public ReportConfigComparisonExpression Tag { get; set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public virtual void Validate()
+ {
+ if (And != null)
+ {
+ if (And.Count < 2)
+ {
+ throw new ValidationException(ValidationRules.MinItems, "And", 2);
+ }
+ foreach (var element in And)
+ {
+ if (element != null)
+ {
+ element.Validate();
+ }
+ }
+ }
+ if (Or != null)
+ {
+ if (Or.Count < 2)
+ {
+ throw new ValidationException(ValidationRules.MinItems, "Or", 2);
+ }
+ foreach (var element1 in Or)
+ {
+ if (element1 != null)
+ {
+ element1.Validate();
+ }
+ }
+ }
+ if (Not != null)
+ {
+ Not.Validate();
+ }
+ if (Dimension != null)
+ {
+ Dimension.Validate();
+ }
+ if (Tag != null)
+ {
+ Tag.Validate();
+ }
+ }
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigGrouping.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigGrouping.cs
new file mode 100644
index 000000000000..ce12933eb064
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigGrouping.cs
@@ -0,0 +1,81 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+ using Microsoft.Rest;
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// The group by expression to be used in the report.
+ ///
+ public partial class ReportConfigGrouping
+ {
+ ///
+ /// Initializes a new instance of the ReportConfigGrouping class.
+ ///
+ public ReportConfigGrouping()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the ReportConfigGrouping class.
+ ///
+ /// Has type of the column to group. Possible values
+ /// include: 'Tag', 'Dimension'
+ /// The name of the column to group. This version
+ /// supports subscription lowest possible grain.
+ public ReportConfigGrouping(string type, string name)
+ {
+ Type = type;
+ Name = name;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets has type of the column to group. Possible values
+ /// include: 'Tag', 'Dimension'
+ ///
+ [JsonProperty(PropertyName = "type")]
+ public string Type { get; set; }
+
+ ///
+ /// Gets or sets the name of the column to group. This version supports
+ /// subscription lowest possible grain.
+ ///
+ [JsonProperty(PropertyName = "name")]
+ public string Name { get; set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public virtual void Validate()
+ {
+ if (Type == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "Type");
+ }
+ if (Name == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "Name");
+ }
+ }
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigSorting.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigSorting.cs
new file mode 100644
index 000000000000..ae83953a20e4
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigSorting.cs
@@ -0,0 +1,75 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+ using Microsoft.Rest;
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// The order by expression to be used in the report.
+ ///
+ public partial class ReportConfigSorting
+ {
+ ///
+ /// Initializes a new instance of the ReportConfigSorting class.
+ ///
+ public ReportConfigSorting()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the ReportConfigSorting class.
+ ///
+ /// The name of the column to sort.
+ /// Direction of sort. Possible values include:
+ /// 'Ascending', 'Descending'
+ public ReportConfigSorting(string name, string direction = default(string))
+ {
+ Direction = direction;
+ Name = name;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets direction of sort. Possible values include:
+ /// 'Ascending', 'Descending'
+ ///
+ [JsonProperty(PropertyName = "direction")]
+ public string Direction { get; set; }
+
+ ///
+ /// Gets or sets the name of the column to sort.
+ ///
+ [JsonProperty(PropertyName = "name")]
+ public string Name { get; set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public virtual void Validate()
+ {
+ if (Name == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "Name");
+ }
+ }
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigTimePeriod.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigTimePeriod.cs
new file mode 100644
index 000000000000..2c4dabb85457
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ReportConfigTimePeriod.cs
@@ -0,0 +1,70 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// The start and end date for pulling data for the report.
+ ///
+ public partial class ReportConfigTimePeriod
+ {
+ ///
+ /// Initializes a new instance of the ReportConfigTimePeriod class.
+ ///
+ public ReportConfigTimePeriod()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the ReportConfigTimePeriod class.
+ ///
+ /// The start date to pull data
+ /// from.
+ /// The end date to pull data to.
+ public ReportConfigTimePeriod(System.DateTime fromProperty, System.DateTime to)
+ {
+ FromProperty = fromProperty;
+ To = to;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets the start date to pull data from.
+ ///
+ [JsonProperty(PropertyName = "from")]
+ public System.DateTime FromProperty { get; set; }
+
+ ///
+ /// Gets or sets the end date to pull data to.
+ ///
+ [JsonProperty(PropertyName = "to")]
+ public System.DateTime To { get; set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public virtual void Validate()
+ {
+ //Nothing to validate
+ }
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Resource.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Resource.cs
new file mode 100644
index 000000000000..c6dbf27e4db3
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Resource.cs
@@ -0,0 +1,79 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ ///
+ /// The Resource model definition.
+ ///
+ public partial class Resource : IResource
+ {
+ ///
+ /// Initializes a new instance of the Resource class.
+ ///
+ public Resource()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the Resource class.
+ ///
+ /// Resource Id.
+ /// Resource name.
+ /// Resource type.
+ /// Resource tags.
+ public Resource(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary))
+ {
+ Id = id;
+ Name = name;
+ Type = type;
+ Tags = tags;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets resource Id.
+ ///
+ [JsonProperty(PropertyName = "id")]
+ public string Id { get; private set; }
+
+ ///
+ /// Gets resource name.
+ ///
+ [JsonProperty(PropertyName = "name")]
+ public string Name { get; private set; }
+
+ ///
+ /// Gets resource type.
+ ///
+ [JsonProperty(PropertyName = "type")]
+ public string Type { get; private set; }
+
+ ///
+ /// Gets resource tags.
+ ///
+ [JsonProperty(PropertyName = "tags")]
+ public IDictionary Tags { get; private set; }
+
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Scope.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Scope.cs
new file mode 100644
index 000000000000..daeac5d6a1f9
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Scope.cs
@@ -0,0 +1,73 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// The Scope model definition
+ ///
+ public partial class Scope
+ {
+ ///
+ /// Initializes a new instance of the Scope class.
+ ///
+ public Scope()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the Scope class.
+ ///
+ /// Scope id
+ /// Scope name
+ /// Scope type
+ public Scope(string id = default(string), string name = default(string), string type = default(string), Scope childScope = default(Scope))
+ {
+ Id = id;
+ Name = name;
+ Type = type;
+ ChildScope = childScope;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets scope id
+ ///
+ [JsonProperty(PropertyName = "id")]
+ public string Id { get; set; }
+
+ ///
+ /// Gets or sets scope name
+ ///
+ [JsonProperty(PropertyName = "name")]
+ public string Name { get; set; }
+
+ ///
+ /// Gets or sets scope type
+ ///
+ [JsonProperty(PropertyName = "type")]
+ public string Type { get; set; }
+
+ ///
+ ///
+ [JsonProperty(PropertyName = "childScope")]
+ public Scope ChildScope { get; set; }
+
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/TimeGrainType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/TimeGrainType.cs
new file mode 100644
index 000000000000..6db6f5f3cb8a
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/TimeGrainType.cs
@@ -0,0 +1,23 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+
+ ///
+ /// Defines values for TimeGrainType.
+ ///
+ public static class TimeGrainType
+ {
+ public const string Monthly = "Monthly";
+ public const string Quarterly = "Quarterly";
+ public const string Annually = "Annually";
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/TimeframeType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/TimeframeType.cs
new file mode 100644
index 000000000000..9dd044fc073d
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/TimeframeType.cs
@@ -0,0 +1,24 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+
+ ///
+ /// Defines values for TimeframeType.
+ ///
+ public static class TimeframeType
+ {
+ public const string WeekToDate = "WeekToDate";
+ public const string MonthToDate = "MonthToDate";
+ public const string YearToDate = "YearToDate";
+ public const string Custom = "Custom";
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/View.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/View.cs
new file mode 100644
index 000000000000..af80e43c9a91
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/View.cs
@@ -0,0 +1,245 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Serialization;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ ///
+ /// States and configurations of Cost Analysis.
+ ///
+ [Rest.Serialization.JsonTransformation]
+ public partial class View : ProxyResource
+ {
+ ///
+ /// Initializes a new instance of the View class.
+ ///
+ public View()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the View class.
+ ///
+ /// The time frame for pulling data for the
+ /// report. If custom, then a specific time period must be provided.
+ /// Possible values include: 'WeekToDate', 'MonthToDate', 'YearToDate',
+ /// 'Custom'
+ /// Resource Id.
+ /// Resource name.
+ /// Resource type.
+ /// eTag of the resource. To handle concurrent
+ /// update scenario, this field will be used to determine whether the
+ /// user is updating the latest version or not.
+ /// User input name of the view.
+ /// Required.
+ /// Cost Management scope to save the view on. 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.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
+ /// for BillingProfile scope,
+ /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}'
+ /// for InvoiceSection scope,
+ /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}'
+ /// for Management Group scope,
+ /// '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}'
+ /// for ExternalBillingAccount scope, and
+ /// '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}'
+ /// for ExternalSubscription scope.
+ /// Date the user created this view.
+ /// Date when the user last modified this
+ /// view.
+ /// Has time period for pulling data for the
+ /// report.
+ /// Has definition for data in this report
+ /// config.
+ /// Chart type of the main view in Cost Analysis.
+ /// Required. Possible values include: 'Area', 'Line', 'StackedColumn',
+ /// 'GroupedColumn', 'Table'
+ /// Show costs accumulated over time.
+ /// Possible values include: 'true', 'false'
+ /// Metric to use when displaying costs. Possible
+ /// values include: 'ActualCost', 'AmortizedCost', 'AHUB'
+ /// List of KPIs to show in Cost Analysis
+ /// UI.
+ /// Configuration of 3 sub-views in the Cost
+ /// Analysis UI.
+ public View(string timeframe, string id = default(string), string name = default(string), string type = default(string), string eTag = default(string), string displayName = default(string), string scope = default(string), System.DateTime? createdOn = default(System.DateTime?), System.DateTime? modifiedOn = default(System.DateTime?), ReportConfigTimePeriod timePeriod = default(ReportConfigTimePeriod), ReportConfigDataset dataset = default(ReportConfigDataset), string chart = default(string), string accumulated = default(string), string metric = default(string), IList kpis = default(IList), IList pivots = default(IList))
+ : base(id, name, type, eTag)
+ {
+ DisplayName = displayName;
+ Scope = scope;
+ CreatedOn = createdOn;
+ ModifiedOn = modifiedOn;
+ Timeframe = timeframe;
+ TimePeriod = timePeriod;
+ Dataset = dataset;
+ Chart = chart;
+ Accumulated = accumulated;
+ Metric = metric;
+ Kpis = kpis;
+ Pivots = pivots;
+ CustomInit();
+ }
+ ///
+ /// Static constructor for View class.
+ ///
+ static View()
+ {
+ ViewType = "Usage";
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets user input name of the view. Required.
+ ///
+ [JsonProperty(PropertyName = "properties.displayName")]
+ public string DisplayName { get; set; }
+
+ ///
+ /// Gets or sets cost Management scope to save the view on. 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.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
+ /// for BillingProfile scope,
+ /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}'
+ /// for InvoiceSection scope,
+ /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}'
+ /// for Management Group scope,
+ /// '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}'
+ /// for ExternalBillingAccount scope, and
+ /// '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}'
+ /// for ExternalSubscription scope.
+ ///
+ [JsonProperty(PropertyName = "properties.scope")]
+ public string Scope { get; set; }
+
+ ///
+ /// Gets date the user created this view.
+ ///
+ [JsonProperty(PropertyName = "properties.createdOn")]
+ public System.DateTime? CreatedOn { get; private set; }
+
+ ///
+ /// Gets date when the user last modified this view.
+ ///
+ [JsonProperty(PropertyName = "properties.modifiedOn")]
+ public System.DateTime? ModifiedOn { get; private set; }
+
+ ///
+ /// Gets or sets the time frame for pulling data for the report. If
+ /// custom, then a specific time period must be provided. Possible
+ /// values include: 'WeekToDate', 'MonthToDate', 'YearToDate', 'Custom'
+ ///
+ [JsonProperty(PropertyName = "properties.query.timeframe")]
+ public string Timeframe { get; set; }
+
+ ///
+ /// Gets or sets has time period for pulling data for the report.
+ ///
+ [JsonProperty(PropertyName = "properties.query.timePeriod")]
+ public ReportConfigTimePeriod TimePeriod { get; set; }
+
+ ///
+ /// Gets or sets has definition for data in this report config.
+ ///
+ [JsonProperty(PropertyName = "properties.query.dataset")]
+ public ReportConfigDataset Dataset { get; set; }
+
+ ///
+ /// Gets or sets chart type of the main view in Cost Analysis.
+ /// Required. Possible values include: 'Area', 'Line', 'StackedColumn',
+ /// 'GroupedColumn', 'Table'
+ ///
+ [JsonProperty(PropertyName = "properties.chart")]
+ public string Chart { get; set; }
+
+ ///
+ /// Gets or sets show costs accumulated over time. Possible values
+ /// include: 'true', 'false'
+ ///
+ [JsonProperty(PropertyName = "properties.accumulated")]
+ public string Accumulated { get; set; }
+
+ ///
+ /// Gets or sets metric to use when displaying costs. Possible values
+ /// include: 'ActualCost', 'AmortizedCost', 'AHUB'
+ ///
+ [JsonProperty(PropertyName = "properties.metric")]
+ public string Metric { get; set; }
+
+ ///
+ /// Gets or sets list of KPIs to show in Cost Analysis UI.
+ ///
+ [JsonProperty(PropertyName = "properties.kpis")]
+ public IList Kpis { get; set; }
+
+ ///
+ /// Gets or sets configuration of 3 sub-views in the Cost Analysis UI.
+ ///
+ [JsonProperty(PropertyName = "properties.pivots")]
+ public IList Pivots { get; set; }
+
+ ///
+ /// The type of the report. Usage represents actual usage, forecast
+ /// represents forecasted data and UsageAndForecast represents both
+ /// usage and forecasted data. Actual usage and forecasted data can be
+ /// differentiated based on dates.
+ ///
+ [JsonProperty(PropertyName = "properties.query.type")]
+ public static string ViewType { get; private set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public virtual void Validate()
+ {
+ if (Timeframe == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "Timeframe");
+ }
+ if (TimePeriod != null)
+ {
+ TimePeriod.Validate();
+ }
+ if (Dataset != null)
+ {
+ Dataset.Validate();
+ }
+ }
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Operations.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Operations.cs
new file mode 100644
index 000000000000..72bbdd61c1c1
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Operations.cs
@@ -0,0 +1,390 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement
+{
+ 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;
+
+ ///
+ /// Operations operations.
+ ///
+ internal partial class Operations : IServiceOperations, IOperations
+ {
+ ///
+ /// Initializes a new instance of the Operations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal Operations(CostManagementClient client)
+ {
+ if (client == null)
+ {
+ throw new System.ArgumentNullException("client");
+ }
+ Client = client;
+ }
+
+ ///
+ /// Gets a reference to the CostManagementClient
+ ///
+ public CostManagementClient Client { get; private set; }
+
+ ///
+ /// Lists all of the available consumption REST API operations.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ 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("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.CostManagement/operations").ToString();
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Lists all of the available consumption REST API operations.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (nextPageLink == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("nextPageLink", nextPageLink);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters);
+ }
+ // Construct URL
+ string _url = "{nextLink}";
+ _url = _url.Replace("{nextLink}", nextPageLink);
+ List _queryParameters = new List();
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/OperationsExtensions.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/OperationsExtensions.cs
new file mode 100644
index 000000000000..033cb34492ea
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/OperationsExtensions.cs
@@ -0,0 +1,87 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// Extension methods for Operations.
+ ///
+ public static partial class OperationsExtensions
+ {
+ ///
+ /// Lists all of the available consumption REST API operations.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ public static IPage List(this IOperations operations)
+ {
+ return operations.ListAsync().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Lists all of the available consumption REST API operations.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListAsync(this IOperations operations, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Lists all of the available consumption REST API operations.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ public static IPage ListNext(this IOperations operations, string nextPageLink)
+ {
+ return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Lists all of the available consumption REST API operations.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListNextAsync(this IOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/SdkInfo_CostManagementClient.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/SdkInfo_CostManagementClient.cs
new file mode 100644
index 000000000000..a080a4adaaa0
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/SdkInfo_CostManagementClient.cs
@@ -0,0 +1,30 @@
+
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ internal static partial class SdkInfo
+ {
+ public static IEnumerable> ApiInfo_CostManagementClient
+ {
+ get
+ {
+ return new Tuple[]
+ {
+ new Tuple("CostManagement", "Budget", "2019-04-01-preview"),
+ new Tuple("CostManagement", "Budgets", "2019-04-01-preview"),
+ new Tuple("CostManagement", "Operations", "2019-04-01-preview"),
+ new Tuple("CostManagement", "Views", "2019-04-01-preview"),
+ }.AsEnumerable();
+ }
+ }
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ViewsOperations.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ViewsOperations.cs
new file mode 100644
index 000000000000..f13c10f809fc
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ViewsOperations.cs
@@ -0,0 +1,1944 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement
+{
+ 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;
+
+ ///
+ /// ViewsOperations operations.
+ ///
+ internal partial class ViewsOperations : IServiceOperations, IViewsOperations
+ {
+ ///
+ /// Initializes a new instance of the ViewsOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal ViewsOperations(CostManagementClient client)
+ {
+ if (client == null)
+ {
+ throw new System.ArgumentNullException("client");
+ }
+ Client = client;
+ }
+
+ ///
+ /// Gets a reference to the CostManagementClient
+ ///
+ public CostManagementClient Client { get; private set; }
+
+ ///
+ /// Lists all views by tenant and object.
+ ///
+ ///
+ ///
+ /// Headers that 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ 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("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.CostManagement/views").ToString();
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Lists all views at the given scope.
+ ///
+ ///
+ ///
+ /// The scope associated with view 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.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
+ /// for BillingProfile scope,
+ /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}'
+ /// for InvoiceSection scope,
+ /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for
+ /// Management Group scope,
+ /// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}'
+ /// for External Billing Account scope and
+ /// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}'
+ /// for External Subscription 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>> ListByScopeWithHttpMessagesAsync(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, "ListByScope", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.CostManagement/views").ToString();
+ _url = _url.Replace("{scope}", System.Uri.EscapeDataString(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 view by view name.
+ ///
+ ///
+ ///
+ /// View 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 viewName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (viewName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "viewName");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("viewName", viewName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.CostManagement/views/{viewName}").ToString();
+ _url = _url.Replace("{viewName}", System.Uri.EscapeDataString(viewName));
+ 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 view. Update operation requires latest
+ /// eTag to be set in the request. You may obtain the latest eTag by performing
+ /// a get operation. Create operation does not require eTag.
+ ///
+ ///
+ ///
+ /// View name
+ ///
+ ///
+ /// Parameters supplied to the CreateOrUpdate View 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 viewName, View parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (viewName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "viewName");
+ }
+ 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("viewName", viewName);
+ 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("/") ? "" : "/")), "providers/Microsoft.CostManagement/views/{viewName}").ToString();
+ _url = _url.Replace("{viewName}", System.Uri.EscapeDataString(viewName));
+ 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 view.
+ ///
+ ///
+ ///
+ /// View 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 viewName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (viewName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "viewName");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("viewName", viewName);
+ 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("/") ? "" : "/")), "providers/Microsoft.CostManagement/views/{viewName}").ToString();
+ _url = _url.Replace("{viewName}", System.Uri.EscapeDataString(viewName));
+ 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 && (int)_statusCode != 204)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Gets the view for the defined scope by view name.
+ ///
+ ///
+ ///
+ /// The scope associated with view 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.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
+ /// for BillingProfile scope,
+ /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}'
+ /// for InvoiceSection scope,
+ /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for
+ /// Management Group scope,
+ /// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}'
+ /// for External Billing Account scope and
+ /// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}'
+ /// for External Subscription scope.
+ ///
+ ///
+ /// View 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> GetByScopeWithHttpMessagesAsync(string scope, string viewName, 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 (viewName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "viewName");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("scope", scope);
+ tracingParameters.Add("viewName", viewName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "GetByScope", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.CostManagement/views/{viewName}").ToString();
+ _url = _url.Replace("{scope}", System.Uri.EscapeDataString(scope));
+ _url = _url.Replace("{viewName}", System.Uri.EscapeDataString(viewName));
+ 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 view. Update operation requires latest
+ /// eTag to be set in the request. You may obtain the latest eTag by performing
+ /// a get operation. Create operation does not require eTag.
+ ///
+ ///
+ ///
+ /// The scope associated with view 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.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
+ /// for BillingProfile scope,
+ /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}'
+ /// for InvoiceSection scope,
+ /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for
+ /// Management Group scope,
+ /// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}'
+ /// for External Billing Account scope and
+ /// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}'
+ /// for External Subscription scope.
+ ///
+ ///
+ /// View name
+ ///
+ ///
+ /// Parameters supplied to the CreateOrUpdate View 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> CreateOrUpdateByScopeWithHttpMessagesAsync(string scope, string viewName, View 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 (viewName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "viewName");
+ }
+ 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("viewName", viewName);
+ tracingParameters.Add("parameters", parameters);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdateByScope", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.CostManagement/views/{viewName}").ToString();
+ _url = _url.Replace("{scope}", System.Uri.EscapeDataString(scope));
+ _url = _url.Replace("{viewName}", System.Uri.EscapeDataString(viewName));
+ 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 view.
+ ///
+ ///
+ ///
+ /// The scope associated with view 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.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}'
+ /// for BillingProfile scope,
+ /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}'
+ /// for InvoiceSection scope,
+ /// 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for
+ /// Management Group scope,
+ /// 'providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}'
+ /// for External Billing Account scope and
+ /// 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}'
+ /// for External Subscription scope.
+ ///
+ ///
+ /// View 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 DeleteByScopeWithHttpMessagesAsync(string scope, string viewName, 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 (viewName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "viewName");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("scope", scope);
+ tracingParameters.Add("viewName", viewName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "DeleteByScope", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.CostManagement/views/{viewName}").ToString();
+ _url = _url.Replace("{scope}", System.Uri.EscapeDataString(scope));
+ _url = _url.Replace("{viewName}", System.Uri.EscapeDataString(viewName));
+ 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 && (int)_statusCode != 204)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Lists all views by tenant and object.
+ ///
+ ///
+ ///
+ /// 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;
+ }
+
+ ///
+ /// Lists all views at the given 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>> ListByScopeNextWithHttpMessagesAsync(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, "ListByScopeNext", 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