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..7939620496ca
--- /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-11-01.
+ ///
+ 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 IDimensionsOperations.
+ ///
+ public virtual IDimensionsOperations Dimensions { get; private set; }
+
+ ///
+ /// Gets the IQueryOperations.
+ ///
+ public virtual IQueryOperations Query { get; private set; }
+
+ ///
+ /// Gets the IExportsOperations.
+ ///
+ public virtual IExportsOperations Exports { 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()
+ {
+ Dimensions = new DimensionsOperations(this);
+ Query = new QueryOperations(this);
+ Exports = new ExportsOperations(this);
+ Operations = new Operations(this);
+ BaseUri = new System.Uri("https://management.azure.com");
+ ApiVersion = "2019-11-01";
+ 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/DimensionsOperations.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/DimensionsOperations.cs
new file mode 100644
index 000000000000..e415497185d9
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/DimensionsOperations.cs
@@ -0,0 +1,273 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated 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.Azure.OData;
+ 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;
+
+ ///
+ /// DimensionsOperations operations.
+ ///
+ internal partial class DimensionsOperations : IServiceOperations, IDimensionsOperations
+ {
+ ///
+ /// Initializes a new instance of the DimensionsOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal DimensionsOperations(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 the dimensions by the defined scope.
+ ///
+ ///
+ ///
+ /// The scope associated with dimension 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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope, and
+ /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}'
+ /// specific for partners.
+ ///
+ ///
+ /// OData parameters to apply to the operation.
+ ///
+ ///
+ /// Skiptoken is only used if a previous operation returned a partial result.
+ /// If a previous response contains a nextLink element, the value of the
+ /// nextLink element will include a skiptoken parameter that specifies a
+ /// starting point to use for subsequent calls.
+ ///
+ ///
+ /// Headers that 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, ODataQuery odataQuery = default(ODataQuery), string skiptoken = default(string), 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("odataQuery", odataQuery);
+ tracingParameters.Add("scope", scope);
+ tracingParameters.Add("skiptoken", skiptoken);
+ 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/dimensions").ToString();
+ _url = _url.Replace("{scope}", scope);
+ List _queryParameters = new List();
+ if (odataQuery != null)
+ {
+ var _odataFilter = odataQuery.ToString();
+ if (!string.IsNullOrEmpty(_odataFilter))
+ {
+ _queryParameters.Add(_odataFilter);
+ }
+ }
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (skiptoken != null)
+ {
+ _queryParameters.Add(string.Format("$skiptoken={0}", System.Uri.EscapeDataString(skiptoken)));
+ }
+ 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/DimensionsOperationsExtensions.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/DimensionsOperationsExtensions.cs
new file mode 100644
index 000000000000..08c9528dee05
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/DimensionsOperationsExtensions.cs
@@ -0,0 +1,116 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated 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.Azure.OData;
+ using Models;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// Extension methods for DimensionsOperations.
+ ///
+ public static partial class DimensionsOperationsExtensions
+ {
+ ///
+ /// Lists the dimensions by the defined scope.
+ ///
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The scope associated with dimension 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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope, and
+ /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}'
+ /// specific for partners.
+ ///
+ ///
+ /// OData parameters to apply to the operation.
+ ///
+ ///
+ /// Skiptoken is only used if a previous operation returned a partial result.
+ /// If a previous response contains a nextLink element, the value of the
+ /// nextLink element will include a skiptoken parameter that specifies a
+ /// starting point to use for subsequent calls.
+ ///
+ public static IEnumerable List(this IDimensionsOperations operations, string scope, ODataQuery odataQuery = default(ODataQuery), string skiptoken = default(string))
+ {
+ return operations.ListAsync(scope, odataQuery, skiptoken).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Lists the dimensions by the defined scope.
+ ///
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The scope associated with dimension 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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope, and
+ /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}'
+ /// specific for partners.
+ ///
+ ///
+ /// OData parameters to apply to the operation.
+ ///
+ ///
+ /// Skiptoken is only used if a previous operation returned a partial result.
+ /// If a previous response contains a nextLink element, the value of the
+ /// nextLink element will include a skiptoken parameter that specifies a
+ /// starting point to use for subsequent calls.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListAsync(this IDimensionsOperations operations, string scope, ODataQuery odataQuery = default(ODataQuery), string skiptoken = default(string), CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListWithHttpMessagesAsync(scope, odataQuery, skiptoken, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ExportsOperations.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ExportsOperations.cs
new file mode 100644
index 000000000000..6b30a16291ea
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ExportsOperations.cs
@@ -0,0 +1,1266 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated 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;
+
+ ///
+ /// ExportsOperations operations.
+ ///
+ internal partial class ExportsOperations : IServiceOperations, IExportsOperations
+ {
+ ///
+ /// Initializes a new instance of the ExportsOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal ExportsOperations(CostManagementClient client)
+ {
+ if (client == null)
+ {
+ throw new System.ArgumentNullException("client");
+ }
+ Client = client;
+ }
+
+ ///
+ /// Gets a reference to the CostManagementClient
+ ///
+ public CostManagementClient Client { get; private set; }
+
+ ///
+ /// The operation to list all exports at the given scope.
+ ///
+ ///
+ ///
+ /// The scope associated with query and export operations. This includes
+ /// '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
+ /// resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
+ /// Billing Account scope and
+ /// '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope, and
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}'
+ /// specific for partners.
+ ///
+ ///
+ /// Headers that 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/exports").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;
+ }
+
+ ///
+ /// The operation to get the export for the defined scope by export name.
+ ///
+ ///
+ ///
+ /// The scope associated with query and export operations. This includes
+ /// '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
+ /// resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
+ /// Billing Account scope and
+ /// '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope, and
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}'
+ /// specific for partners.
+ ///
+ ///
+ /// Export 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 exportName, 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 (exportName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "exportName");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("scope", scope);
+ tracingParameters.Add("exportName", exportName);
+ 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/exports/{exportName}").ToString();
+ _url = _url.Replace("{scope}", scope);
+ _url = _url.Replace("{exportName}", System.Uri.EscapeDataString(exportName));
+ 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 export. 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 query and export operations. This includes
+ /// '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
+ /// resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
+ /// Billing Account scope and
+ /// '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope, and
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}'
+ /// specific for partners.
+ ///
+ ///
+ /// Export Name.
+ ///
+ ///
+ /// Parameters supplied to the CreateOrUpdate Export 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 exportName, Export 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 (exportName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "exportName");
+ }
+ 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("exportName", exportName);
+ 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/exports/{exportName}").ToString();
+ _url = _url.Replace("{scope}", scope);
+ _url = _url.Replace("{exportName}", System.Uri.EscapeDataString(exportName));
+ 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 export.
+ ///
+ ///
+ ///
+ /// The scope associated with query and export operations. This includes
+ /// '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
+ /// resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
+ /// Billing Account scope and
+ /// '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope, and
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}'
+ /// specific for partners.
+ ///
+ ///
+ /// Export 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 exportName, 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 (exportName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "exportName");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("scope", scope);
+ tracingParameters.Add("exportName", exportName);
+ 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/exports/{exportName}").ToString();
+ _url = _url.Replace("{scope}", scope);
+ _url = _url.Replace("{exportName}", System.Uri.EscapeDataString(exportName));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("DELETE");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// The operation to execute a export.
+ ///
+ ///
+ ///
+ /// The scope associated with query and export operations. This includes
+ /// '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
+ /// resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
+ /// Billing Account scope and
+ /// '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope, and
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}'
+ /// specific for partners.
+ ///
+ ///
+ /// Export 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 ExecuteWithHttpMessagesAsync(string scope, string exportName, 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 (exportName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "exportName");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("scope", scope);
+ tracingParameters.Add("exportName", exportName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "Execute", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.CostManagement/exports/{exportName}/run").ToString();
+ _url = _url.Replace("{scope}", scope);
+ _url = _url.Replace("{exportName}", System.Uri.EscapeDataString(exportName));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("POST");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// The operation to get the execution history of an export for the defined
+ /// scope by export name.
+ ///
+ ///
+ ///
+ /// The scope associated with query and export operations. This includes
+ /// '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
+ /// resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
+ /// Billing Account scope and
+ /// '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope, and
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}'
+ /// specific for partners.
+ ///
+ ///
+ /// Export 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> GetExecutionHistoryWithHttpMessagesAsync(string scope, string exportName, 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 (exportName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "exportName");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("scope", scope);
+ tracingParameters.Add("exportName", exportName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "GetExecutionHistory", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.CostManagement/exports/{exportName}/runHistory").ToString();
+ _url = _url.Replace("{scope}", scope);
+ _url = _url.Replace("{exportName}", System.Uri.EscapeDataString(exportName));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ExportsOperationsExtensions.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ExportsOperationsExtensions.cs
new file mode 100644
index 000000000000..194a7f2885c0
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ExportsOperationsExtensions.cs
@@ -0,0 +1,481 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated 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 ExportsOperations.
+ ///
+ public static partial class ExportsOperationsExtensions
+ {
+ ///
+ /// The operation to list all exports at the given scope.
+ ///
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The scope associated with query and export operations. This includes
+ /// '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
+ /// resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
+ /// Billing Account scope and
+ /// '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope, and
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}'
+ /// specific for partners.
+ ///
+ public static ExportListResult List(this IExportsOperations operations, string scope)
+ {
+ return operations.ListAsync(scope).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// The operation to list all exports at the given scope.
+ ///
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The scope associated with query and export operations. This includes
+ /// '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
+ /// resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
+ /// Billing Account scope and
+ /// '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope, and
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}'
+ /// specific for partners.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task ListAsync(this IExportsOperations operations, string scope, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListWithHttpMessagesAsync(scope, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// The operation to get the export for the defined scope by export name.
+ ///
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The scope associated with query and export operations. This includes
+ /// '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
+ /// resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
+ /// Billing Account scope and
+ /// '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope, and
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}'
+ /// specific for partners.
+ ///
+ ///
+ /// Export Name.
+ ///
+ public static Export Get(this IExportsOperations operations, string scope, string exportName)
+ {
+ return operations.GetAsync(scope, exportName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// The operation to get the export for the defined scope by export name.
+ ///
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The scope associated with query and export operations. This includes
+ /// '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
+ /// resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
+ /// Billing Account scope and
+ /// '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope, and
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}'
+ /// specific for partners.
+ ///
+ ///
+ /// Export Name.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task GetAsync(this IExportsOperations operations, string scope, string exportName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.GetWithHttpMessagesAsync(scope, exportName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// The operation to create or update a export. 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 operations group for this extension method.
+ ///
+ ///
+ /// The scope associated with query and export operations. This includes
+ /// '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
+ /// resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
+ /// Billing Account scope and
+ /// '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope, and
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}'
+ /// specific for partners.
+ ///
+ ///
+ /// Export Name.
+ ///
+ ///
+ /// Parameters supplied to the CreateOrUpdate Export operation.
+ ///
+ public static Export CreateOrUpdate(this IExportsOperations operations, string scope, string exportName, Export parameters)
+ {
+ return operations.CreateOrUpdateAsync(scope, exportName, parameters).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// The operation to create or update a export. 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 operations group for this extension method.
+ ///
+ ///
+ /// The scope associated with query and export operations. This includes
+ /// '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
+ /// resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
+ /// Billing Account scope and
+ /// '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope, and
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}'
+ /// specific for partners.
+ ///
+ ///
+ /// Export Name.
+ ///
+ ///
+ /// Parameters supplied to the CreateOrUpdate Export operation.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task CreateOrUpdateAsync(this IExportsOperations operations, string scope, string exportName, Export parameters, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(scope, exportName, parameters, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// The operation to delete a export.
+ ///
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The scope associated with query and export operations. This includes
+ /// '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
+ /// resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
+ /// Billing Account scope and
+ /// '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope, and
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}'
+ /// specific for partners.
+ ///
+ ///
+ /// Export Name.
+ ///
+ public static void Delete(this IExportsOperations operations, string scope, string exportName)
+ {
+ operations.DeleteAsync(scope, exportName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// The operation to delete a export.
+ ///
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The scope associated with query and export operations. This includes
+ /// '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
+ /// resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
+ /// Billing Account scope and
+ /// '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope, and
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}'
+ /// specific for partners.
+ ///
+ ///
+ /// Export Name.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task DeleteAsync(this IExportsOperations operations, string scope, string exportName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ (await operations.DeleteWithHttpMessagesAsync(scope, exportName, null, cancellationToken).ConfigureAwait(false)).Dispose();
+ }
+
+ ///
+ /// The operation to execute a export.
+ ///
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The scope associated with query and export operations. This includes
+ /// '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
+ /// resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
+ /// Billing Account scope and
+ /// '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope, and
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}'
+ /// specific for partners.
+ ///
+ ///
+ /// Export Name.
+ ///
+ public static void Execute(this IExportsOperations operations, string scope, string exportName)
+ {
+ operations.ExecuteAsync(scope, exportName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// The operation to execute a export.
+ ///
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The scope associated with query and export operations. This includes
+ /// '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
+ /// resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
+ /// Billing Account scope and
+ /// '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope, and
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}'
+ /// specific for partners.
+ ///
+ ///
+ /// Export Name.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task ExecuteAsync(this IExportsOperations operations, string scope, string exportName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ (await operations.ExecuteWithHttpMessagesAsync(scope, exportName, null, cancellationToken).ConfigureAwait(false)).Dispose();
+ }
+
+ ///
+ /// The operation to get the execution history of an export for the defined
+ /// scope by export name.
+ ///
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The scope associated with query and export operations. This includes
+ /// '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
+ /// resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
+ /// Billing Account scope and
+ /// '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope, and
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}'
+ /// specific for partners.
+ ///
+ ///
+ /// Export Name.
+ ///
+ public static ExportExecutionListResult GetExecutionHistory(this IExportsOperations operations, string scope, string exportName)
+ {
+ return operations.GetExecutionHistoryAsync(scope, exportName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// The operation to get the execution history of an export for the defined
+ /// scope by export name.
+ ///
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The scope associated with query and export operations. This includes
+ /// '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
+ /// resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
+ /// Billing Account scope and
+ /// '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope, and
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}'
+ /// specific for partners.
+ ///
+ ///
+ /// Export Name.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task GetExecutionHistoryAsync(this IExportsOperations operations, string scope, string exportName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.GetExecutionHistoryWithHttpMessagesAsync(scope, exportName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ }
+}
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..6b8c7b53105a
--- /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-11-01.
+ ///
+ 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 IDimensionsOperations.
+ ///
+ IDimensionsOperations Dimensions { get; }
+
+ ///
+ /// Gets the IQueryOperations.
+ ///
+ IQueryOperations Query { get; }
+
+ ///
+ /// Gets the IExportsOperations.
+ ///
+ IExportsOperations Exports { get; }
+
+ ///
+ /// Gets the IOperations.
+ ///
+ IOperations Operations { get; }
+
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IDimensionsOperations.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IDimensionsOperations.cs
new file mode 100644
index 000000000000..5b0a408e5d2f
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IDimensionsOperations.cs
@@ -0,0 +1,77 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated 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.Azure.OData;
+ using Models;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// DimensionsOperations operations.
+ ///
+ public partial interface IDimensionsOperations
+ {
+ ///
+ /// Lists the dimensions by the defined scope.
+ ///
+ ///
+ ///
+ /// The scope associated with dimension 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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope, and
+ /// 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}'
+ /// specific for partners.
+ ///
+ ///
+ /// OData parameters to apply to the operation.
+ ///
+ ///
+ /// Skiptoken is only used if a previous operation returned a partial
+ /// result. If a previous response contains a nextLink element, the
+ /// value of the nextLink element will include a skiptoken parameter
+ /// that specifies a starting point to use for subsequent calls.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListWithHttpMessagesAsync(string scope, ODataQuery odataQuery = default(ODataQuery), string skiptoken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IExportsOperations.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IExportsOperations.cs
new file mode 100644
index 000000000000..15609ed8552e
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IExportsOperations.cs
@@ -0,0 +1,284 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated 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;
+
+ ///
+ /// ExportsOperations operations.
+ ///
+ public partial interface IExportsOperations
+ {
+ ///
+ /// The operation to list all exports at the given scope.
+ ///
+ ///
+ ///
+ /// The scope associated with query and export operations. This
+ /// includes '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}'
+ /// for resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}'
+ /// for Billing Account scope and
+ /// '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope, and
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}'
+ /// specific for partners.
+ ///
+ ///
+ /// 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));
+ ///
+ /// The operation to get the export for the defined scope by export
+ /// name.
+ ///
+ ///
+ ///
+ /// The scope associated with query and export operations. This
+ /// includes '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}'
+ /// for resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}'
+ /// for Billing Account scope and
+ /// '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope, and
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}'
+ /// specific for partners.
+ ///
+ ///
+ /// Export 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 exportName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// The operation to create or update a export. 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 query and export operations. This
+ /// includes '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}'
+ /// for resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}'
+ /// for Billing Account scope and
+ /// '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope, and
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}'
+ /// specific for partners.
+ ///
+ ///
+ /// Export Name.
+ ///
+ ///
+ /// Parameters supplied to the CreateOrUpdate Export 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 exportName, Export parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// The operation to delete a export.
+ ///
+ ///
+ ///
+ /// The scope associated with query and export operations. This
+ /// includes '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}'
+ /// for resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}'
+ /// for Billing Account scope and
+ /// '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope, and
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}'
+ /// specific for partners.
+ ///
+ ///
+ /// Export 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 exportName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// The operation to execute a export.
+ ///
+ ///
+ ///
+ /// The scope associated with query and export operations. This
+ /// includes '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}'
+ /// for resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}'
+ /// for Billing Account scope and
+ /// '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope, and
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}'
+ /// specific for partners.
+ ///
+ ///
+ /// Export 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 ExecuteWithHttpMessagesAsync(string scope, string exportName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// The operation to get the execution history of an export for the
+ /// defined scope by export name.
+ ///
+ ///
+ ///
+ /// The scope associated with query and export operations. This
+ /// includes '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}'
+ /// for resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}'
+ /// for Billing Account scope and
+ /// '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope, and
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}'
+ /// specific for partners.
+ ///
+ ///
+ /// Export 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> GetExecutionHistoryWithHttpMessagesAsync(string scope, string exportName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ }
+}
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..40f06071f8b9
--- /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 cost management 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 cost management 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/IQueryOperations.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IQueryOperations.cs
new file mode 100644
index 000000000000..b0ddfd5dcabd
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IQueryOperations.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
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// QueryOperations operations.
+ ///
+ public partial interface IQueryOperations
+ {
+ ///
+ /// Query the usage data for scope defined.
+ ///
+ ///
+ ///
+ /// The scope associated with query and export operations. This
+ /// includes '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}'
+ /// for resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}'
+ /// for Billing Account scope and
+ /// '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope, and
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}'
+ /// specific for partners.
+ ///
+ ///
+ /// Parameters supplied to the CreateOrUpdate Query Config 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> UsageWithHttpMessagesAsync(string scope, QueryDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/CommonExportProperties.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/CommonExportProperties.cs
new file mode 100644
index 000000000000..ba1c809b913a
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/CommonExportProperties.cs
@@ -0,0 +1,97 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated 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 common properties of the export.
+ ///
+ public partial class CommonExportProperties
+ {
+ ///
+ /// Initializes a new instance of the CommonExportProperties class.
+ ///
+ public CommonExportProperties()
+ {
+ Definition = new QueryDefinition();
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the CommonExportProperties class.
+ ///
+ /// Has delivery information for the
+ /// export.
+ /// Has definition for the export.
+ /// The format of the export being delivered.
+ /// Possible values include: 'Csv'
+ public CommonExportProperties(ExportDeliveryInfo deliveryInfo, QueryDefinition definition, string format = default(string))
+ {
+ Format = format;
+ DeliveryInfo = deliveryInfo;
+ Definition = definition;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets the format of the export being delivered. Possible
+ /// values include: 'Csv'
+ ///
+ [JsonProperty(PropertyName = "format")]
+ public string Format { get; set; }
+
+ ///
+ /// Gets or sets has delivery information for the export.
+ ///
+ [JsonProperty(PropertyName = "deliveryInfo")]
+ public ExportDeliveryInfo DeliveryInfo { get; set; }
+
+ ///
+ /// Gets or sets has definition for the export.
+ ///
+ [JsonProperty(PropertyName = "definition")]
+ public QueryDefinition Definition { get; set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public virtual void Validate()
+ {
+ if (DeliveryInfo == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "DeliveryInfo");
+ }
+ if (Definition == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "Definition");
+ }
+ if (DeliveryInfo != null)
+ {
+ DeliveryInfo.Validate();
+ }
+ if (Definition != null)
+ {
+ Definition.Validate();
+ }
+ }
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Dimension.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Dimension.cs
new file mode 100644
index 000000000000..bedc1db5737d
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Dimension.cs
@@ -0,0 +1,121 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Serialization;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ [Rest.Serialization.JsonTransformation]
+ public partial class Dimension : Resource
+ {
+ ///
+ /// Initializes a new instance of the Dimension class.
+ ///
+ public Dimension()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the Dimension class.
+ ///
+ /// Resource Id.
+ /// Resource name.
+ /// Resource type.
+ /// Resource tags.
+ /// Dimension description.
+ /// Filter enabled.
+ /// Grouping enabled.
+ /// Total number of data for the dimension.
+ /// Dimension category.
+ /// Usage start.
+ /// Usage end.
+ /// The link (url) to the next page of
+ /// results.
+ public Dimension(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string description = default(string), bool? filterEnabled = default(bool?), bool? groupingEnabled = default(bool?), IList data = default(IList), int? total = default(int?), string category = default(string), System.DateTime? usageStart = default(System.DateTime?), System.DateTime? usageEnd = default(System.DateTime?), string nextLink = default(string))
+ : base(id, name, type, tags)
+ {
+ Description = description;
+ FilterEnabled = filterEnabled;
+ GroupingEnabled = groupingEnabled;
+ Data = data;
+ Total = total;
+ Category = category;
+ UsageStart = usageStart;
+ UsageEnd = usageEnd;
+ NextLink = nextLink;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets dimension description.
+ ///
+ [JsonProperty(PropertyName = "properties.description")]
+ public string Description { get; private set; }
+
+ ///
+ /// Gets filter enabled.
+ ///
+ [JsonProperty(PropertyName = "properties.filterEnabled")]
+ public bool? FilterEnabled { get; private set; }
+
+ ///
+ /// Gets grouping enabled.
+ ///
+ [JsonProperty(PropertyName = "properties.groupingEnabled")]
+ public bool? GroupingEnabled { get; private set; }
+
+ ///
+ ///
+ [JsonProperty(PropertyName = "properties.data")]
+ public IList Data { get; set; }
+
+ ///
+ /// Gets total number of data for the dimension.
+ ///
+ [JsonProperty(PropertyName = "properties.total")]
+ public int? Total { get; private set; }
+
+ ///
+ /// Gets dimension category.
+ ///
+ [JsonProperty(PropertyName = "properties.category")]
+ public string Category { get; private set; }
+
+ ///
+ /// Gets usage start.
+ ///
+ [JsonProperty(PropertyName = "properties.usageStart")]
+ public System.DateTime? UsageStart { get; private set; }
+
+ ///
+ /// Gets usage end.
+ ///
+ [JsonProperty(PropertyName = "properties.usageEnd")]
+ public System.DateTime? UsageEnd { get; private set; }
+
+ ///
+ /// Gets the link (url) to the next page of results.
+ ///
+ [JsonProperty(PropertyName = "properties.nextLink")]
+ public string NextLink { 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..f237d38c2015
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ErrorDetails.cs
@@ -0,0 +1,60 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// The details of the error.
+ ///
+ public partial class ErrorDetails
+ {
+ ///
+ /// Initializes a new instance of the ErrorDetails class.
+ ///
+ public ErrorDetails()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the ErrorDetails class.
+ ///
+ /// Error code.
+ /// Error message indicating why the operation
+ /// failed.
+ public ErrorDetails(string code = default(string), string message = default(string))
+ {
+ Code = code;
+ Message = message;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets error code.
+ ///
+ [JsonProperty(PropertyName = "code")]
+ public string Code { get; private set; }
+
+ ///
+ /// Gets error message indicating why the operation failed.
+ ///
+ [JsonProperty(PropertyName = "message")]
+ public string Message { get; private 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/ExecutionStatus.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ExecutionStatus.cs
new file mode 100644
index 000000000000..41f63b19afef
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ExecutionStatus.cs
@@ -0,0 +1,27 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated 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 ExecutionStatus.
+ ///
+ public static class ExecutionStatus
+ {
+ public const string Queued = "Queued";
+ public const string InProgress = "InProgress";
+ public const string Completed = "Completed";
+ public const string Failed = "Failed";
+ public const string Timeout = "Timeout";
+ public const string NewDataNotAvailable = "NewDataNotAvailable";
+ public const string DataNotAvailable = "DataNotAvailable";
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ExecutionType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ExecutionType.cs
new file mode 100644
index 000000000000..71632ddbe321
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ExecutionType.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 ExecutionType.
+ ///
+ public static class ExecutionType
+ {
+ public const string OnDemand = "OnDemand";
+ public const string Scheduled = "Scheduled";
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Export.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Export.cs
new file mode 100644
index 000000000000..5593baf589bf
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Export.cs
@@ -0,0 +1,119 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated 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 export resource.
+ ///
+ [Rest.Serialization.JsonTransformation]
+ public partial class Export : Resource
+ {
+ ///
+ /// Initializes a new instance of the Export class.
+ ///
+ public Export()
+ {
+ Definition = new QueryDefinition();
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the Export class.
+ ///
+ /// Has delivery information for the
+ /// export.
+ /// Has definition for the export.
+ /// Resource Id.
+ /// Resource name.
+ /// Resource type.
+ /// Resource tags.
+ /// The format of the export being delivered.
+ /// Possible values include: 'Csv'
+ /// Has schedule information for the
+ /// export.
+ public Export(ExportDeliveryInfo deliveryInfo, QueryDefinition definition, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string format = default(string), ExportSchedule schedule = default(ExportSchedule))
+ : base(id, name, type, tags)
+ {
+ Format = format;
+ DeliveryInfo = deliveryInfo;
+ Definition = definition;
+ Schedule = schedule;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets the format of the export being delivered. Possible
+ /// values include: 'Csv'
+ ///
+ [JsonProperty(PropertyName = "properties.format")]
+ public string Format { get; set; }
+
+ ///
+ /// Gets or sets has delivery information for the export.
+ ///
+ [JsonProperty(PropertyName = "properties.deliveryInfo")]
+ public ExportDeliveryInfo DeliveryInfo { get; set; }
+
+ ///
+ /// Gets or sets has definition for the export.
+ ///
+ [JsonProperty(PropertyName = "properties.definition")]
+ public QueryDefinition Definition { get; set; }
+
+ ///
+ /// Gets or sets has schedule information for the export.
+ ///
+ [JsonProperty(PropertyName = "properties.schedule")]
+ public ExportSchedule Schedule { get; set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public virtual void Validate()
+ {
+ if (DeliveryInfo == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "DeliveryInfo");
+ }
+ if (Definition == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "Definition");
+ }
+ if (DeliveryInfo != null)
+ {
+ DeliveryInfo.Validate();
+ }
+ if (Definition != null)
+ {
+ Definition.Validate();
+ }
+ if (Schedule != null)
+ {
+ Schedule.Validate();
+ }
+ }
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ExportDeliveryDestination.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ExportDeliveryDestination.cs
new file mode 100644
index 000000000000..59ebff5a5c10
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ExportDeliveryDestination.cs
@@ -0,0 +1,98 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated 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 destination information for the delivery of the export. To allow
+ /// access to a storage account, you must register the account's
+ /// subscription with the Microsoft.CostManagementExports resource
+ /// provider. This is required once per subscription. When creating an
+ /// export in the Azure portal, it is done automatically, however API users
+ /// need to register the subscription. For more information see
+ /// https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-supported-services
+ /// .
+ ///
+ public partial class ExportDeliveryDestination
+ {
+ ///
+ /// Initializes a new instance of the ExportDeliveryDestination class.
+ ///
+ public ExportDeliveryDestination()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the ExportDeliveryDestination class.
+ ///
+ /// The resource id of the storage account
+ /// where exports will be delivered.
+ /// The name of the container where exports
+ /// will be uploaded.
+ /// The name of the directory where
+ /// exports will be uploaded.
+ public ExportDeliveryDestination(string resourceId, string container, string rootFolderPath = default(string))
+ {
+ ResourceId = resourceId;
+ Container = container;
+ RootFolderPath = rootFolderPath;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets the resource id of the storage account where exports
+ /// will be delivered.
+ ///
+ [JsonProperty(PropertyName = "resourceId")]
+ public string ResourceId { get; set; }
+
+ ///
+ /// Gets or sets the name of the container where exports will be
+ /// uploaded.
+ ///
+ [JsonProperty(PropertyName = "container")]
+ public string Container { get; set; }
+
+ ///
+ /// Gets or sets the name of the directory where exports will be
+ /// uploaded.
+ ///
+ [JsonProperty(PropertyName = "rootFolderPath")]
+ public string RootFolderPath { get; set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public virtual void Validate()
+ {
+ if (ResourceId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "ResourceId");
+ }
+ if (Container == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "Container");
+ }
+ }
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ExportDeliveryInfo.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ExportDeliveryInfo.cs
new file mode 100644
index 000000000000..cc3ce7ad1f54
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ExportDeliveryInfo.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 Microsoft.Rest;
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// The delivery information associated with a export.
+ ///
+ public partial class ExportDeliveryInfo
+ {
+ ///
+ /// Initializes a new instance of the ExportDeliveryInfo class.
+ ///
+ public ExportDeliveryInfo()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the ExportDeliveryInfo class.
+ ///
+ /// Has destination for the export being
+ /// delivered.
+ public ExportDeliveryInfo(ExportDeliveryDestination destination)
+ {
+ Destination = destination;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets has destination for the export being delivered.
+ ///
+ [JsonProperty(PropertyName = "destination")]
+ public ExportDeliveryDestination Destination { get; set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public virtual void Validate()
+ {
+ if (Destination == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "Destination");
+ }
+ if (Destination != null)
+ {
+ Destination.Validate();
+ }
+ }
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ExportExecution.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ExportExecution.cs
new file mode 100644
index 000000000000..9e330783fbd9
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ExportExecution.cs
@@ -0,0 +1,143 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated 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 export execution.
+ ///
+ [Rest.Serialization.JsonTransformation]
+ public partial class ExportExecution : Resource
+ {
+ ///
+ /// Initializes a new instance of the ExportExecution class.
+ ///
+ public ExportExecution()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the ExportExecution class.
+ ///
+ /// Resource Id.
+ /// Resource name.
+ /// Resource type.
+ /// Resource tags.
+ /// The type of the export execution.
+ /// Possible values include: 'OnDemand', 'Scheduled'
+ /// The status of the export execution. Possible
+ /// values include: 'Queued', 'InProgress', 'Completed', 'Failed',
+ /// 'Timeout', 'NewDataNotAvailable', 'DataNotAvailable'
+ /// The identifier for the entity that
+ /// executed the export. For OnDemand executions, it is the email id.
+ /// For Scheduled executions, it is the constant value -
+ /// System.
+ /// The time when export was queued to be
+ /// executed.
+ /// The time when export was picked
+ /// up to be executed.
+ /// The time when export execution
+ /// finished.
+ /// The name of the file export got written
+ /// to.
+ public ExportExecution(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string executionType = default(string), string status = default(string), string submittedBy = default(string), System.DateTime? submittedTime = default(System.DateTime?), System.DateTime? processingStartTime = default(System.DateTime?), System.DateTime? processingEndTime = default(System.DateTime?), string fileName = default(string), CommonExportProperties runSettings = default(CommonExportProperties))
+ : base(id, name, type, tags)
+ {
+ ExecutionType = executionType;
+ Status = status;
+ SubmittedBy = submittedBy;
+ SubmittedTime = submittedTime;
+ ProcessingStartTime = processingStartTime;
+ ProcessingEndTime = processingEndTime;
+ FileName = fileName;
+ RunSettings = runSettings;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets the type of the export execution. Possible values
+ /// include: 'OnDemand', 'Scheduled'
+ ///
+ [JsonProperty(PropertyName = "properties.executionType")]
+ public string ExecutionType { get; set; }
+
+ ///
+ /// Gets or sets the status of the export execution. Possible values
+ /// include: 'Queued', 'InProgress', 'Completed', 'Failed', 'Timeout',
+ /// 'NewDataNotAvailable', 'DataNotAvailable'
+ ///
+ [JsonProperty(PropertyName = "properties.status")]
+ public string Status { get; set; }
+
+ ///
+ /// Gets or sets the identifier for the entity that executed the
+ /// export. For OnDemand executions, it is the email id. For Scheduled
+ /// executions, it is the constant value - System.
+ ///
+ [JsonProperty(PropertyName = "properties.submittedBy")]
+ public string SubmittedBy { get; set; }
+
+ ///
+ /// Gets or sets the time when export was queued to be executed.
+ ///
+ [JsonProperty(PropertyName = "properties.submittedTime")]
+ public System.DateTime? SubmittedTime { get; set; }
+
+ ///
+ /// Gets or sets the time when export was picked up to be executed.
+ ///
+ [JsonProperty(PropertyName = "properties.processingStartTime")]
+ public System.DateTime? ProcessingStartTime { get; set; }
+
+ ///
+ /// Gets or sets the time when export execution finished.
+ ///
+ [JsonProperty(PropertyName = "properties.processingEndTime")]
+ public System.DateTime? ProcessingEndTime { get; set; }
+
+ ///
+ /// Gets or sets the name of the file export got written to.
+ ///
+ [JsonProperty(PropertyName = "properties.fileName")]
+ public string FileName { get; set; }
+
+ ///
+ ///
+ [JsonProperty(PropertyName = "properties.runSettings")]
+ public CommonExportProperties RunSettings { get; set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public virtual void Validate()
+ {
+ if (RunSettings != null)
+ {
+ RunSettings.Validate();
+ }
+ }
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ExportExecutionListResult.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ExportExecutionListResult.cs
new file mode 100644
index 000000000000..f9f4c050171b
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ExportExecutionListResult.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 Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ ///
+ /// Result of listing exports execution history of a export by name
+ ///
+ public partial class ExportExecutionListResult
+ {
+ ///
+ /// Initializes a new instance of the ExportExecutionListResult class.
+ ///
+ public ExportExecutionListResult()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the ExportExecutionListResult class.
+ ///
+ /// The list of export executions.
+ public ExportExecutionListResult(IList value = default(IList))
+ {
+ Value = value;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets the list of export executions.
+ ///
+ [JsonProperty(PropertyName = "value")]
+ public IList Value { get; private set; }
+
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ExportListResult.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ExportListResult.cs
new file mode 100644
index 000000000000..87faaf1f33f4
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ExportListResult.cs
@@ -0,0 +1,54 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated 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;
+
+ ///
+ /// Result of listing exports. It contains a list of available exports in
+ /// the scope provided.
+ ///
+ public partial class ExportListResult
+ {
+ ///
+ /// Initializes a new instance of the ExportListResult class.
+ ///
+ public ExportListResult()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the ExportListResult class.
+ ///
+ /// The list of exports.
+ public ExportListResult(IList value = default(IList))
+ {
+ Value = value;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets the list of exports.
+ ///
+ [JsonProperty(PropertyName = "value")]
+ public IList Value { get; private set; }
+
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ExportRecurrencePeriod.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ExportRecurrencePeriod.cs
new file mode 100644
index 000000000000..80ee81ce363d
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ExportRecurrencePeriod.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 start and end date for recurrence schedule.
+ ///
+ public partial class ExportRecurrencePeriod
+ {
+ ///
+ /// Initializes a new instance of the ExportRecurrencePeriod class.
+ ///
+ public ExportRecurrencePeriod()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the ExportRecurrencePeriod class.
+ ///
+ /// The start date of recurrence.
+ /// The end date of recurrence.
+ public ExportRecurrencePeriod(System.DateTime fromProperty, System.DateTime? to = default(System.DateTime?))
+ {
+ FromProperty = fromProperty;
+ To = to;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets the start date of recurrence.
+ ///
+ [JsonProperty(PropertyName = "from")]
+ public System.DateTime FromProperty { get; set; }
+
+ ///
+ /// Gets or sets the end date of recurrence.
+ ///
+ [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/ExportSchedule.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ExportSchedule.cs
new file mode 100644
index 000000000000..15fe593d3888
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ExportSchedule.cs
@@ -0,0 +1,95 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+ using Microsoft.Rest;
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// The schedule associated with a export.
+ ///
+ public partial class ExportSchedule
+ {
+ ///
+ /// Initializes a new instance of the ExportSchedule class.
+ ///
+ public ExportSchedule()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the ExportSchedule class.
+ ///
+ /// The schedule recurrence. Possible values
+ /// include: 'Daily', 'Weekly', 'Monthly', 'Annually'
+ /// The status of the schedule. Whether active or
+ /// not. If inactive, the export's scheduled execution is paused.
+ /// Possible values include: 'Active', 'Inactive'
+ /// Has start and end date of the
+ /// recurrence. The start date must be in future. If present, the end
+ /// date must be greater than start date.
+ public ExportSchedule(string recurrence, string status = default(string), ExportRecurrencePeriod recurrencePeriod = default(ExportRecurrencePeriod))
+ {
+ Status = status;
+ Recurrence = recurrence;
+ RecurrencePeriod = recurrencePeriod;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets the status of the schedule. Whether active or not. If
+ /// inactive, the export's scheduled execution is paused. Possible
+ /// values include: 'Active', 'Inactive'
+ ///
+ [JsonProperty(PropertyName = "status")]
+ public string Status { get; set; }
+
+ ///
+ /// Gets or sets the schedule recurrence. Possible values include:
+ /// 'Daily', 'Weekly', 'Monthly', 'Annually'
+ ///
+ [JsonProperty(PropertyName = "recurrence")]
+ public string Recurrence { get; set; }
+
+ ///
+ /// Gets or sets has start and end date of the recurrence. The start
+ /// date must be in future. If present, the end date must be greater
+ /// than start date.
+ ///
+ [JsonProperty(PropertyName = "recurrencePeriod")]
+ public ExportRecurrencePeriod RecurrencePeriod { get; set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public virtual void Validate()
+ {
+ if (Recurrence == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "Recurrence");
+ }
+ if (RecurrencePeriod != null)
+ {
+ RecurrencePeriod.Validate();
+ }
+ }
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ExportType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ExportType.cs
new file mode 100644
index 000000000000..d053c79778ae
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ExportType.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 ExportType.
+ ///
+ public static class ExportType
+ {
+ public const string Usage = "Usage";
+ public const string ActualCost = "ActualCost";
+ public const string AmortizedCost = "AmortizedCost";
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/FormatType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/FormatType.cs
new file mode 100644
index 000000000000..6c07b22a8a1f
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/FormatType.cs
@@ -0,0 +1,21 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+
+ ///
+ /// Defines values for FormatType.
+ ///
+ public static class FormatType
+ {
+ public const string Csv = "Csv";
+ }
+}
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..bc21e31cffc1
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/GranularityType.cs
@@ -0,0 +1,21 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+
+ ///
+ /// Defines values for GranularityType.
+ ///
+ public static class GranularityType
+ {
+ public const string Daily = "Daily";
+ }
+}
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/Page.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Page.cs
new file mode 100644
index 000000000000..87ca0e052cb1
--- /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("")]
+ 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/Page1.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Page1.cs
new file mode 100644
index 000000000000..1c1e00fde426
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Page1.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 Page1 : 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/QueryAggregation.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/QueryAggregation.cs
new file mode 100644
index 000000000000..7c41b88bfd8e
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/QueryAggregation.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 query.
+ ///
+ public partial class QueryAggregation
+ {
+ ///
+ /// Initializes a new instance of the QueryAggregation class.
+ ///
+ public QueryAggregation()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the QueryAggregation class.
+ ///
+ /// The name of the column to aggregate.
+ public QueryAggregation(string name)
+ {
+ Name = name;
+ CustomInit();
+ }
+ ///
+ /// Static constructor for QueryAggregation class.
+ ///
+ static QueryAggregation()
+ {
+ 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/QueryColumn.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/QueryColumn.cs
new file mode 100644
index 000000000000..ae1335336a58
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/QueryColumn.cs
@@ -0,0 +1,56 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated 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;
+
+ public partial class QueryColumn
+ {
+ ///
+ /// Initializes a new instance of the QueryColumn class.
+ ///
+ public QueryColumn()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the QueryColumn class.
+ ///
+ /// The name of column.
+ /// The type of column.
+ public QueryColumn(string name = default(string), string type = default(string))
+ {
+ Name = name;
+ Type = type;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets the name of column.
+ ///
+ [JsonProperty(PropertyName = "name")]
+ public string Name { get; set; }
+
+ ///
+ /// Gets or sets the type of column.
+ ///
+ [JsonProperty(PropertyName = "type")]
+ public string Type { get; set; }
+
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/QueryColumnType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/QueryColumnType.cs
new file mode 100644
index 000000000000..f67eba223d07
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/QueryColumnType.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 QueryColumnType.
+ ///
+ public static class QueryColumnType
+ {
+ public const string Tag = "Tag";
+ public const string Dimension = "Dimension";
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/QueryComparisonExpression.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/QueryComparisonExpression.cs
new file mode 100644
index 000000000000..8fbdf7f66b4d
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/QueryComparisonExpression.cs
@@ -0,0 +1,100 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.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 query.
+ ///
+ public partial class QueryComparisonExpression
+ {
+ ///
+ /// Initializes a new instance of the QueryComparisonExpression class.
+ ///
+ public QueryComparisonExpression()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the QueryComparisonExpression class.
+ ///
+ /// The name of the column to use in
+ /// comparison.
+ /// Array of values to use for comparison
+ public QueryComparisonExpression(string name, IList values)
+ {
+ Name = name;
+ Values = values;
+ CustomInit();
+ }
+ ///
+ /// Static constructor for QueryComparisonExpression class.
+ ///
+ static QueryComparisonExpression()
+ {
+ OperatorProperty = "In";
+ }
+
+ ///
+ /// 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 array of values to use for comparison
+ ///
+ [JsonProperty(PropertyName = "values")]
+ public IList Values { get; set; }
+
+ ///
+ /// The operator to use for comparison.
+ ///
+ [JsonProperty(PropertyName = "operator")]
+ public static string OperatorProperty { get; private set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public virtual void Validate()
+ {
+ if (Name == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "Name");
+ }
+ 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/QueryDataset.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/QueryDataset.cs
new file mode 100644
index 000000000000..87acc81ccf02
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/QueryDataset.cs
@@ -0,0 +1,137 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated 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 query.
+ ///
+ public partial class QueryDataset
+ {
+ ///
+ /// Initializes a new instance of the QueryDataset class.
+ ///
+ public QueryDataset()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the QueryDataset class.
+ ///
+ /// The granularity of rows in the query.
+ /// Possible values include: 'Daily'
+ /// Has configuration information for the
+ /// data in the export. The configuration will be ignored if
+ /// aggregation and grouping are provided.
+ /// Dictionary of aggregation expression to
+ /// use in the query. The key of each item in the dictionary is the
+ /// alias for the aggregated column. Query can have up to 2 aggregation
+ /// clauses.
+ /// Array of group by expression to use in the
+ /// query. Query can have up to 2 group by clauses.
+ /// Has filter expression to use in the
+ /// query.
+ public QueryDataset(string granularity = default(string), QueryDatasetConfiguration configuration = default(QueryDatasetConfiguration), IDictionary aggregation = default(IDictionary), IList grouping = default(IList), QueryFilter filter = default(QueryFilter))
+ {
+ Granularity = granularity;
+ Configuration = configuration;
+ Aggregation = aggregation;
+ Grouping = grouping;
+ 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 query. Possible values
+ /// include: 'Daily'
+ ///
+ [JsonProperty(PropertyName = "granularity")]
+ public string Granularity { get; set; }
+
+ ///
+ /// Gets or sets has configuration information for the data in the
+ /// export. The configuration will be ignored if aggregation and
+ /// grouping are provided.
+ ///
+ [JsonProperty(PropertyName = "configuration")]
+ public QueryDatasetConfiguration Configuration { get; set; }
+
+ ///
+ /// Gets or sets dictionary of aggregation expression to use in the
+ /// query. The key of each item in the dictionary is the alias for the
+ /// aggregated column. Query 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 query.
+ /// Query can have up to 2 group by clauses.
+ ///
+ [JsonProperty(PropertyName = "grouping")]
+ public IList Grouping { get; set; }
+
+ ///
+ /// Gets or sets has filter expression to use in the query.
+ ///
+ [JsonProperty(PropertyName = "filter")]
+ public QueryFilter 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 (Filter != null)
+ {
+ Filter.Validate();
+ }
+ }
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/QueryDatasetConfiguration.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/QueryDatasetConfiguration.cs
new file mode 100644
index 000000000000..b1634e706069
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/QueryDatasetConfiguration.cs
@@ -0,0 +1,57 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated 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 query.
+ ///
+ public partial class QueryDatasetConfiguration
+ {
+ ///
+ /// Initializes a new instance of the QueryDatasetConfiguration class.
+ ///
+ public QueryDatasetConfiguration()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the QueryDatasetConfiguration class.
+ ///
+ /// Array of column names to be included in the
+ /// query. Any valid query column name is allowed. If not provided,
+ /// then query includes all columns.
+ public QueryDatasetConfiguration(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 query. Any
+ /// valid query column name is allowed. If not provided, then query
+ /// includes all columns.
+ ///
+ [JsonProperty(PropertyName = "columns")]
+ public IList Columns { get; set; }
+
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/QueryDefinition.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/QueryDefinition.cs
new file mode 100644
index 000000000000..e889bfe1712d
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/QueryDefinition.cs
@@ -0,0 +1,112 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated 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 definition of a query.
+ ///
+ public partial class QueryDefinition
+ {
+ ///
+ /// Initializes a new instance of the QueryDefinition class.
+ ///
+ public QueryDefinition()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the QueryDefinition class.
+ ///
+ /// The type of the query. Possible values include:
+ /// 'Usage', 'ActualCost', 'AmortizedCost'
+ /// The time frame for pulling data for the
+ /// query. If custom, then a specific time period must be provided.
+ /// Possible values include: 'MonthToDate', 'BillingMonthToDate',
+ /// 'TheLastMonth', 'TheLastBillingMonth', 'WeekToDate',
+ /// 'Custom'
+ /// Has time period for pulling data for the
+ /// query.
+ /// Has definition for data in this
+ /// query.
+ public QueryDefinition(string type, string timeframe, QueryTimePeriod timePeriod = default(QueryTimePeriod), QueryDataset dataset = default(QueryDataset))
+ {
+ Type = type;
+ Timeframe = timeframe;
+ TimePeriod = timePeriod;
+ Dataset = dataset;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets the type of the query. Possible values include:
+ /// 'Usage', 'ActualCost', 'AmortizedCost'
+ ///
+ [JsonProperty(PropertyName = "type")]
+ public string Type { get; set; }
+
+ ///
+ /// Gets or sets the time frame for pulling data for the query. If
+ /// custom, then a specific time period must be provided. Possible
+ /// values include: 'MonthToDate', 'BillingMonthToDate',
+ /// 'TheLastMonth', 'TheLastBillingMonth', 'WeekToDate', 'Custom'
+ ///
+ [JsonProperty(PropertyName = "timeframe")]
+ public string Timeframe { get; set; }
+
+ ///
+ /// Gets or sets has time period for pulling data for the query.
+ ///
+ [JsonProperty(PropertyName = "timePeriod")]
+ public QueryTimePeriod TimePeriod { get; set; }
+
+ ///
+ /// Gets or sets has definition for data in this query.
+ ///
+ [JsonProperty(PropertyName = "dataset")]
+ public QueryDataset Dataset { get; set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public virtual void Validate()
+ {
+ if (Type == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "Type");
+ }
+ 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/Models/QueryFilter.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/QueryFilter.cs
new file mode 100644
index 000000000000..88ac8eb310b4
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/QueryFilter.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 export.
+ ///
+ public partial class QueryFilter
+ {
+ ///
+ /// Initializes a new instance of the QueryFilter class.
+ ///
+ public QueryFilter()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the QueryFilter 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 QueryFilter(IList and = default(IList), IList or = default(IList), QueryFilter not = default(QueryFilter), QueryComparisonExpression dimension = default(QueryComparisonExpression), QueryComparisonExpression tag = default(QueryComparisonExpression))
+ {
+ 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 QueryFilter Not { get; set; }
+
+ ///
+ /// Gets or sets has comparison expression for a dimension
+ ///
+ [JsonProperty(PropertyName = "dimension")]
+ public QueryComparisonExpression Dimension { get; set; }
+
+ ///
+ /// Gets or sets has comparison expression for a tag
+ ///
+ [JsonProperty(PropertyName = "tag")]
+ public QueryComparisonExpression 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/QueryGrouping.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/QueryGrouping.cs
new file mode 100644
index 000000000000..0f86a7c7dfee
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/QueryGrouping.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 Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// The group by expression to be used in the query.
+ ///
+ public partial class QueryGrouping
+ {
+ ///
+ /// Initializes a new instance of the QueryGrouping class.
+ ///
+ public QueryGrouping()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the QueryGrouping class.
+ ///
+ /// Has type of the column to group. Possible values
+ /// include: 'Tag', 'Dimension'
+ /// The name of the column to group.
+ public QueryGrouping(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.
+ ///
+ [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/QueryResult.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/QueryResult.cs
new file mode 100644
index 000000000000..237f71770e47
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/QueryResult.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.Serialization;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ ///
+ /// Result of query. It contains all columns listed under groupings and
+ /// aggregation.
+ ///
+ [Rest.Serialization.JsonTransformation]
+ public partial class QueryResult : Resource
+ {
+ ///
+ /// Initializes a new instance of the QueryResult class.
+ ///
+ public QueryResult()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the QueryResult class.
+ ///
+ /// Resource Id.
+ /// Resource name.
+ /// Resource type.
+ /// Resource tags.
+ /// The link (url) to the next page of
+ /// results.
+ /// Array of columns
+ /// Array of rows
+ public QueryResult(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string nextLink = default(string), IList columns = default(IList), IList> rows = default(IList>))
+ : base(id, name, type, tags)
+ {
+ NextLink = nextLink;
+ Columns = columns;
+ Rows = rows;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets the link (url) to the next page of results.
+ ///
+ [JsonProperty(PropertyName = "properties.nextLink")]
+ public string NextLink { get; set; }
+
+ ///
+ /// Gets or sets array of columns
+ ///
+ [JsonProperty(PropertyName = "properties.columns")]
+ public IList Columns { get; set; }
+
+ ///
+ /// Gets or sets array of rows
+ ///
+ [JsonProperty(PropertyName = "properties.rows")]
+ public IList> Rows { get; set; }
+
+ }
+}
diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/QueryTimePeriod.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/QueryTimePeriod.cs
new file mode 100644
index 000000000000..ca613b375c0d
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/QueryTimePeriod.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 query.
+ ///
+ public partial class QueryTimePeriod
+ {
+ ///
+ /// Initializes a new instance of the QueryTimePeriod class.
+ ///
+ public QueryTimePeriod()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the QueryTimePeriod class.
+ ///
+ /// The start date to pull data
+ /// from.
+ /// The end date to pull data to.
+ public QueryTimePeriod(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/RecurrenceType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/RecurrenceType.cs
new file mode 100644
index 000000000000..05d4ee88a98d
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/RecurrenceType.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 RecurrenceType.
+ ///
+ public static class RecurrenceType
+ {
+ public const string Daily = "Daily";
+ public const string Weekly = "Weekly";
+ public const string Monthly = "Monthly";
+ public const string Annually = "Annually";
+ }
+}
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/StatusType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/StatusType.cs
new file mode 100644
index 000000000000..c41578f2ab90
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/StatusType.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 StatusType.
+ ///
+ public static class StatusType
+ {
+ public const string Active = "Active";
+ public const string Inactive = "Inactive";
+ }
+}
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..7dadbd2e3a5e
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/TimeframeType.cs
@@ -0,0 +1,26 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement.Models
+{
+
+ ///
+ /// Defines values for TimeframeType.
+ ///
+ public static class TimeframeType
+ {
+ public const string MonthToDate = "MonthToDate";
+ public const string BillingMonthToDate = "BillingMonthToDate";
+ public const string TheLastMonth = "TheLastMonth";
+ public const string TheLastBillingMonth = "TheLastBillingMonth";
+ public const string WeekToDate = "WeekToDate";
+ public const string Custom = "Custom";
+ }
+}
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..a438d838f96b
--- /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 cost management 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 cost management 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..ca66a0020fdd
--- /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 cost management 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 cost management 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 cost management 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 cost management 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/QueryOperations.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/QueryOperations.cs
new file mode 100644
index 000000000000..e333b9e772d8
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/QueryOperations.cs
@@ -0,0 +1,267 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated 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;
+
+ ///
+ /// QueryOperations operations.
+ ///
+ internal partial class QueryOperations : IServiceOperations, IQueryOperations
+ {
+ ///
+ /// Initializes a new instance of the QueryOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal QueryOperations(CostManagementClient client)
+ {
+ if (client == null)
+ {
+ throw new System.ArgumentNullException("client");
+ }
+ Client = client;
+ }
+
+ ///
+ /// Gets a reference to the CostManagementClient
+ ///
+ public CostManagementClient Client { get; private set; }
+
+ ///
+ /// Query the usage data for scope defined.
+ ///
+ ///
+ ///
+ /// The scope associated with query and export operations. This includes
+ /// '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
+ /// resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
+ /// Billing Account scope and
+ /// '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope, and
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}'
+ /// specific for partners.
+ ///
+ ///
+ /// Parameters supplied to the CreateOrUpdate Query Config 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> UsageWithHttpMessagesAsync(string scope, QueryDefinition 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 (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("parameters", parameters);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "Usage", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.CostManagement/query").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("POST");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ if(parameters != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ 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/QueryOperationsExtensions.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/QueryOperationsExtensions.cs
new file mode 100644
index 000000000000..6f28a8a2c849
--- /dev/null
+++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/QueryOperationsExtensions.cs
@@ -0,0 +1,101 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.CostManagement
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// Extension methods for QueryOperations.
+ ///
+ public static partial class QueryOperationsExtensions
+ {
+ ///
+ /// Query the usage data for scope defined.
+ ///
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The scope associated with query and export operations. This includes
+ /// '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
+ /// resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
+ /// Billing Account scope and
+ /// '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope, and
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}'
+ /// specific for partners.
+ ///
+ ///
+ /// Parameters supplied to the CreateOrUpdate Query Config operation.
+ ///
+ public static QueryResult Usage(this IQueryOperations operations, string scope, QueryDefinition parameters)
+ {
+ return operations.UsageAsync(scope, parameters).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Query the usage data for scope defined.
+ ///
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The scope associated with query and export operations. This includes
+ /// '/subscriptions/{subscriptionId}/' for subscription scope,
+ /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for
+ /// resourceGroup scope,
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for
+ /// Billing Account scope and
+ /// '/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}/billingProfiles/{billingProfileId}/invoiceSections/{invoiceSectionId}'
+ /// for invoiceSection scope, and
+ /// '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/customers/{customerId}'
+ /// specific for partners.
+ ///
+ ///
+ /// Parameters supplied to the CreateOrUpdate Query Config operation.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task UsageAsync(this IQueryOperations operations, string scope, QueryDefinition parameters, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.UsageWithHttpMessagesAsync(scope, parameters, 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..41d98c6a62b6
--- /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", "Dimensions", "2019-11-01"),
+ new Tuple("CostManagement", "Exports", "2019-11-01"),
+ new Tuple("CostManagement", "Operations", "2019-11-01"),
+ new Tuple("CostManagement", "Query", "2019-11-01"),
+ }.AsEnumerable();
+ }
+ }
+ }
+}