diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/AlertsOperations.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/AlertsOperations.cs new file mode 100644 index 000000000000..f252d082fa28 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/AlertsOperations.cs @@ -0,0 +1,441 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.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; + + /// + /// AlertsOperations operations. + /// + internal partial class AlertsOperations : IServiceOperations, IAlertsOperations + { + /// + /// Initializes a new instance of the AlertsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal AlertsOperations(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 alerts for scope defined. + /// + /// + /// + /// The scope associated with alerts 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 (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + // 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/alerts").ToString(); + _url = _url.Replace("{scope}", scope); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the Alerts for external cloud provider type defined. + /// + /// + /// + /// The external cloud provider type associated with dimension/query + /// operations. This includes 'externalSubscriptions' for linked account and + /// 'externalBillingAccounts' for consolidated account. Possible values + /// include: 'externalSubscriptions', 'externalBillingAccounts' + /// + /// + /// This can be '{externalSubscriptionId}' for linked account or + /// '{externalBillingAccountId}' for consolidated account used with + /// dimension/query 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> ListExternalWithHttpMessagesAsync(string externalCloudProviderType, string externalCloudProviderId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (externalCloudProviderType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "externalCloudProviderType"); + } + if (externalCloudProviderId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "externalCloudProviderId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("externalCloudProviderType", externalCloudProviderType); + tracingParameters.Add("externalCloudProviderId", externalCloudProviderId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListExternal", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/alerts").ToString(); + _url = _url.Replace("{externalCloudProviderType}", System.Uri.EscapeDataString(externalCloudProviderType)); + _url = _url.Replace("{externalCloudProviderId}", System.Uri.EscapeDataString(externalCloudProviderId)); + 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/AlertsOperationsExtensions.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/AlertsOperationsExtensions.cs new file mode 100644 index 000000000000..b1c43145f0e7 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/AlertsOperationsExtensions.cs @@ -0,0 +1,147 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for AlertsOperations. + /// + public static partial class AlertsOperationsExtensions + { + /// + /// Lists the alerts for scope defined. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with alerts 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 AlertsResult List(this IAlertsOperations operations, string scope) + { + return operations.ListAsync(scope).GetAwaiter().GetResult(); + } + + /// + /// Lists the alerts for scope defined. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with alerts 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 IAlertsOperations operations, string scope, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(scope, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the Alerts for external cloud provider type defined. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The external cloud provider type associated with dimension/query + /// operations. This includes 'externalSubscriptions' for linked account and + /// 'externalBillingAccounts' for consolidated account. Possible values + /// include: 'externalSubscriptions', 'externalBillingAccounts' + /// + /// + /// This can be '{externalSubscriptionId}' for linked account or + /// '{externalBillingAccountId}' for consolidated account used with + /// dimension/query operations. + /// + public static AlertsResult ListExternal(this IAlertsOperations operations, string externalCloudProviderType, string externalCloudProviderId) + { + return operations.ListExternalAsync(externalCloudProviderType, externalCloudProviderId).GetAwaiter().GetResult(); + } + + /// + /// Lists the Alerts for external cloud provider type defined. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The external cloud provider type associated with dimension/query + /// operations. This includes 'externalSubscriptions' for linked account and + /// 'externalBillingAccounts' for consolidated account. Possible values + /// include: 'externalSubscriptions', 'externalBillingAccounts' + /// + /// + /// This can be '{externalSubscriptionId}' for linked account or + /// '{externalBillingAccountId}' for consolidated account used with + /// dimension/query operations. + /// + /// + /// The cancellation token. + /// + public static async Task ListExternalAsync(this IAlertsOperations operations, string externalCloudProviderType, string externalCloudProviderId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListExternalWithHttpMessagesAsync(externalCloudProviderType, externalCloudProviderId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/CostManagementClient.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/CostManagementClient.cs index 7939620496ca..45a39db3a28a 100644 --- a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/CostManagementClient.cs +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/CostManagementClient.cs @@ -77,6 +77,16 @@ public partial class CostManagementClient : ServiceClient, /// public virtual IDimensionsOperations Dimensions { get; private set; } + /// + /// Gets the IAlertsOperations. + /// + public virtual IAlertsOperations Alerts { get; private set; } + + /// + /// Gets the IForecastOperations. + /// + public virtual IForecastOperations Forecast { get; private set; } + /// /// Gets the IQueryOperations. /// @@ -334,6 +344,8 @@ public CostManagementClient(System.Uri baseUri, ServiceClientCredentials credent private void Initialize() { Dimensions = new DimensionsOperations(this); + Alerts = new AlertsOperations(this); + Forecast = new ForecastOperations(this); Query = new QueryOperations(this); Exports = new ExportsOperations(this); Operations = new Operations(this); diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ForecastOperations.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ForecastOperations.cs new file mode 100644 index 000000000000..02a464f11043 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ForecastOperations.cs @@ -0,0 +1,499 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated 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; + + /// + /// ForecastOperations operations. + /// + internal partial class ForecastOperations : IServiceOperations, IForecastOperations + { + /// + /// Initializes a new instance of the ForecastOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ForecastOperations(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 forecast charges for scope defined. + /// + /// + /// + /// The scope associated with forecast 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 Forecast Config operation. + /// + /// + /// May be used to filter forecasts by properties/usageDate (Utc time), + /// properties/chargeType or properties/grain. The filter supports 'eq', 'lt', + /// 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or + /// 'not'. + /// + /// + /// Headers that 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, ForecastDefinition parameters, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + 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("filter", filter); + 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/forecast").ToString(); + _url = _url.Replace("{scope}", scope); + List _queryParameters = new List(); + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + 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; + } + + /// + /// Lists the forecast charges for external cloud provider type defined. + /// + /// + /// + /// The external cloud provider type associated with dimension/query + /// operations. This includes 'externalSubscriptions' for linked account and + /// 'externalBillingAccounts' for consolidated account. Possible values + /// include: 'externalSubscriptions', 'externalBillingAccounts' + /// + /// + /// This can be '{externalSubscriptionId}' for linked account or + /// '{externalBillingAccountId}' for consolidated account used with + /// dimension/query operations. + /// + /// + /// Parameters supplied to the CreateOrUpdate Forecast Config operation. + /// + /// + /// May be used to filter forecasts by properties/usageDate (Utc time), + /// properties/chargeType or properties/grain. The filter supports 'eq', 'lt', + /// 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or + /// 'not'. + /// + /// + /// Headers that 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> ExternalCloudProviderUsageWithHttpMessagesAsync(string externalCloudProviderType, string externalCloudProviderId, ForecastDefinition parameters, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (externalCloudProviderType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "externalCloudProviderType"); + } + if (externalCloudProviderId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "externalCloudProviderId"); + } + 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("filter", filter); + tracingParameters.Add("externalCloudProviderType", externalCloudProviderType); + tracingParameters.Add("externalCloudProviderId", externalCloudProviderId); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ExternalCloudProviderUsage", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.CostManagement/{externalCloudProviderType}/{externalCloudProviderId}/forecast").ToString(); + _url = _url.Replace("{externalCloudProviderType}", System.Uri.EscapeDataString(externalCloudProviderType)); + _url = _url.Replace("{externalCloudProviderId}", System.Uri.EscapeDataString(externalCloudProviderId)); + List _queryParameters = new List(); + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + 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/ForecastOperationsExtensions.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ForecastOperationsExtensions.cs new file mode 100644 index 000000000000..e2b8ed6bee3b --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ForecastOperationsExtensions.cs @@ -0,0 +1,183 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated 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 ForecastOperations. + /// + public static partial class ForecastOperationsExtensions + { + /// + /// Lists the forecast charges for scope defined. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with forecast 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 Forecast Config operation. + /// + /// + /// May be used to filter forecasts by properties/usageDate (Utc time), + /// properties/chargeType or properties/grain. The filter supports 'eq', 'lt', + /// 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or + /// 'not'. + /// + public static QueryResult Usage(this IForecastOperations operations, string scope, ForecastDefinition parameters, string filter = default(string)) + { + return operations.UsageAsync(scope, parameters, filter).GetAwaiter().GetResult(); + } + + /// + /// Lists the forecast charges for scope defined. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope associated with forecast 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 Forecast Config operation. + /// + /// + /// May be used to filter forecasts by properties/usageDate (Utc time), + /// properties/chargeType or properties/grain. The filter supports 'eq', 'lt', + /// 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or + /// 'not'. + /// + /// + /// The cancellation token. + /// + public static async Task UsageAsync(this IForecastOperations operations, string scope, ForecastDefinition parameters, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UsageWithHttpMessagesAsync(scope, parameters, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the forecast charges for external cloud provider type defined. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The external cloud provider type associated with dimension/query + /// operations. This includes 'externalSubscriptions' for linked account and + /// 'externalBillingAccounts' for consolidated account. Possible values + /// include: 'externalSubscriptions', 'externalBillingAccounts' + /// + /// + /// This can be '{externalSubscriptionId}' for linked account or + /// '{externalBillingAccountId}' for consolidated account used with + /// dimension/query operations. + /// + /// + /// Parameters supplied to the CreateOrUpdate Forecast Config operation. + /// + /// + /// May be used to filter forecasts by properties/usageDate (Utc time), + /// properties/chargeType or properties/grain. The filter supports 'eq', 'lt', + /// 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or + /// 'not'. + /// + public static QueryResult ExternalCloudProviderUsage(this IForecastOperations operations, string externalCloudProviderType, string externalCloudProviderId, ForecastDefinition parameters, string filter = default(string)) + { + return operations.ExternalCloudProviderUsageAsync(externalCloudProviderType, externalCloudProviderId, parameters, filter).GetAwaiter().GetResult(); + } + + /// + /// Lists the forecast charges for external cloud provider type defined. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The external cloud provider type associated with dimension/query + /// operations. This includes 'externalSubscriptions' for linked account and + /// 'externalBillingAccounts' for consolidated account. Possible values + /// include: 'externalSubscriptions', 'externalBillingAccounts' + /// + /// + /// This can be '{externalSubscriptionId}' for linked account or + /// '{externalBillingAccountId}' for consolidated account used with + /// dimension/query operations. + /// + /// + /// Parameters supplied to the CreateOrUpdate Forecast Config operation. + /// + /// + /// May be used to filter forecasts by properties/usageDate (Utc time), + /// properties/chargeType or properties/grain. The filter supports 'eq', 'lt', + /// 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or + /// 'not'. + /// + /// + /// The cancellation token. + /// + public static async Task ExternalCloudProviderUsageAsync(this IForecastOperations operations, string externalCloudProviderType, string externalCloudProviderId, ForecastDefinition parameters, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ExternalCloudProviderUsageWithHttpMessagesAsync(externalCloudProviderType, externalCloudProviderId, parameters, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IAlertsOperations.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IAlertsOperations.cs new file mode 100644 index 000000000000..bd4b97f1cb19 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IAlertsOperations.cs @@ -0,0 +1,99 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated 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; + + /// + /// AlertsOperations operations. + /// + public partial interface IAlertsOperations + { + /// + /// Lists the alerts for scope defined. + /// + /// + /// + /// The scope associated with alerts 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)); + /// + /// Lists the Alerts for external cloud provider type defined. + /// + /// + /// + /// The external cloud provider type associated with dimension/query + /// operations. This includes 'externalSubscriptions' for linked + /// account and 'externalBillingAccounts' for consolidated account. + /// Possible values include: 'externalSubscriptions', + /// 'externalBillingAccounts' + /// + /// + /// This can be '{externalSubscriptionId}' for linked account or + /// '{externalBillingAccountId}' for consolidated account used with + /// dimension/query 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> ListExternalWithHttpMessagesAsync(string externalCloudProviderType, string externalCloudProviderId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ICostManagementClient.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ICostManagementClient.cs index 6b8c7b53105a..8a8ab4017666 100644 --- a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ICostManagementClient.cs +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/ICostManagementClient.cs @@ -74,6 +74,16 @@ public partial interface ICostManagementClient : System.IDisposable /// IDimensionsOperations Dimensions { get; } + /// + /// Gets the IAlertsOperations. + /// + IAlertsOperations Alerts { get; } + + /// + /// Gets the IForecastOperations. + /// + IForecastOperations Forecast { get; } + /// /// Gets the IQueryOperations. /// diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IForecastOperations.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IForecastOperations.cs new file mode 100644 index 000000000000..b6de521772d0 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/IForecastOperations.cs @@ -0,0 +1,120 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated 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; + + /// + /// ForecastOperations operations. + /// + public partial interface IForecastOperations + { + /// + /// Lists the forecast charges for scope defined. + /// + /// + /// + /// The scope associated with forecast 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 Forecast Config + /// operation. + /// + /// + /// May be used to filter forecasts by properties/usageDate (Utc time), + /// properties/chargeType or properties/grain. The filter supports + /// 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently + /// support 'ne', 'or', or 'not'. + /// + /// + /// 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, ForecastDefinition parameters, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the forecast charges for external cloud provider type + /// defined. + /// + /// + /// + /// The external cloud provider type associated with dimension/query + /// operations. This includes 'externalSubscriptions' for linked + /// account and 'externalBillingAccounts' for consolidated account. + /// Possible values include: 'externalSubscriptions', + /// 'externalBillingAccounts' + /// + /// + /// This can be '{externalSubscriptionId}' for linked account or + /// '{externalBillingAccountId}' for consolidated account used with + /// dimension/query operations. + /// + /// + /// Parameters supplied to the CreateOrUpdate Forecast Config + /// operation. + /// + /// + /// May be used to filter forecasts by properties/usageDate (Utc time), + /// properties/chargeType or properties/grain. The filter supports + /// 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently + /// support 'ne', 'or', or 'not'. + /// + /// + /// 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> ExternalCloudProviderUsageWithHttpMessagesAsync(string externalCloudProviderType, string externalCloudProviderId, ForecastDefinition parameters, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Alert.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Alert.cs new file mode 100644 index 000000000000..f2070642ea03 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/Alert.cs @@ -0,0 +1,142 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated 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; + + /// + /// An individual alert. + /// + [Rest.Serialization.JsonTransformation] + public partial class Alert : Resource + { + /// + /// Initializes a new instance of the Alert class. + /// + public Alert() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Alert class. + /// + /// Resource Id. + /// Resource name. + /// Resource type. + /// Resource tags. + /// defines the type of alert + /// Alert description + /// Source of alert + /// Alert details + /// related budget + /// alert status + /// dateTime in which alert was + /// created + /// dateTime in which alert was closed + /// dateTime in which alert was last + /// modified + /// dateTime in which the alert + /// status was last modified + public Alert(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), AlertPropertiesDefinition definition = default(AlertPropertiesDefinition), string description = default(string), string source = default(string), AlertPropertiesDetails details = default(AlertPropertiesDetails), string costEntityId = default(string), string status = default(string), string creationTime = default(string), string closeTime = default(string), string modificationTime = default(string), string statusModificationUserName = default(string), string statusModificationTime = default(string)) + : base(id, name, type, tags) + { + Definition = definition; + Description = description; + Source = source; + Details = details; + CostEntityId = costEntityId; + Status = status; + CreationTime = creationTime; + CloseTime = closeTime; + ModificationTime = modificationTime; + StatusModificationUserName = statusModificationUserName; + StatusModificationTime = statusModificationTime; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets defines the type of alert + /// + [JsonProperty(PropertyName = "properties.definition")] + public AlertPropertiesDefinition Definition { get; set; } + + /// + /// Gets or sets alert description + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets source of alert + /// + [JsonProperty(PropertyName = "properties.source")] + public string Source { get; set; } + + /// + /// Gets or sets alert details + /// + [JsonProperty(PropertyName = "properties.details")] + public AlertPropertiesDetails Details { get; set; } + + /// + /// Gets or sets related budget + /// + [JsonProperty(PropertyName = "properties.costEntityId")] + public string CostEntityId { get; set; } + + /// + /// Gets or sets alert status + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; set; } + + /// + /// Gets or sets dateTime in which alert was created + /// + [JsonProperty(PropertyName = "properties.creationTime")] + public string CreationTime { get; set; } + + /// + /// Gets or sets dateTime in which alert was closed + /// + [JsonProperty(PropertyName = "properties.closeTime")] + public string CloseTime { get; set; } + + /// + /// Gets or sets dateTime in which alert was last modified + /// + [JsonProperty(PropertyName = "properties.modificationTime")] + public string ModificationTime { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.statusModificationUserName")] + public string StatusModificationUserName { get; set; } + + /// + /// Gets or sets dateTime in which the alert status was last modified + /// + [JsonProperty(PropertyName = "properties.statusModificationTime")] + public string StatusModificationTime { get; set; } + + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/AlertPropertiesDefinition.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/AlertPropertiesDefinition.cs new file mode 100644 index 000000000000..64864d500259 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/AlertPropertiesDefinition.cs @@ -0,0 +1,67 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// defines the type of alert + /// + public partial class AlertPropertiesDefinition + { + /// + /// Initializes a new instance of the AlertPropertiesDefinition class. + /// + public AlertPropertiesDefinition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AlertPropertiesDefinition class. + /// + /// type of alert + /// Alert category + /// Criteria that triggered alert + public AlertPropertiesDefinition(string type = default(string), string category = default(string), string criteria = default(string)) + { + Type = type; + Category = category; + Criteria = criteria; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets type of alert + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets alert category + /// + [JsonProperty(PropertyName = "category")] + public string Category { get; set; } + + /// + /// Gets or sets criteria that triggered alert + /// + [JsonProperty(PropertyName = "criteria")] + public string Criteria { get; set; } + + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/AlertPropertiesDetails.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/AlertPropertiesDetails.cs new file mode 100644 index 000000000000..77fd32105ace --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/AlertPropertiesDetails.cs @@ -0,0 +1,180 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Alert details + /// + public partial class AlertPropertiesDetails + { + /// + /// Initializes a new instance of the AlertPropertiesDetails class. + /// + public AlertPropertiesDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AlertPropertiesDetails class. + /// + /// Type of timegrain cadence + /// datetime of periodStartDate + /// notificationId that triggered this + /// alert + /// array of resourceGroups to filter + /// by + /// array of resources to filter + /// by + /// array of meters to filter by + /// tags to filter by + /// notification threshold percentage as a + /// decimal which activated this alert + /// operator used to compare + /// currentSpend with amount + /// budget threshold amount + /// unit of currency being used + /// current spend + /// list of emails to contact + /// list of action groups to broadcast + /// to + /// list of contact roles + /// overriding alert + public AlertPropertiesDetails(string timeGrainType = default(string), string periodStartDate = default(string), string triggeredBy = default(string), IList resourceGroupFilter = default(IList), IList resourceFilter = default(IList), IList meterFilter = default(IList), object tagFilter = default(object), decimal? threshold = default(decimal?), string operatorProperty = default(string), decimal? amount = default(decimal?), string unit = default(string), decimal? currentSpend = default(decimal?), IList contactEmails = default(IList), IList contactGroups = default(IList), IList contactRoles = default(IList), string overridingAlert = default(string)) + { + TimeGrainType = timeGrainType; + PeriodStartDate = periodStartDate; + TriggeredBy = triggeredBy; + ResourceGroupFilter = resourceGroupFilter; + ResourceFilter = resourceFilter; + MeterFilter = meterFilter; + TagFilter = tagFilter; + Threshold = threshold; + OperatorProperty = operatorProperty; + Amount = amount; + Unit = unit; + CurrentSpend = currentSpend; + ContactEmails = contactEmails; + ContactGroups = contactGroups; + ContactRoles = contactRoles; + OverridingAlert = overridingAlert; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets type of timegrain cadence + /// + [JsonProperty(PropertyName = "timeGrainType")] + public string TimeGrainType { get; set; } + + /// + /// Gets or sets datetime of periodStartDate + /// + [JsonProperty(PropertyName = "periodStartDate")] + public string PeriodStartDate { get; set; } + + /// + /// Gets or sets notificationId that triggered this alert + /// + [JsonProperty(PropertyName = "triggeredBy")] + public string TriggeredBy { get; set; } + + /// + /// Gets or sets array of resourceGroups to filter by + /// + [JsonProperty(PropertyName = "resourceGroupFilter")] + public IList ResourceGroupFilter { get; set; } + + /// + /// Gets or sets array of resources to filter by + /// + [JsonProperty(PropertyName = "resourceFilter")] + public IList ResourceFilter { get; set; } + + /// + /// Gets or sets array of meters to filter by + /// + [JsonProperty(PropertyName = "meterFilter")] + public IList MeterFilter { get; set; } + + /// + /// Gets or sets tags to filter by + /// + [JsonProperty(PropertyName = "tagFilter")] + public object TagFilter { get; set; } + + /// + /// Gets or sets notification threshold percentage as a decimal which + /// activated this alert + /// + [JsonProperty(PropertyName = "threshold")] + public decimal? Threshold { get; set; } + + /// + /// Gets or sets operator used to compare currentSpend with amount + /// + [JsonProperty(PropertyName = "operator")] + public string OperatorProperty { get; set; } + + /// + /// Gets or sets budget threshold amount + /// + [JsonProperty(PropertyName = "amount")] + public decimal? Amount { get; set; } + + /// + /// Gets or sets unit of currency being used + /// + [JsonProperty(PropertyName = "unit")] + public string Unit { get; set; } + + /// + /// Gets or sets current spend + /// + [JsonProperty(PropertyName = "currentSpend")] + public decimal? CurrentSpend { get; set; } + + /// + /// Gets or sets list of emails to contact + /// + [JsonProperty(PropertyName = "contactEmails")] + public IList ContactEmails { get; set; } + + /// + /// Gets or sets list of action groups to broadcast to + /// + [JsonProperty(PropertyName = "contactGroups")] + public IList ContactGroups { get; set; } + + /// + /// Gets or sets list of contact roles + /// + [JsonProperty(PropertyName = "contactRoles")] + public IList ContactRoles { get; set; } + + /// + /// Gets or sets overriding alert + /// + [JsonProperty(PropertyName = "overridingAlert")] + public string OverridingAlert { get; set; } + + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/AlertsResult.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/AlertsResult.cs new file mode 100644 index 000000000000..1f74bfe6615a --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/AlertsResult.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 Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Result of alerts. + /// + public partial class AlertsResult + { + /// + /// Initializes a new instance of the AlertsResult class. + /// + public AlertsResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AlertsResult class. + /// + /// List of alerts. + /// URL to get the next set of alerts results if + /// there are any. + public AlertsResult(IList value = default(IList), string nextLink = default(string)) + { + Value = value; + NextLink = nextLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets list of alerts. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; private set; } + + /// + /// Gets URL to get the next set of alerts results if there are any. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; private set; } + + } +} diff --git a/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ForecastDefinition.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ForecastDefinition.cs new file mode 100644 index 000000000000..a8afb938aaa5 --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ForecastDefinition.cs @@ -0,0 +1,131 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CostManagement.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The definition of a forecast. + /// + public partial class ForecastDefinition + { + /// + /// Initializes a new instance of the ForecastDefinition class. + /// + public ForecastDefinition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ForecastDefinition class. + /// + /// The type of the forecast. Possible values + /// include: 'Usage', 'ActualCost', 'AmortizedCost' + /// The time frame for pulling data for the + /// forecast. 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 + /// forecast. + /// Has definition for data in this + /// forecast. + /// a boolean determining if actualCost + /// will be included + /// a boolean determining if + /// FreshPartialCost will be included + public ForecastDefinition(string type, string timeframe, QueryTimePeriod timePeriod = default(QueryTimePeriod), QueryDataset dataset = default(QueryDataset), bool? includeActualCost = default(bool?), bool? includeFreshPartialCost = default(bool?)) + { + Type = type; + Timeframe = timeframe; + TimePeriod = timePeriod; + Dataset = dataset; + IncludeActualCost = includeActualCost; + IncludeFreshPartialCost = includeFreshPartialCost; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the type of the forecast. 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 forecast. 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 forecast. + /// + [JsonProperty(PropertyName = "timePeriod")] + public QueryTimePeriod TimePeriod { get; set; } + + /// + /// Gets or sets has definition for data in this forecast. + /// + [JsonProperty(PropertyName = "dataset")] + public QueryDataset Dataset { get; set; } + + /// + /// Gets or sets a boolean determining if actualCost will be included + /// + [JsonProperty(PropertyName = "includeActualCost")] + public bool? IncludeActualCost { get; set; } + + /// + /// Gets or sets a boolean determining if FreshPartialCost will be + /// included + /// + [JsonProperty(PropertyName = "includeFreshPartialCost")] + public bool? IncludeFreshPartialCost { 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/ForecastTimeframeType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ForecastTimeframeType.cs new file mode 100644 index 000000000000..96a2bda5b97b --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ForecastTimeframeType.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 ForecastTimeframeType. + /// + public static class ForecastTimeframeType + { + 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/Models/ForecastType.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ForecastType.cs new file mode 100644 index 000000000000..f55f0139b65e --- /dev/null +++ b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/Models/ForecastType.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 ForecastType. + /// + public static class ForecastType + { + 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/SdkInfo_CostManagementClient.cs b/sdk/cost-management/Microsoft.Azure.Management.CostManagement/src/Generated/SdkInfo_CostManagementClient.cs index 41d98c6a62b6..53a42639681c 100644 --- 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 @@ -19,8 +19,10 @@ public static IEnumerable> ApiInfo_CostManagementC { return new Tuple[] { + new Tuple("CostManagement", "Alerts", "2019-11-01"), new Tuple("CostManagement", "Dimensions", "2019-11-01"), new Tuple("CostManagement", "Exports", "2019-11-01"), + new Tuple("CostManagement", "Forecast", "2019-11-01"), new Tuple("CostManagement", "Operations", "2019-11-01"), new Tuple("CostManagement", "Query", "2019-11-01"), }.AsEnumerable();