From b9a7d6ed695a33bccf96d22ec50b25ff2ae7041d Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 28 Jul 2021 18:49:36 +0000 Subject: [PATCH] CodeGen from PR 15413 in Azure/azure-rest-api-specs Merge 3aeb06ba474a1c053a4a810f34c2820fdf6668ff into 7cc0a47e7808f3247c71cda25b7c1da8503272ba --- .../Generated/AzureQuotaExtensionAPIClient.cs | 373 +++++ .../IAzureQuotaExtensionAPIClient.cs | 88 ++ .../src/Generated/IOperationOperations.cs | 74 + .../src/Generated/IQuotaOperations.cs | 283 ++++ .../IQuotaRequestStatusOperations.cs | 133 ++ .../IQuotaResourceProvidersOperations.cs | 57 + .../Models/CommonResourceProperties.cs | 68 + .../CreateGenericQuotaRequestParameters.cs | 55 + .../Generated/Models/CurrentQuotaLimitBase.cs | 78 ++ .../src/Generated/Models/ExceptionResponse.cs | 51 + .../Models/ExceptionResponseException.cs | 62 + .../src/Generated/Models/OperationDisplay.cs | 72 + .../src/Generated/Models/OperationResponse.cs | 58 + .../src/Generated/Models/Page.cs | 53 + .../Generated/Models/QuotaBucketProperties.cs | 59 + .../src/Generated/Models/QuotaGetHeaders.cs | 53 + .../Generated/Models/QuotaLimitsResponse.cs | 64 + .../src/Generated/Models/QuotaListHeaders.cs | 53 + .../src/Generated/Models/QuotaProperties.cs | 132 ++ .../Generated/Models/QuotaRequestDetails.cs | 112 ++ .../QuotaRequestOneResourceSubmitResponse.cs | 193 +++ .../Models/QuotaRequestProperties.cs | 84 ++ .../src/Generated/Models/QuotaRequestState.cs | 25 + .../Models/QuotaRequestSubmitResponse.cs | 78 ++ .../Models/QuotaRequestSubmitResponse202.cs | 177 +++ .../Generated/Models/QuotaTemplateDetails.cs | 72 + .../Generated/Models/QuotaTemplatesDetails.cs | 53 + .../Models/QuotaTypeDimensionInformation.cs | 69 + .../src/Generated/Models/ResourceName.cs | 60 + .../Models/ResourceProviderDimension.cs | 59 + .../Models/ResourceProviderInformation.cs | 66 + .../Models/ResourceProviderTemplate.cs | 78 ++ .../Generated/Models/ResourceProvidersList.cs | 53 + .../Generated/Models/ResourceQueryDetails.cs | 81 ++ .../Generated/Models/ResourceQueryMethod.cs | 22 + .../src/Generated/Models/ResourceQueryType.cs | 22 + .../src/Generated/Models/ResourceType.cs | 25 + .../src/Generated/Models/ServiceError.cs | 69 + .../Generated/Models/ServiceErrorDetail.cs | 59 + .../src/Generated/Models/SubRequest.cs | 107 ++ .../src/Generated/OperationOperations.cs | 403 ++++++ .../OperationOperationsExtensions.cs | 99 ++ .../src/Generated/QuotaOperations.cs | 1202 +++++++++++++++++ .../Generated/QuotaOperationsExtensions.cs | 441 ++++++ .../Generated/QuotaRequestStatusOperations.cs | 649 +++++++++ .../QuotaRequestStatusOperationsExtensions.cs | 195 +++ .../QuotaResourceProvidersOperations.cs | 239 ++++ ...taResourceProvidersOperationsExtensions.cs | 73 + .../SdkInfo_AzureQuotaExtensionAPI.cs | 30 + 49 files changed, 6761 insertions(+) create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/AzureQuotaExtensionAPIClient.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/IAzureQuotaExtensionAPIClient.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/IOperationOperations.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/IQuotaOperations.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/IQuotaRequestStatusOperations.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/IQuotaResourceProvidersOperations.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/CommonResourceProperties.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/CreateGenericQuotaRequestParameters.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/CurrentQuotaLimitBase.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ExceptionResponse.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ExceptionResponseException.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/OperationDisplay.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/OperationResponse.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/Page.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaBucketProperties.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaGetHeaders.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaLimitsResponse.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaListHeaders.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaProperties.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaRequestDetails.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaRequestOneResourceSubmitResponse.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaRequestProperties.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaRequestState.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaRequestSubmitResponse.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaRequestSubmitResponse202.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaTemplateDetails.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaTemplatesDetails.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaTypeDimensionInformation.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ResourceName.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ResourceProviderDimension.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ResourceProviderInformation.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ResourceProviderTemplate.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ResourceProvidersList.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ResourceQueryDetails.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ResourceQueryMethod.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ResourceQueryType.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ResourceType.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ServiceError.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ServiceErrorDetail.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/SubRequest.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/OperationOperations.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/OperationOperationsExtensions.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/QuotaOperations.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/QuotaOperationsExtensions.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/QuotaRequestStatusOperations.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/QuotaRequestStatusOperationsExtensions.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/QuotaResourceProvidersOperations.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/QuotaResourceProvidersOperationsExtensions.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/SdkInfo_AzureQuotaExtensionAPI.cs diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/AzureQuotaExtensionAPIClient.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/AzureQuotaExtensionAPIClient.cs new file mode 100644 index 000000000000..7e983256d9ee --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/AzureQuotaExtensionAPIClient.cs @@ -0,0 +1,373 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Quota +{ + 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; + + /// + /// Microsoft Azure Quota Resource Provider + /// + public partial class AzureQuotaExtensionAPIClient : ServiceClient, IAzureQuotaExtensionAPIClient, 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; } + + /// + /// The API version to use for this operation. + /// + public string ApiVersion { get; private 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 IQuotaOperations. + /// + public virtual IQuotaOperations Quota { get; private set; } + + /// + /// Gets the IQuotaRequestStatusOperations. + /// + public virtual IQuotaRequestStatusOperations QuotaRequestStatus { get; private set; } + + /// + /// Gets the IQuotaResourceProvidersOperations. + /// + public virtual IQuotaResourceProvidersOperations QuotaResourceProviders { get; private set; } + + /// + /// Gets the IOperationOperations. + /// + public virtual IOperationOperations Operation { get; private set; } + + /// + /// Initializes a new instance of the AzureQuotaExtensionAPIClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling AzureQuotaExtensionAPIClient.Dispose(). False: will not dispose provided httpClient + protected AzureQuotaExtensionAPIClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + + /// + /// Initializes a new instance of the AzureQuotaExtensionAPIClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected AzureQuotaExtensionAPIClient(params DelegatingHandler[] handlers) : base(handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the AzureQuotaExtensionAPIClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected AzureQuotaExtensionAPIClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the AzureQuotaExtensionAPIClient 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 AzureQuotaExtensionAPIClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the AzureQuotaExtensionAPIClient 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 AzureQuotaExtensionAPIClient(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 AzureQuotaExtensionAPIClient 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 AzureQuotaExtensionAPIClient(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 AzureQuotaExtensionAPIClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling AzureQuotaExtensionAPIClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public AzureQuotaExtensionAPIClient(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 AzureQuotaExtensionAPIClient 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 AzureQuotaExtensionAPIClient(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 AzureQuotaExtensionAPIClient 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 AzureQuotaExtensionAPIClient(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 AzureQuotaExtensionAPIClient 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 AzureQuotaExtensionAPIClient(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() + { + Quota = new QuotaOperations(this); + QuotaRequestStatus = new QuotaRequestStatusOperations(this); + QuotaResourceProviders = new QuotaResourceProvidersOperations(this); + Operation = new OperationOperations(this); + BaseUri = new System.Uri("https://management.azure.com"); + ApiVersion = "2021-03-15-preview"; + AcceptLanguage = "en-US"; + LongRunningOperationRetryTimeout = 30; + GenerateClientRequestId = true; + SerializationSettings = new JsonSerializerSettings + { + Formatting = Newtonsoft.Json.Formatting.Indented, + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + SerializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings = new JsonSerializerSettings + { + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + CustomInitialize(); + DeserializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); + } + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/IAzureQuotaExtensionAPIClient.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/IAzureQuotaExtensionAPIClient.cs new file mode 100644 index 000000000000..008ad38df5ee --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/IAzureQuotaExtensionAPIClient.cs @@ -0,0 +1,88 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Quota +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + + /// + /// Microsoft Azure Quota Resource Provider + /// + public partial interface IAzureQuotaExtensionAPIClient : 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; } + + /// + /// The API version to use for this operation. + /// + string ApiVersion { get; } + + /// + /// 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 IQuotaOperations. + /// + IQuotaOperations Quota { get; } + + /// + /// Gets the IQuotaRequestStatusOperations. + /// + IQuotaRequestStatusOperations QuotaRequestStatus { get; } + + /// + /// Gets the IQuotaResourceProvidersOperations. + /// + IQuotaResourceProvidersOperations QuotaResourceProviders { get; } + + /// + /// Gets the IOperationOperations. + /// + IOperationOperations Operation { get; } + + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/IOperationOperations.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/IOperationOperations.cs new file mode 100644 index 000000000000..2865a74b04d3 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/IOperationOperations.cs @@ -0,0 +1,74 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Quota +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// OperationOperations operations. + /// + public partial interface IOperationOperations + { + /// + /// GET operations. + /// + /// + /// List all GET 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)); + /// + /// GET operations. + /// + /// + /// List all GET 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/quota/Microsoft.Azure.Management.Quota/src/Generated/IQuotaOperations.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/IQuotaOperations.cs new file mode 100644 index 000000000000..7cf7c560072b --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/IQuotaOperations.cs @@ -0,0 +1,283 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Quota +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// QuotaOperations operations. + /// + public partial interface IQuotaOperations + { + /// + /// Gets the quota limit and current quota usage of a resource. The + /// response can be used to determine the remaining quota and calculate + /// a new quota limit that can be submitted with a PUT request. + /// + /// + /// Resource name for a given resource provider. For example: + /// - SKU name for Microsoft.Compute + /// - Sku or TotalLowPriorityCores for + /// Microsoft.MachineLearningServices + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + /// This is the target Azure resource URI for the List GET operation. + /// If a `{resourceName}` is added after `/quotaLimits`, then it's the + /// target Azure resource URI in the GET operation for the specific + /// resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceName, string scope, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update the quota limit for the specified resource to the + /// requested value. To update the quota, follow these steps: + /// 1. Use the GET operation to determine how much quota remains for + /// the specific resource and to calculate the new quota limit. These + /// steps are detailed in [this + /// example](https://techcommunity.microsoft.com/t5/azure-governance-and-management/using-the-new-quota-rest-api/ba-p/2183670). + /// 2. Use this PUT operation to update the quota limit. + /// + /// + /// Resource name for a given resource provider. For example: + /// - SKU name for Microsoft.Compute + /// - Sku or TotalLowPriorityCores for + /// Microsoft.MachineLearningServices + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + /// This is the target Azure resource URI for the List GET operation. + /// If a `{resourceName}` is added after `/quotaLimits`, then it's the + /// target Azure resource URI in the GET operation for the specific + /// resource. + /// + /// + /// Quota properties for the specified resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceName, string scope, QuotaProperties properties = default(QuotaProperties), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update the quota limit for a specific resource to the specified + /// value: + /// 1. Use the GET operation to determine how much quota remains for + /// the specific resource and to calculate the new quota limit. These + /// steps are detailed in [this + /// example](https://techcommunity.microsoft.com/t5/azure-governance-and-management/using-the-new-quota-rest-api/ba-p/2183670). + /// 2. Use this PUT operation to update the quota limit. + /// + /// + /// Resource name for a given resource provider. For example: + /// - SKU name for Microsoft.Compute + /// - Sku or TotalLowPriorityCores for + /// Microsoft.MachineLearningServices + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + /// This is the target Azure resource URI for the List GET operation. + /// If a `{resourceName}` is added after `/quotaLimits`, then it's the + /// target Azure resource URI in the GET operation for the specific + /// resource. + /// + /// + /// Quota properties for the specified resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceName, string scope, QuotaProperties properties = default(QuotaProperties), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get a list of current quota limits and usages of all resources. The + /// response from this GET operation can be leveraged to submit + /// requests to update a quota. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + /// This is the target Azure resource URI for the List GET operation. + /// If a `{resourceName}` is added after `/quotaLimits`, then it's the + /// target Azure resource URI in the GET operation for the specific + /// resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task,QuotaListHeaders>> ListWithHttpMessagesAsync(string scope, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update the quota limit for the specified resource to the + /// requested value. To update the quota, follow these steps: + /// 1. Use the GET operation to determine how much quota remains for + /// the specific resource and to calculate the new quota limit. These + /// steps are detailed in [this + /// example](https://techcommunity.microsoft.com/t5/azure-governance-and-management/using-the-new-quota-rest-api/ba-p/2183670). + /// 2. Use this PUT operation to update the quota limit. + /// + /// + /// Resource name for a given resource provider. For example: + /// - SKU name for Microsoft.Compute + /// - Sku or TotalLowPriorityCores for + /// Microsoft.MachineLearningServices + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + /// This is the target Azure resource URI for the List GET operation. + /// If a `{resourceName}` is added after `/quotaLimits`, then it's the + /// target Azure resource URI in the GET operation for the specific + /// resource. + /// + /// + /// Quota properties for the specified resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceName, string scope, QuotaProperties properties = default(QuotaProperties), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update the quota limit for a specific resource to the specified + /// value: + /// 1. Use the GET operation to determine how much quota remains for + /// the specific resource and to calculate the new quota limit. These + /// steps are detailed in [this + /// example](https://techcommunity.microsoft.com/t5/azure-governance-and-management/using-the-new-quota-rest-api/ba-p/2183670). + /// 2. Use this PUT operation to update the quota limit. + /// + /// + /// Resource name for a given resource provider. For example: + /// - SKU name for Microsoft.Compute + /// - Sku or TotalLowPriorityCores for + /// Microsoft.MachineLearningServices + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + /// This is the target Azure resource URI for the List GET operation. + /// If a `{resourceName}` is added after `/quotaLimits`, then it's the + /// target Azure resource URI in the GET operation for the specific + /// resource. + /// + /// + /// Quota properties for the specified resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(string resourceName, string scope, QuotaProperties properties = default(QuotaProperties), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get a list of current quota limits and usages of all resources. The + /// response from this GET operation can be leveraged to submit + /// requests to update a quota. + /// + /// + /// 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,QuotaListHeaders>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/IQuotaRequestStatusOperations.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/IQuotaRequestStatusOperations.cs new file mode 100644 index 000000000000..a09d33ed105f --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/IQuotaRequestStatusOperations.cs @@ -0,0 +1,133 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Quota +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// QuotaRequestStatusOperations operations. + /// + public partial interface IQuotaRequestStatusOperations + { + /// + /// Gets the quota request details and status by quota request ID for + /// the resources of the resource provider at a specific location. The + /// quota request ID **id** is returned in the response of the PUT + /// operation. + /// + /// + /// Quota request ID. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + /// This is the target Azure resource URI for the List GET operation. + /// If a `{resourceName}` is added after `/quotaLimits`, then it's the + /// target Azure resource URI in the GET operation for the specific + /// resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string id, string scope, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// For the specified location and resource provider, gets the current + /// quota requests under the subscription for a one year period ending + /// at the time is made. Use the **oData** filter can be used to select + /// quota requests. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + /// This is the target Azure resource URI for the List GET operation. + /// If a `{resourceName}` is added after `/quotaLimits`, then it's the + /// target Azure resource URI in the GET operation for the specific + /// resource. + /// + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// |requestSubmitTime | ge, le, eq, gt, lt + /// |provisioningState eq {QuotaRequestState} + /// |resourceName eq {resourceName} + /// + /// + /// Number of records to return. + /// + /// + /// The **Skiptoken** parameter is used only if a previous operation + /// returned a partial result. If a previous response contains a + /// **nextLink** element, the value of the **nextLink** element + /// includes 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, string filter = default(string), int? top = default(int?), string skiptoken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// For the specified location and resource provider, gets the current + /// quota requests under the subscription for a one year period ending + /// at the time is made. Use the **oData** filter can be used to select + /// quota requests. + /// + /// + /// 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/quota/Microsoft.Azure.Management.Quota/src/Generated/IQuotaResourceProvidersOperations.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/IQuotaResourceProvidersOperations.cs new file mode 100644 index 000000000000..c965a147e4ea --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/IQuotaResourceProvidersOperations.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.Quota +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// QuotaResourceProvidersOperations operations. + /// + public partial interface IQuotaResourceProvidersOperations + { + /// + /// Gets the list of current resource providers supported by the + /// Microsoft.Quota resource provider. + /// For each resource provider, the resource templates the resource + /// provider supports are be provided. + /// For each resource template, the resource dimensions are listed. The + /// resource dimensions are the name-value pairs in the resource URI. + /// Example: Microsoft.Compute Resource Provider + /// The URI template is + /// '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{locationId}/quotaBucket'. + /// The actual dimensions vary depending on the resource provider. + /// The resource dimensions are + /// {subscriptions},{locations},{quotaBucket}. + /// + /// + /// 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)); + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/CommonResourceProperties.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/CommonResourceProperties.cs new file mode 100644 index 000000000000..6856749cdb28 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/CommonResourceProperties.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.Quota.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Resource properties. + /// + public partial class CommonResourceProperties + { + /// + /// Initializes a new instance of the CommonResourceProperties class. + /// + public CommonResourceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CommonResourceProperties class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// "Microsoft.Quota/quotaLimits" + public CommonResourceProperties(string id = default(string), string name = default(string), string type = default(string)) + { + Id = id; + Name = name; + Type = type; + 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. "Microsoft.Quota/quotaLimits" + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/CreateGenericQuotaRequestParameters.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/CreateGenericQuotaRequestParameters.cs new file mode 100644 index 000000000000..1449245e77ca --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/CreateGenericQuotaRequestParameters.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Quota.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Quota change requests information. + /// + public partial class CreateGenericQuotaRequestParameters + { + /// + /// Initializes a new instance of the + /// CreateGenericQuotaRequestParameters class. + /// + public CreateGenericQuotaRequestParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// CreateGenericQuotaRequestParameters class. + /// + /// Quota change requests. + public CreateGenericQuotaRequestParameters(IList value = default(IList)) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets quota change requests. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/CurrentQuotaLimitBase.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/CurrentQuotaLimitBase.cs new file mode 100644 index 000000000000..29a98c3c6d42 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/CurrentQuotaLimitBase.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.Quota.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Quota limit. + /// + public partial class CurrentQuotaLimitBase : IResource + { + /// + /// Initializes a new instance of the CurrentQuotaLimitBase class. + /// + public CurrentQuotaLimitBase() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CurrentQuotaLimitBase class. + /// + /// The resource Id. + /// The resource type. + /// The resource name. + /// Quota properties for the specified + /// resource. + public CurrentQuotaLimitBase(string id = default(string), string type = default(string), string name = default(string), QuotaProperties properties = default(QuotaProperties)) + { + Id = id; + Type = type; + Name = name; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the resource Id. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets the resource name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets or sets quota properties for the specified resource. + /// + [JsonProperty(PropertyName = "properties")] + public QuotaProperties Properties { get; set; } + + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ExceptionResponse.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ExceptionResponse.cs new file mode 100644 index 000000000000..ef78bc21ceca --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ExceptionResponse.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Quota.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Error. + /// + public partial class ExceptionResponse + { + /// + /// Initializes a new instance of the ExceptionResponse class. + /// + public ExceptionResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExceptionResponse class. + /// + /// API error details. + public ExceptionResponse(ServiceError error = default(ServiceError)) + { + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets API error details. + /// + [JsonProperty(PropertyName = "error")] + public ServiceError Error { get; set; } + + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ExceptionResponseException.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ExceptionResponseException.cs new file mode 100644 index 000000000000..702332e97dc5 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ExceptionResponseException.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.Quota.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with ExceptionResponse + /// information. + /// + public partial class ExceptionResponseException : 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 ExceptionResponse Body { get; set; } + + /// + /// Initializes a new instance of the ExceptionResponseException class. + /// + public ExceptionResponseException() + { + } + + /// + /// Initializes a new instance of the ExceptionResponseException class. + /// + /// The exception message. + public ExceptionResponseException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the ExceptionResponseException class. + /// + /// The exception message. + /// Inner exception. + public ExceptionResponseException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/OperationDisplay.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/OperationDisplay.cs new file mode 100644 index 000000000000..704a943a8583 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/OperationDisplay.cs @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Quota.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class OperationDisplay + { + /// + /// Initializes a new instance of the OperationDisplay class. + /// + public OperationDisplay() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationDisplay class. + /// + /// Provider name. + /// Resource name. + /// Operation name. + /// Operation description. + public OperationDisplay(string provider = default(string), string resource = default(string), string operation = default(string), string description = default(string)) + { + Provider = provider; + Resource = resource; + Operation = operation; + Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets provider name. + /// + [JsonProperty(PropertyName = "provider")] + public string Provider { get; set; } + + /// + /// Gets or sets resource name. + /// + [JsonProperty(PropertyName = "resource")] + public string Resource { get; set; } + + /// + /// Gets or sets operation name. + /// + [JsonProperty(PropertyName = "operation")] + public string Operation { get; set; } + + /// + /// Gets or sets operation description. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/OperationResponse.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/OperationResponse.cs new file mode 100644 index 000000000000..8aa37d5c5a87 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/OperationResponse.cs @@ -0,0 +1,58 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Quota.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class OperationResponse + { + /// + /// Initializes a new instance of the OperationResponse class. + /// + public OperationResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationResponse class. + /// + public OperationResponse(string name = default(string), OperationDisplay display = default(OperationDisplay), string origin = default(string)) + { + Name = name; + Display = display; + Origin = origin; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// + [JsonProperty(PropertyName = "display")] + public OperationDisplay Display { get; set; } + + /// + /// + [JsonProperty(PropertyName = "origin")] + public string Origin { get; set; } + + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/Page.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/Page.cs new file mode 100644 index 000000000000..6a9f464aa301 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/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.Quota.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + + /// + /// Defines a page in Azure responses. + /// + /// Type of the page content items + [JsonObject] + public class Page : IPage + { + /// + /// Gets the link to the next page. + /// + [JsonProperty("nextLink")] + public string NextPageLink { get; private set; } + + [JsonProperty("value")] + private IList Items{ get; set; } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + public IEnumerator GetEnumerator() + { + return Items == null ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); + } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaBucketProperties.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaBucketProperties.cs new file mode 100644 index 000000000000..149ca32b17d8 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaBucketProperties.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Quota.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// quotaBucket provider properties. + /// + public partial class QuotaBucketProperties + { + /// + /// Initializes a new instance of the QuotaBucketProperties class. + /// + public QuotaBucketProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the QuotaBucketProperties class. + /// + /// Property name. + /// Display name. + public QuotaBucketProperties(string name = default(string), string displayName = default(string)) + { + Name = name; + DisplayName = displayName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets property name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets display name. + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaGetHeaders.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaGetHeaders.cs new file mode 100644 index 000000000000..f9fec318d07c --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaGetHeaders.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.Quota.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Get operation. + /// + public partial class QuotaGetHeaders + { + /// + /// Initializes a new instance of the QuotaGetHeaders class. + /// + public QuotaGetHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the QuotaGetHeaders class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public QuotaGetHeaders(string eTag = default(string)) + { + ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets current entity state version. Should be treated as + /// opaque and used to make conditional HTTP requests. + /// + [JsonProperty(PropertyName = "ETag")] + public string ETag { get; set; } + + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaLimitsResponse.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaLimitsResponse.cs new file mode 100644 index 000000000000..113dad9e0a98 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaLimitsResponse.cs @@ -0,0 +1,64 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Quota.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Quota limits request response. + /// + public partial class QuotaLimitsResponse + { + /// + /// Initializes a new instance of the QuotaLimitsResponse class. + /// + public QuotaLimitsResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the QuotaLimitsResponse class. + /// + /// List of quota limits with the quota request + /// status. + /// The URI used to fetch the next page of quota + /// limits. When there are no more pages, this is null. + public QuotaLimitsResponse(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 or sets list of quota limits with the quota request status. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + /// + /// Gets or sets the URI used to fetch the next page of quota limits. + /// When there are no more pages, this is null. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; set; } + + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaListHeaders.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaListHeaders.cs new file mode 100644 index 000000000000..8ddd751b666c --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaListHeaders.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.Quota.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for List operation. + /// + public partial class QuotaListHeaders + { + /// + /// Initializes a new instance of the QuotaListHeaders class. + /// + public QuotaListHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the QuotaListHeaders class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public QuotaListHeaders(string eTag = default(string)) + { + ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets current entity state version. Should be treated as + /// opaque and used to make conditional HTTP requests. + /// + [JsonProperty(PropertyName = "ETag")] + public string ETag { get; set; } + + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaProperties.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaProperties.cs new file mode 100644 index 000000000000..bae26f58df17 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaProperties.cs @@ -0,0 +1,132 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Quota.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Quota properties for the specified resource. + /// + public partial class QuotaProperties + { + /// + /// Initializes a new instance of the QuotaProperties class. + /// + public QuotaProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the QuotaProperties class. + /// + /// Quota limit. + /// Usage information for the current + /// resource. + /// The quota limit units, such as Count and Bytes. + /// When requesting quota, use the **unit** value returned in the GET + /// response in the request body of your PUT operation. + /// Resource name provided by the resource provider. + /// Use this property name when requesting quota. + /// Resource type name. Possible values + /// include: 'standard', 'dedicated', 'lowPriority', 'shared', + /// 'serviceSpecific' + /// The time period over which the quota + /// usage values are summarized. For example: + /// *P1D (per one day) + /// *PT1M (per one minute) + /// *PT1S (per one second). + /// This parameter is optional because, for some resources like + /// compute, the period is irrelevant. + /// States if quota can be requested + /// for this resource. + /// Additional properties for the specific + /// resource provider. + public QuotaProperties(int? limit = default(int?), int? currentValue = default(int?), string unit = default(string), ResourceName name = default(ResourceName), string resourceType = default(string), string quotaPeriod = default(string), bool? isQuotaApplicable = default(bool?), object properties = default(object)) + { + Limit = limit; + CurrentValue = currentValue; + Unit = unit; + Name = name; + ResourceType = resourceType; + QuotaPeriod = quotaPeriod; + IsQuotaApplicable = isQuotaApplicable; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets quota limit. + /// + [JsonProperty(PropertyName = "limit")] + public int? Limit { get; set; } + + /// + /// Gets usage information for the current resource. + /// + [JsonProperty(PropertyName = "currentValue")] + public int? CurrentValue { get; private set; } + + /// + /// Gets The quota limit units, such as Count and Bytes. When + /// requesting quota, use the **unit** value returned in the GET + /// response in the request body of your PUT operation. + /// + [JsonProperty(PropertyName = "unit")] + public string Unit { get; private set; } + + /// + /// Gets or sets resource name provided by the resource provider. Use + /// this property name when requesting quota. + /// + [JsonProperty(PropertyName = "name")] + public ResourceName Name { get; set; } + + /// + /// Gets or sets resource type name. Possible values include: + /// 'standard', 'dedicated', 'lowPriority', 'shared', 'serviceSpecific' + /// + [JsonProperty(PropertyName = "resourceType")] + public string ResourceType { get; set; } + + /// + /// Gets the time period over which the quota usage values are + /// summarized. For example: + /// *P1D (per one day) + /// *PT1M (per one minute) + /// *PT1S (per one second). + /// This parameter is optional because, for some resources like + /// compute, the period is irrelevant. + /// + [JsonProperty(PropertyName = "quotaPeriod")] + public string QuotaPeriod { get; private set; } + + /// + /// Gets states if quota can be requested for this resource. + /// + [JsonProperty(PropertyName = "isQuotaApplicable")] + public bool? IsQuotaApplicable { get; private set; } + + /// + /// Gets or sets additional properties for the specific resource + /// provider. + /// + [JsonProperty(PropertyName = "properties")] + public object Properties { get; set; } + + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaRequestDetails.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaRequestDetails.cs new file mode 100644 index 000000000000..708810845be7 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaRequestDetails.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.Quota.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// List of quota requests with details. + /// + [Rest.Serialization.JsonTransformation] + public partial class QuotaRequestDetails + { + /// + /// Initializes a new instance of the QuotaRequestDetails class. + /// + public QuotaRequestDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the QuotaRequestDetails class. + /// + /// Quota request ID. + /// Quota request name. + /// Resource type. + /// "Microsoft.Quota/quotaLimits" + /// The quota request status. Possible + /// values include: 'Accepted', 'Invalid', 'Succeeded', 'Failed', + /// 'InProgress' + /// User-friendly status message. + /// The quota request submission time. + /// The date conforms to the following format specified by the ISO 8601 + /// standard: yyyy-MM-ddTHH:mm:ssZ + /// Quota request details. + public QuotaRequestDetails(string id = default(string), string name = default(string), string type = default(string), string provisioningState = default(string), string message = default(string), System.DateTime? requestSubmitTime = default(System.DateTime?), IList value = default(IList)) + { + Id = id; + Name = name; + Type = type; + ProvisioningState = provisioningState; + Message = message; + RequestSubmitTime = requestSubmitTime; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets quota request ID. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets quota request name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets resource type. "Microsoft.Quota/quotaLimits" + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets the quota request status. Possible values include: + /// 'Accepted', 'Invalid', 'Succeeded', 'Failed', 'InProgress' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// Gets user-friendly status message. + /// + [JsonProperty(PropertyName = "properties.message")] + public string Message { get; private set; } + + /// + /// Gets the quota request submission time. The date conforms to the + /// following format specified by the ISO 8601 standard: + /// yyyy-MM-ddTHH:mm:ssZ + /// + [JsonProperty(PropertyName = "properties.requestSubmitTime")] + public System.DateTime? RequestSubmitTime { get; private set; } + + /// + /// Gets or sets quota request details. + /// + [JsonProperty(PropertyName = "properties.value")] + public IList Value { get; set; } + + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaRequestOneResourceSubmitResponse.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaRequestOneResourceSubmitResponse.cs new file mode 100644 index 000000000000..14e2b8d013ab --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaRequestOneResourceSubmitResponse.cs @@ -0,0 +1,193 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Quota.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Quota request response. + /// + [Rest.Serialization.JsonTransformation] + public partial class QuotaRequestOneResourceSubmitResponse : IResource + { + /// + /// Initializes a new instance of the + /// QuotaRequestOneResourceSubmitResponse class. + /// + public QuotaRequestOneResourceSubmitResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// QuotaRequestOneResourceSubmitResponse class. + /// + /// Quota request ID. + /// The name of the quota request. + /// Resource type. + /// "Microsoft.Quota/ServiceLimitRequests" + /// Quota request status. Possible + /// values include: 'Accepted', 'Invalid', 'Succeeded', 'Failed', + /// 'InProgress' + /// User-friendly status message. + /// Quota request submission time. The + /// date conforms to the following ISO 8601 standard format: + /// yyyy-MM-ddTHH:mm:ssZ. + /// Quota limit. + /// Usage information for the current + /// resource. + /// The quota limit units, such as Count and Bytes. + /// When requesting quota, use the **unit** value returned in the GET + /// response in the request body of your PUT operation. + /// Resource name provided by the resource + /// provider. Use this property name when requesting quota. + /// Resource type name. Possible values + /// include: 'standard', 'dedicated', 'lowPriority', 'shared', + /// 'serviceSpecific' + /// The time period over which the quota + /// usage values are summarized. For example: + /// *P1D (per one day) + /// *PT1M (per one minute) + /// *PT1S (per one second). + /// This parameter is optional because, for some resources like + /// compute, the period is irrelevant. + /// States if quota can be requested + /// for this resource. + /// Additional properties for the specific + /// resource provider. + public QuotaRequestOneResourceSubmitResponse(string id = default(string), string name = default(string), string type = default(string), string provisioningState = default(string), string message = default(string), System.DateTime? requestSubmitTime = default(System.DateTime?), int? limit = default(int?), int? currentValue = default(int?), string unit = default(string), ResourceName name1 = default(ResourceName), string resourceType = default(string), string quotaPeriod = default(string), bool? isQuotaApplicable = default(bool?), object properties = default(object)) + { + Id = id; + Name = name; + Type = type; + ProvisioningState = provisioningState; + Message = message; + RequestSubmitTime = requestSubmitTime; + Limit = limit; + CurrentValue = currentValue; + Unit = unit; + Name1 = name1; + ResourceType = resourceType; + QuotaPeriod = quotaPeriod; + IsQuotaApplicable = isQuotaApplicable; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets quota request ID. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the name of the quota request. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets resource type. "Microsoft.Quota/ServiceLimitRequests" + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets quota request status. Possible values include: 'Accepted', + /// 'Invalid', 'Succeeded', 'Failed', 'InProgress' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets user-friendly status message. + /// + [JsonProperty(PropertyName = "properties.message")] + public string Message { get; private set; } + + /// + /// Gets quota request submission time. The date conforms to the + /// following ISO 8601 standard format: yyyy-MM-ddTHH:mm:ssZ. + /// + [JsonProperty(PropertyName = "properties.requestSubmitTime")] + public System.DateTime? RequestSubmitTime { get; private set; } + + /// + /// Gets or sets quota limit. + /// + [JsonProperty(PropertyName = "properties.limit")] + public int? Limit { get; set; } + + /// + /// Gets usage information for the current resource. + /// + [JsonProperty(PropertyName = "properties.currentValue")] + public int? CurrentValue { get; private set; } + + /// + /// Gets or sets The quota limit units, such as Count and Bytes. When + /// requesting quota, use the **unit** value returned in the GET + /// response in the request body of your PUT operation. + /// + [JsonProperty(PropertyName = "properties.unit")] + public string Unit { get; set; } + + /// + /// Gets or sets resource name provided by the resource provider. Use + /// this property name when requesting quota. + /// + [JsonProperty(PropertyName = "properties.name")] + public ResourceName Name1 { get; set; } + + /// + /// Gets or sets resource type name. Possible values include: + /// 'standard', 'dedicated', 'lowPriority', 'shared', 'serviceSpecific' + /// + [JsonProperty(PropertyName = "properties.resourceType")] + public string ResourceType { get; set; } + + /// + /// Gets the time period over which the quota usage values are + /// summarized. For example: + /// *P1D (per one day) + /// *PT1M (per one minute) + /// *PT1S (per one second). + /// This parameter is optional because, for some resources like + /// compute, the period is irrelevant. + /// + [JsonProperty(PropertyName = "properties.quotaPeriod")] + public string QuotaPeriod { get; private set; } + + /// + /// Gets states if quota can be requested for this resource. + /// + [JsonProperty(PropertyName = "properties.isQuotaApplicable")] + public bool? IsQuotaApplicable { get; private set; } + + /// + /// Gets or sets additional properties for the specific resource + /// provider. + /// + [JsonProperty(PropertyName = "properties.properties")] + public object Properties { get; set; } + + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaRequestProperties.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaRequestProperties.cs new file mode 100644 index 000000000000..164af45900ed --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaRequestProperties.cs @@ -0,0 +1,84 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Quota.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Quota request properties. + /// + public partial class QuotaRequestProperties + { + /// + /// Initializes a new instance of the QuotaRequestProperties class. + /// + public QuotaRequestProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the QuotaRequestProperties class. + /// + /// The quota request status. Possible + /// values include: 'Accepted', 'Invalid', 'Succeeded', 'Failed', + /// 'InProgress' + /// User-friendly status message. + /// The quota request submission time. + /// The date conforms to the following format specified by the ISO 8601 + /// standard: yyyy-MM-ddTHH:mm:ssZ + /// Quota request details. + public QuotaRequestProperties(string provisioningState = default(string), string message = default(string), System.DateTime? requestSubmitTime = default(System.DateTime?), IList value = default(IList)) + { + ProvisioningState = provisioningState; + Message = message; + RequestSubmitTime = requestSubmitTime; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the quota request status. Possible values include: + /// 'Accepted', 'Invalid', 'Succeeded', 'Failed', 'InProgress' + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// Gets user-friendly status message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + /// + /// Gets the quota request submission time. The date conforms to the + /// following format specified by the ISO 8601 standard: + /// yyyy-MM-ddTHH:mm:ssZ + /// + [JsonProperty(PropertyName = "requestSubmitTime")] + public System.DateTime? RequestSubmitTime { get; private set; } + + /// + /// Gets or sets quota request details. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaRequestState.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaRequestState.cs new file mode 100644 index 000000000000..b0905304a563 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaRequestState.cs @@ -0,0 +1,25 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Quota.Models +{ + + /// + /// Defines values for QuotaRequestState. + /// + public static class QuotaRequestState + { + public const string Accepted = "Accepted"; + public const string Invalid = "Invalid"; + public const string Succeeded = "Succeeded"; + public const string Failed = "Failed"; + public const string InProgress = "InProgress"; + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaRequestSubmitResponse.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaRequestSubmitResponse.cs new file mode 100644 index 000000000000..14a0659c1072 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaRequestSubmitResponse.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.Quota.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Quota request response. + /// + public partial class QuotaRequestSubmitResponse : IResource + { + /// + /// Initializes a new instance of the QuotaRequestSubmitResponse class. + /// + public QuotaRequestSubmitResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the QuotaRequestSubmitResponse class. + /// + /// Quota request ID. + /// Quota request name. + /// The quota request details. + /// Resource type. + /// "Microsoft.Quota/quotaLimits" + public QuotaRequestSubmitResponse(string id = default(string), string name = default(string), QuotaRequestProperties properties = default(QuotaRequestProperties), string type = default(string)) + { + Id = id; + Name = name; + Properties = properties; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets quota request ID. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets quota request name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets or sets the quota request details. + /// + [JsonProperty(PropertyName = "properties")] + public QuotaRequestProperties Properties { get; set; } + + /// + /// Gets resource type. "Microsoft.Quota/quotaLimits" + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaRequestSubmitResponse202.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaRequestSubmitResponse202.cs new file mode 100644 index 000000000000..7f79949d0778 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaRequestSubmitResponse202.cs @@ -0,0 +1,177 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Quota.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The quota request response with the quota request ID. + /// + [Rest.Serialization.JsonTransformation] + public partial class QuotaRequestSubmitResponse202 + { + /// + /// Initializes a new instance of the QuotaRequestSubmitResponse202 + /// class. + /// + public QuotaRequestSubmitResponse202() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the QuotaRequestSubmitResponse202 + /// class. + /// + /// The quota request ID. To check the request status, + /// use the **id** value in a [Quota Request + /// Status](https://docs.microsoft.com/en-us/rest/api/reserved-vm-instances/quotarequeststatus/get) + /// GET operation. + /// Operation ID. + /// Resource type. + /// Quota request status. Possible + /// values include: 'Accepted', 'Invalid', 'Succeeded', 'Failed', + /// 'InProgress' + /// User-friendly message. + /// Quota limit. + /// Usage information for the current + /// resource. + /// The quota limit units, such as Count and Bytes. + /// When requesting quota, use the **unit** value returned in the GET + /// response in the request body of your PUT operation. + /// Resource name provided by the resource + /// provider. Use this property name when requesting quota. + /// Resource type name. Possible values + /// include: 'standard', 'dedicated', 'lowPriority', 'shared', + /// 'serviceSpecific' + /// The time period over which the quota + /// usage values are summarized. For example: + /// *P1D (per one day) + /// *PT1M (per one minute) + /// *PT1S (per one second). + /// This parameter is optional because, for some resources like + /// compute, the period is irrelevant. + /// Additional properties for the specific + /// resource provider. + public QuotaRequestSubmitResponse202(string id = default(string), string name = default(string), string type = default(string), string provisioningState = default(string), string message = default(string), int? limit = default(int?), int? currentValue = default(int?), string unit = default(string), ResourceName name1 = default(ResourceName), string resourceType = default(string), string quotaPeriod = default(string), object properties = default(object)) + { + Id = id; + Name = name; + Type = type; + ProvisioningState = provisioningState; + Message = message; + Limit = limit; + CurrentValue = currentValue; + Unit = unit; + Name1 = name1; + ResourceType = resourceType; + QuotaPeriod = quotaPeriod; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the quota request ID. To check the request status, use the + /// **id** value in a [Quota Request + /// Status](https://docs.microsoft.com/en-us/rest/api/reserved-vm-instances/quotarequeststatus/get) + /// GET operation. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets operation ID. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets quota request status. Possible values include: 'Accepted', + /// 'Invalid', 'Succeeded', 'Failed', 'InProgress' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets user-friendly message. + /// + [JsonProperty(PropertyName = "properties.message")] + public string Message { get; private set; } + + /// + /// Gets or sets quota limit. + /// + [JsonProperty(PropertyName = "properties.limit")] + public int? Limit { get; set; } + + /// + /// Gets usage information for the current resource. + /// + [JsonProperty(PropertyName = "properties.currentValue")] + public int? CurrentValue { get; private set; } + + /// + /// Gets or sets The quota limit units, such as Count and Bytes. When + /// requesting quota, use the **unit** value returned in the GET + /// response in the request body of your PUT operation. + /// + [JsonProperty(PropertyName = "properties.unit")] + public string Unit { get; set; } + + /// + /// Gets or sets resource name provided by the resource provider. Use + /// this property name when requesting quota. + /// + [JsonProperty(PropertyName = "properties.name")] + public ResourceName Name1 { get; set; } + + /// + /// Gets or sets resource type name. Possible values include: + /// 'standard', 'dedicated', 'lowPriority', 'shared', 'serviceSpecific' + /// + [JsonProperty(PropertyName = "properties.resourceType")] + public string ResourceType { get; set; } + + /// + /// Gets the time period over which the quota usage values are + /// summarized. For example: + /// *P1D (per one day) + /// *PT1M (per one minute) + /// *PT1S (per one second). + /// This parameter is optional because, for some resources like + /// compute, the period is irrelevant. + /// + [JsonProperty(PropertyName = "properties.quotaPeriod")] + public string QuotaPeriod { get; private set; } + + /// + /// Gets or sets additional properties for the specific resource + /// provider. + /// + [JsonProperty(PropertyName = "properties.properties")] + public object Properties { get; set; } + + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaTemplateDetails.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaTemplateDetails.cs new file mode 100644 index 000000000000..2b98c61d2432 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaTemplateDetails.cs @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Quota.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Quota template details. + /// + [Rest.Serialization.JsonTransformation] + public partial class QuotaTemplateDetails + { + /// + /// Initializes a new instance of the QuotaTemplateDetails class. + /// + public QuotaTemplateDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the QuotaTemplateDetails class. + /// + /// Resource type. + /// Resource type + /// Quota type information. + public QuotaTemplateDetails(string resourceType = default(string), string resourceType1 = default(string), IList value = default(IList)) + { + ResourceType = resourceType; + ResourceType1 = resourceType1; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource type. + /// + [JsonProperty(PropertyName = "resourceType")] + public string ResourceType { get; set; } + + /// + /// Gets or sets resource type + /// + [JsonProperty(PropertyName = "properties.resourceType")] + public string ResourceType1 { get; set; } + + /// + /// Gets or sets quota type information. + /// + [JsonProperty(PropertyName = "properties.value")] + public IList Value { get; set; } + + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaTemplatesDetails.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaTemplatesDetails.cs new file mode 100644 index 000000000000..cb3c6debe137 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaTemplatesDetails.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.Quota.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Quota templates details. + /// + public partial class QuotaTemplatesDetails + { + /// + /// Initializes a new instance of the QuotaTemplatesDetails class. + /// + public QuotaTemplatesDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the QuotaTemplatesDetails class. + /// + /// Quota templates information. + public QuotaTemplatesDetails(IList value = default(IList)) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets quota templates information. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaTypeDimensionInformation.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaTypeDimensionInformation.cs new file mode 100644 index 000000000000..3c17c54807ed --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaTypeDimensionInformation.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.Quota.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Quota type information. + /// + public partial class QuotaTypeDimensionInformation + { + /// + /// Initializes a new instance of the QuotaTypeDimensionInformation + /// class. + /// + public QuotaTypeDimensionInformation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the QuotaTypeDimensionInformation + /// class. + /// + /// Property name. + /// Display name. + /// Dimension ID. + public QuotaTypeDimensionInformation(string name = default(string), string displayName = default(string), string id = default(string)) + { + Name = name; + DisplayName = displayName; + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets property name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets display name. + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets dimension ID. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ResourceName.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ResourceName.cs new file mode 100644 index 000000000000..b02e2950cdc9 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ResourceName.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.Quota.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Name of the resource provided by the resource Provider. When requesting + /// quota, use this property name. + /// + public partial class ResourceName + { + /// + /// Initializes a new instance of the ResourceName class. + /// + public ResourceName() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceName class. + /// + /// Resource name. + /// Resource display name. + public ResourceName(string value = default(string), string localizedValue = default(string)) + { + Value = value; + LocalizedValue = localizedValue; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource name. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + /// + /// Gets resource display name. + /// + [JsonProperty(PropertyName = "localizedValue")] + public string LocalizedValue { get; private set; } + + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ResourceProviderDimension.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ResourceProviderDimension.cs new file mode 100644 index 000000000000..178b25af99bd --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ResourceProviderDimension.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Quota.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Resource provider resource dimension. + /// + public partial class ResourceProviderDimension + { + /// + /// Initializes a new instance of the ResourceProviderDimension class. + /// + public ResourceProviderDimension() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceProviderDimension class. + /// + /// Resource dimension name. + /// Display name. + public ResourceProviderDimension(string name = default(string), string displayName = default(string)) + { + Name = name; + DisplayName = displayName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource dimension name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets display name. + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ResourceProviderInformation.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ResourceProviderInformation.cs new file mode 100644 index 000000000000..7f9b304e4a7a --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ResourceProviderInformation.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Quota.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Resource provider information. + /// + [Rest.Serialization.JsonTransformation] + public partial class ResourceProviderInformation + { + /// + /// Initializes a new instance of the ResourceProviderInformation + /// class. + /// + public ResourceProviderInformation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceProviderInformation + /// class. + /// + /// Resource provider name. + /// The resource provider templates + public ResourceProviderInformation(string resourceProviderName = default(string), IList value = default(IList)) + { + ResourceProviderName = resourceProviderName; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource provider name. + /// + [JsonProperty(PropertyName = "resourceProviderName")] + public string ResourceProviderName { get; set; } + + /// + /// Gets or sets the resource provider templates + /// + [JsonProperty(PropertyName = "properties.value")] + public IList Value { get; set; } + + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ResourceProviderTemplate.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ResourceProviderTemplate.cs new file mode 100644 index 000000000000..0dbc2268e7cf --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ResourceProviderTemplate.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.Quota.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Resource template details for the resource provider. + /// + public partial class ResourceProviderTemplate + { + /// + /// Initializes a new instance of the ResourceProviderTemplate class. + /// + public ResourceProviderTemplate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceProviderTemplate class. + /// + /// Resource type. + /// Resource query for dimension + /// values. + /// Resource usages query. + /// Resource provider dimensions. + public ResourceProviderTemplate(string resourceType = default(string), ResourceQueryDetails resourceQuery = default(ResourceQueryDetails), ResourceQueryDetails resourceUsagesQuery = default(ResourceQueryDetails), IList dimensions = default(IList)) + { + ResourceType = resourceType; + ResourceQuery = resourceQuery; + ResourceUsagesQuery = resourceUsagesQuery; + Dimensions = dimensions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource type. + /// + [JsonProperty(PropertyName = "resourceType")] + public string ResourceType { get; set; } + + /// + /// Gets or sets resource query for dimension values. + /// + [JsonProperty(PropertyName = "resourceQuery")] + public ResourceQueryDetails ResourceQuery { get; set; } + + /// + /// Gets or sets resource usages query. + /// + [JsonProperty(PropertyName = "resourceUsagesQuery")] + public ResourceQueryDetails ResourceUsagesQuery { get; set; } + + /// + /// Gets or sets resource provider dimensions. + /// + [JsonProperty(PropertyName = "dimensions")] + public IList Dimensions { get; set; } + + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ResourceProvidersList.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ResourceProvidersList.cs new file mode 100644 index 000000000000..319c7f1c7de2 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ResourceProvidersList.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.Quota.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Resource providers list. + /// + public partial class ResourceProvidersList + { + /// + /// Initializes a new instance of the ResourceProvidersList class. + /// + public ResourceProvidersList() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceProvidersList class. + /// + /// Resource provider information. + public ResourceProvidersList(IList value = default(IList)) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource provider information. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ResourceQueryDetails.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ResourceQueryDetails.cs new file mode 100644 index 000000000000..63a31f1b79e6 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ResourceQueryDetails.cs @@ -0,0 +1,81 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Quota.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Resource query details. + /// + public partial class ResourceQueryDetails + { + /// + /// Initializes a new instance of the ResourceQueryDetails class. + /// + public ResourceQueryDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceQueryDetails class. + /// + /// Resource query type. Possible + /// values include: 'ARG', 'RestAPI' + /// Resource query method. Possible + /// values include: 'GET', 'POST' + /// Base URI for for resource + /// query. + /// Template to create the + /// resource query. + public ResourceQueryDetails(string resourceQueryType = default(string), string resourceQueryMethod = default(string), string resourceQueryUri = default(string), string resourceQueryPostTemplate = default(string)) + { + ResourceQueryType = resourceQueryType; + ResourceQueryMethod = resourceQueryMethod; + ResourceQueryUri = resourceQueryUri; + ResourceQueryPostTemplate = resourceQueryPostTemplate; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource query type. Possible values include: 'ARG', + /// 'RestAPI' + /// + [JsonProperty(PropertyName = "resourceQueryType")] + public string ResourceQueryType { get; set; } + + /// + /// Gets or sets resource query method. Possible values include: 'GET', + /// 'POST' + /// + [JsonProperty(PropertyName = "resourceQueryMethod")] + public string ResourceQueryMethod { get; set; } + + /// + /// Gets or sets base URI for for resource query. + /// + [JsonProperty(PropertyName = "resourceQueryUri")] + public string ResourceQueryUri { get; set; } + + /// + /// Gets or sets template to create the resource query. + /// + [JsonProperty(PropertyName = "resourceQueryPostTemplate")] + public string ResourceQueryPostTemplate { get; set; } + + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ResourceQueryMethod.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ResourceQueryMethod.cs new file mode 100644 index 000000000000..4a768e8170a1 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ResourceQueryMethod.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.Quota.Models +{ + + /// + /// Defines values for ResourceQueryMethod. + /// + public static class ResourceQueryMethod + { + public const string GET = "GET"; + public const string POST = "POST"; + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ResourceQueryType.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ResourceQueryType.cs new file mode 100644 index 000000000000..1b2521520aa3 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ResourceQueryType.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.Quota.Models +{ + + /// + /// Defines values for ResourceQueryType. + /// + public static class ResourceQueryType + { + public const string ARG = "ARG"; + public const string RestAPI = "RestAPI"; + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ResourceType.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ResourceType.cs new file mode 100644 index 000000000000..592e2384b45b --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ResourceType.cs @@ -0,0 +1,25 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Quota.Models +{ + + /// + /// Defines values for ResourceType. + /// + public static class ResourceType + { + public const string Standard = "standard"; + public const string Dedicated = "dedicated"; + public const string LowPriority = "lowPriority"; + public const string Shared = "shared"; + public const string ServiceSpecific = "serviceSpecific"; + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ServiceError.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ServiceError.cs new file mode 100644 index 000000000000..33f4c6a2a8c5 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ServiceError.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.Quota.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// API error details. + /// + public partial class ServiceError + { + /// + /// Initializes a new instance of the ServiceError class. + /// + public ServiceError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServiceError class. + /// + /// Error code. + /// Error message. + /// List of error details. + public ServiceError(string code = default(string), string message = default(string), IList details = default(IList)) + { + Code = code; + Message = message; + Details = details; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// Gets list of error details. + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; private set; } + + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ServiceErrorDetail.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ServiceErrorDetail.cs new file mode 100644 index 000000000000..b1ca8ace555a --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ServiceErrorDetail.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Quota.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Error details. + /// + public partial class ServiceErrorDetail + { + /// + /// Initializes a new instance of the ServiceErrorDetail class. + /// + public ServiceErrorDetail() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServiceErrorDetail class. + /// + /// Error code. + /// Error message. + public ServiceErrorDetail(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. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/SubRequest.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/SubRequest.cs new file mode 100644 index 000000000000..d5c0d907be24 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/SubRequest.cs @@ -0,0 +1,107 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Quota.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Request property. + /// + public partial class SubRequest + { + /// + /// Initializes a new instance of the SubRequest class. + /// + public SubRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SubRequest class. + /// + /// Resource quota limit. + /// Resource name. + /// Resource type for which the quota check + /// was made. + /// Quota limit units, such as Count and Bytes. + /// When requesting quota, use the **unit** value returned in the GET + /// response in the request body of your PUT operation. + /// The quota request status. Possible + /// values include: 'Accepted', 'Invalid', 'Succeeded', 'Failed', + /// 'InProgress' + /// User-friendly status message. + /// Quota request ID. + public SubRequest(int? limit = default(int?), ResourceName name = default(ResourceName), string resourceType = default(string), string unit = default(string), string provisioningState = default(string), string message = default(string), string subRequestId = default(string)) + { + Limit = limit; + Name = name; + ResourceType = resourceType; + Unit = unit; + ProvisioningState = provisioningState; + Message = message; + SubRequestId = subRequestId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource quota limit. + /// + [JsonProperty(PropertyName = "limit")] + public int? Limit { get; private set; } + + /// + /// Gets or sets resource name. + /// + [JsonProperty(PropertyName = "name")] + public ResourceName Name { get; set; } + + /// + /// Gets resource type for which the quota check was made. + /// + [JsonProperty(PropertyName = "resourceType")] + public string ResourceType { get; private set; } + + /// + /// Gets or sets Quota limit units, such as Count and Bytes. When + /// requesting quota, use the **unit** value returned in the GET + /// response in the request body of your PUT operation. + /// + [JsonProperty(PropertyName = "unit")] + public string Unit { get; set; } + + /// + /// Gets or sets the quota request status. Possible values include: + /// 'Accepted', 'Invalid', 'Succeeded', 'Failed', 'InProgress' + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// Gets user-friendly status message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + /// + /// Gets quota request ID. + /// + [JsonProperty(PropertyName = "subRequestId")] + public string SubRequestId { get; private set; } + + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/OperationOperations.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/OperationOperations.cs new file mode 100644 index 000000000000..937dc9556104 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/OperationOperations.cs @@ -0,0 +1,403 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Quota +{ + 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; + + /// + /// OperationOperations operations. + /// + internal partial class OperationOperations : IServiceOperations, IOperationOperations + { + /// + /// Initializes a new instance of the OperationOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal OperationOperations(AzureQuotaExtensionAPIClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureQuotaExtensionAPIClient + /// + public AzureQuotaExtensionAPIClient Client { get; private set; } + + /// + /// GET operations. + /// + /// + /// List all GET 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"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // 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.Quota/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 ExceptionResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ExceptionResponse _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; + } + + /// + /// GET operations. + /// + /// + /// List all GET 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 ExceptionResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ExceptionResponse _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/quota/Microsoft.Azure.Management.Quota/src/Generated/OperationOperationsExtensions.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/OperationOperationsExtensions.cs new file mode 100644 index 000000000000..073f36fd62ff --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/OperationOperationsExtensions.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.Quota +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for OperationOperations. + /// + public static partial class OperationOperationsExtensions + { + /// + /// GET operations. + /// + /// + /// List all GET operations. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IOperationOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// GET operations. + /// + /// + /// List all GET operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IOperationOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// GET operations. + /// + /// + /// List all GET operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IOperationOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// GET operations. + /// + /// + /// List all GET 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 IOperationOperations 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/quota/Microsoft.Azure.Management.Quota/src/Generated/QuotaOperations.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/QuotaOperations.cs new file mode 100644 index 000000000000..288f20e002ea --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/QuotaOperations.cs @@ -0,0 +1,1202 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Quota +{ + 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; + + /// + /// QuotaOperations operations. + /// + internal partial class QuotaOperations : IServiceOperations, IQuotaOperations + { + /// + /// Initializes a new instance of the QuotaOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal QuotaOperations(AzureQuotaExtensionAPIClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureQuotaExtensionAPIClient + /// + public AzureQuotaExtensionAPIClient Client { get; private set; } + + /// + /// Gets the quota limit and current quota usage of a resource. The response + /// can be used to determine the remaining quota and calculate a new quota + /// limit that can be submitted with a PUT request. + /// + /// + /// Resource name for a given resource provider. For example: + /// - SKU name for Microsoft.Compute + /// - Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + /// This is the target Azure resource URI for the List GET operation. If a + /// `{resourceName}` is added after `/quotaLimits`, then it's the target Azure + /// resource URI in the GET operation for the specific resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceName, string scope, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + 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("resourceName", resourceName); + tracingParameters.Add("scope", scope); + 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.Quota/quotaLimits/{resourceName}").ToString(); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _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 ExceptionResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ExceptionResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update the quota limit for the specified resource to the + /// requested value. To update the quota, follow these steps: + /// 1. Use the GET operation to determine how much quota remains for the + /// specific resource and to calculate the new quota limit. These steps are + /// detailed in [this + /// example](https://techcommunity.microsoft.com/t5/azure-governance-and-management/using-the-new-quota-rest-api/ba-p/2183670). + /// 2. Use this PUT operation to update the quota limit. + /// + /// + /// Resource name for a given resource provider. For example: + /// - SKU name for Microsoft.Compute + /// - Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + /// This is the target Azure resource URI for the List GET operation. If a + /// `{resourceName}` is added after `/quotaLimits`, then it's the target Azure + /// resource URI in the GET operation for the specific resource. + /// + /// + /// Quota properties for the specified resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceName, string scope, QuotaProperties properties = default(QuotaProperties), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceName, scope, properties, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update the quota limit for a specific resource to the specified value: + /// 1. Use the GET operation to determine how much quota remains for the + /// specific resource and to calculate the new quota limit. These steps are + /// detailed in [this + /// example](https://techcommunity.microsoft.com/t5/azure-governance-and-management/using-the-new-quota-rest-api/ba-p/2183670). + /// 2. Use this PUT operation to update the quota limit. + /// + /// + /// Resource name for a given resource provider. For example: + /// - SKU name for Microsoft.Compute + /// - Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + /// This is the target Azure resource URI for the List GET operation. If a + /// `{resourceName}` is added after `/quotaLimits`, then it's the target Azure + /// resource URI in the GET operation for the specific resource. + /// + /// + /// Quota properties for the specified resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceName, string scope, QuotaProperties properties = default(QuotaProperties), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceName, scope, properties, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a list of current quota limits and usages of all resources. The + /// response from this GET operation can be leveraged to submit requests to + /// update a quota. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + /// This is the target Azure resource URI for the List GET operation. If a + /// `{resourceName}` is added after `/quotaLimits`, then it's the target Azure + /// resource URI in the GET operation for the specific resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task,QuotaListHeaders>> ListWithHttpMessagesAsync(string scope, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + 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.Quota/quotaLimits").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 ExceptionResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ExceptionResponse _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,QuotaListHeaders>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update the quota limit for the specified resource to the + /// requested value. To update the quota, follow these steps: + /// 1. Use the GET operation to determine how much quota remains for the + /// specific resource and to calculate the new quota limit. These steps are + /// detailed in [this + /// example](https://techcommunity.microsoft.com/t5/azure-governance-and-management/using-the-new-quota-rest-api/ba-p/2183670). + /// 2. Use this PUT operation to update the quota limit. + /// + /// + /// Resource name for a given resource provider. For example: + /// - SKU name for Microsoft.Compute + /// - Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + /// This is the target Azure resource URI for the List GET operation. If a + /// `{resourceName}` is added after `/quotaLimits`, then it's the target Azure + /// resource URI in the GET operation for the specific resource. + /// + /// + /// Quota properties for the specified resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceName, string scope, QuotaProperties properties = default(QuotaProperties), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + CurrentQuotaLimitBase createQuotaRequest = new CurrentQuotaLimitBase(); + if (properties != null) + { + createQuotaRequest.Properties = properties; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("scope", scope); + tracingParameters.Add("createQuotaRequest", createQuotaRequest); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Quota/quotaLimits/{resourceName}").ToString(); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _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("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(createQuotaRequest != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(createQuotaRequest, 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 != 202) + { + var ex = new ExceptionResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ExceptionResponse _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 == 202) + { + _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; + } + + /// + /// Update the quota limit for a specific resource to the specified value: + /// 1. Use the GET operation to determine how much quota remains for the + /// specific resource and to calculate the new quota limit. These steps are + /// detailed in [this + /// example](https://techcommunity.microsoft.com/t5/azure-governance-and-management/using-the-new-quota-rest-api/ba-p/2183670). + /// 2. Use this PUT operation to update the quota limit. + /// + /// + /// Resource name for a given resource provider. For example: + /// - SKU name for Microsoft.Compute + /// - Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + /// This is the target Azure resource URI for the List GET operation. If a + /// `{resourceName}` is added after `/quotaLimits`, then it's the target Azure + /// resource URI in the GET operation for the specific resource. + /// + /// + /// Quota properties for the specified resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceName, string scope, QuotaProperties properties = default(QuotaProperties), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + CurrentQuotaLimitBase createQuotaRequest = new CurrentQuotaLimitBase(); + if (properties != null) + { + createQuotaRequest.Properties = properties; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("scope", scope); + tracingParameters.Add("createQuotaRequest", createQuotaRequest); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Quota/quotaLimits/{resourceName}").ToString(); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _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("PATCH"); + _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(createQuotaRequest != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(createQuotaRequest, 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 != 202) + { + var ex = new ExceptionResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ExceptionResponse _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 == 202) + { + _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; + } + + /// + /// Get a list of current quota limits and usages of all resources. The + /// response from this GET operation can be leveraged to submit requests to + /// update a quota. + /// + /// + /// 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,QuotaListHeaders>> 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 ExceptionResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ExceptionResponse _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,QuotaListHeaders>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/QuotaOperationsExtensions.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/QuotaOperationsExtensions.cs new file mode 100644 index 000000000000..a7f764c395eb --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/QuotaOperationsExtensions.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.Quota +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for QuotaOperations. + /// + public static partial class QuotaOperationsExtensions + { + /// + /// Gets the quota limit and current quota usage of a resource. The response + /// can be used to determine the remaining quota and calculate a new quota + /// limit that can be submitted with a PUT request. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource name for a given resource provider. For example: + /// - SKU name for Microsoft.Compute + /// - Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + /// This is the target Azure resource URI for the List GET operation. If a + /// `{resourceName}` is added after `/quotaLimits`, then it's the target Azure + /// resource URI in the GET operation for the specific resource. + /// + public static CurrentQuotaLimitBase Get(this IQuotaOperations operations, string resourceName, string scope) + { + return operations.GetAsync(resourceName, scope).GetAwaiter().GetResult(); + } + + /// + /// Gets the quota limit and current quota usage of a resource. The response + /// can be used to determine the remaining quota and calculate a new quota + /// limit that can be submitted with a PUT request. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource name for a given resource provider. For example: + /// - SKU name for Microsoft.Compute + /// - Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + /// This is the target Azure resource URI for the List GET operation. If a + /// `{resourceName}` is added after `/quotaLimits`, then it's the target Azure + /// resource URI in the GET operation for the specific resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IQuotaOperations operations, string resourceName, string scope, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceName, scope, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update the quota limit for the specified resource to the + /// requested value. To update the quota, follow these steps: + /// 1. Use the GET operation to determine how much quota remains for the + /// specific resource and to calculate the new quota limit. These steps are + /// detailed in [this + /// example](https://techcommunity.microsoft.com/t5/azure-governance-and-management/using-the-new-quota-rest-api/ba-p/2183670). + /// 2. Use this PUT operation to update the quota limit. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource name for a given resource provider. For example: + /// - SKU name for Microsoft.Compute + /// - Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + /// This is the target Azure resource URI for the List GET operation. If a + /// `{resourceName}` is added after `/quotaLimits`, then it's the target Azure + /// resource URI in the GET operation for the specific resource. + /// + /// + /// Quota properties for the specified resource. + /// + public static CurrentQuotaLimitBase CreateOrUpdate(this IQuotaOperations operations, string resourceName, string scope, QuotaProperties properties = default(QuotaProperties)) + { + return operations.CreateOrUpdateAsync(resourceName, scope, properties).GetAwaiter().GetResult(); + } + + /// + /// Create or update the quota limit for the specified resource to the + /// requested value. To update the quota, follow these steps: + /// 1. Use the GET operation to determine how much quota remains for the + /// specific resource and to calculate the new quota limit. These steps are + /// detailed in [this + /// example](https://techcommunity.microsoft.com/t5/azure-governance-and-management/using-the-new-quota-rest-api/ba-p/2183670). + /// 2. Use this PUT operation to update the quota limit. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource name for a given resource provider. For example: + /// - SKU name for Microsoft.Compute + /// - Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + /// This is the target Azure resource URI for the List GET operation. If a + /// `{resourceName}` is added after `/quotaLimits`, then it's the target Azure + /// resource URI in the GET operation for the specific resource. + /// + /// + /// Quota properties for the specified resource. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IQuotaOperations operations, string resourceName, string scope, QuotaProperties properties = default(QuotaProperties), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceName, scope, properties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update the quota limit for a specific resource to the specified value: + /// 1. Use the GET operation to determine how much quota remains for the + /// specific resource and to calculate the new quota limit. These steps are + /// detailed in [this + /// example](https://techcommunity.microsoft.com/t5/azure-governance-and-management/using-the-new-quota-rest-api/ba-p/2183670). + /// 2. Use this PUT operation to update the quota limit. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource name for a given resource provider. For example: + /// - SKU name for Microsoft.Compute + /// - Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + /// This is the target Azure resource URI for the List GET operation. If a + /// `{resourceName}` is added after `/quotaLimits`, then it's the target Azure + /// resource URI in the GET operation for the specific resource. + /// + /// + /// Quota properties for the specified resource. + /// + public static CurrentQuotaLimitBase Update(this IQuotaOperations operations, string resourceName, string scope, QuotaProperties properties = default(QuotaProperties)) + { + return operations.UpdateAsync(resourceName, scope, properties).GetAwaiter().GetResult(); + } + + /// + /// Update the quota limit for a specific resource to the specified value: + /// 1. Use the GET operation to determine how much quota remains for the + /// specific resource and to calculate the new quota limit. These steps are + /// detailed in [this + /// example](https://techcommunity.microsoft.com/t5/azure-governance-and-management/using-the-new-quota-rest-api/ba-p/2183670). + /// 2. Use this PUT operation to update the quota limit. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource name for a given resource provider. For example: + /// - SKU name for Microsoft.Compute + /// - Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + /// This is the target Azure resource URI for the List GET operation. If a + /// `{resourceName}` is added after `/quotaLimits`, then it's the target Azure + /// resource URI in the GET operation for the specific resource. + /// + /// + /// Quota properties for the specified resource. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IQuotaOperations operations, string resourceName, string scope, QuotaProperties properties = default(QuotaProperties), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceName, scope, properties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a list of current quota limits and usages of all resources. The + /// response from this GET operation can be leveraged to submit requests to + /// update a quota. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + /// This is the target Azure resource URI for the List GET operation. If a + /// `{resourceName}` is added after `/quotaLimits`, then it's the target Azure + /// resource URI in the GET operation for the specific resource. + /// + public static IPage List(this IQuotaOperations operations, string scope) + { + return operations.ListAsync(scope).GetAwaiter().GetResult(); + } + + /// + /// Get a list of current quota limits and usages of all resources. The + /// response from this GET operation can be leveraged to submit requests to + /// update a quota. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + /// This is the target Azure resource URI for the List GET operation. If a + /// `{resourceName}` is added after `/quotaLimits`, then it's the target Azure + /// resource URI in the GET operation for the specific resource. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IQuotaOperations operations, string scope, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(scope, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update the quota limit for the specified resource to the + /// requested value. To update the quota, follow these steps: + /// 1. Use the GET operation to determine how much quota remains for the + /// specific resource and to calculate the new quota limit. These steps are + /// detailed in [this + /// example](https://techcommunity.microsoft.com/t5/azure-governance-and-management/using-the-new-quota-rest-api/ba-p/2183670). + /// 2. Use this PUT operation to update the quota limit. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource name for a given resource provider. For example: + /// - SKU name for Microsoft.Compute + /// - Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + /// This is the target Azure resource URI for the List GET operation. If a + /// `{resourceName}` is added after `/quotaLimits`, then it's the target Azure + /// resource URI in the GET operation for the specific resource. + /// + /// + /// Quota properties for the specified resource. + /// + public static CurrentQuotaLimitBase BeginCreateOrUpdate(this IQuotaOperations operations, string resourceName, string scope, QuotaProperties properties = default(QuotaProperties)) + { + return operations.BeginCreateOrUpdateAsync(resourceName, scope, properties).GetAwaiter().GetResult(); + } + + /// + /// Create or update the quota limit for the specified resource to the + /// requested value. To update the quota, follow these steps: + /// 1. Use the GET operation to determine how much quota remains for the + /// specific resource and to calculate the new quota limit. These steps are + /// detailed in [this + /// example](https://techcommunity.microsoft.com/t5/azure-governance-and-management/using-the-new-quota-rest-api/ba-p/2183670). + /// 2. Use this PUT operation to update the quota limit. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource name for a given resource provider. For example: + /// - SKU name for Microsoft.Compute + /// - Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + /// This is the target Azure resource URI for the List GET operation. If a + /// `{resourceName}` is added after `/quotaLimits`, then it's the target Azure + /// resource URI in the GET operation for the specific resource. + /// + /// + /// Quota properties for the specified resource. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IQuotaOperations operations, string resourceName, string scope, QuotaProperties properties = default(QuotaProperties), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceName, scope, properties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update the quota limit for a specific resource to the specified value: + /// 1. Use the GET operation to determine how much quota remains for the + /// specific resource and to calculate the new quota limit. These steps are + /// detailed in [this + /// example](https://techcommunity.microsoft.com/t5/azure-governance-and-management/using-the-new-quota-rest-api/ba-p/2183670). + /// 2. Use this PUT operation to update the quota limit. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource name for a given resource provider. For example: + /// - SKU name for Microsoft.Compute + /// - Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + /// This is the target Azure resource URI for the List GET operation. If a + /// `{resourceName}` is added after `/quotaLimits`, then it's the target Azure + /// resource URI in the GET operation for the specific resource. + /// + /// + /// Quota properties for the specified resource. + /// + public static CurrentQuotaLimitBase BeginUpdate(this IQuotaOperations operations, string resourceName, string scope, QuotaProperties properties = default(QuotaProperties)) + { + return operations.BeginUpdateAsync(resourceName, scope, properties).GetAwaiter().GetResult(); + } + + /// + /// Update the quota limit for a specific resource to the specified value: + /// 1. Use the GET operation to determine how much quota remains for the + /// specific resource and to calculate the new quota limit. These steps are + /// detailed in [this + /// example](https://techcommunity.microsoft.com/t5/azure-governance-and-management/using-the-new-quota-rest-api/ba-p/2183670). + /// 2. Use this PUT operation to update the quota limit. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource name for a given resource provider. For example: + /// - SKU name for Microsoft.Compute + /// - Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + /// This is the target Azure resource URI for the List GET operation. If a + /// `{resourceName}` is added after `/quotaLimits`, then it's the target Azure + /// resource URI in the GET operation for the specific resource. + /// + /// + /// Quota properties for the specified resource. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IQuotaOperations operations, string resourceName, string scope, QuotaProperties properties = default(QuotaProperties), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceName, scope, properties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a list of current quota limits and usages of all resources. The + /// response from this GET operation can be leveraged to submit requests to + /// update a quota. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IQuotaOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get a list of current quota limits and usages of all resources. The + /// response from this GET operation can be leveraged to submit requests to + /// update a quota. + /// + /// + /// 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 IQuotaOperations 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/quota/Microsoft.Azure.Management.Quota/src/Generated/QuotaRequestStatusOperations.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/QuotaRequestStatusOperations.cs new file mode 100644 index 000000000000..60e02765273c --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/QuotaRequestStatusOperations.cs @@ -0,0 +1,649 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Quota +{ + 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; + + /// + /// QuotaRequestStatusOperations operations. + /// + internal partial class QuotaRequestStatusOperations : IServiceOperations, IQuotaRequestStatusOperations + { + /// + /// Initializes a new instance of the QuotaRequestStatusOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal QuotaRequestStatusOperations(AzureQuotaExtensionAPIClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureQuotaExtensionAPIClient + /// + public AzureQuotaExtensionAPIClient Client { get; private set; } + + /// + /// Gets the quota request details and status by quota request ID for the + /// resources of the resource provider at a specific location. The quota + /// request ID **id** is returned in the response of the PUT operation. + /// + /// + /// Quota request ID. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + /// This is the target Azure resource URI for the List GET operation. If a + /// `{resourceName}` is added after `/quotaLimits`, then it's the target Azure + /// resource URI in the GET operation for the specific resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string id, string scope, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "id"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + 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("id", id); + tracingParameters.Add("scope", scope); + 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.Quota/quotaLimitsRequests/{id}").ToString(); + _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); + _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 ExceptionResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ExceptionResponse _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; + } + + /// + /// For the specified location and resource provider, gets the current quota + /// requests under the subscription for a one year period ending at the time is + /// made. Use the **oData** filter can be used to select quota requests. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + /// This is the target Azure resource URI for the List GET operation. If a + /// `{resourceName}` is added after `/quotaLimits`, then it's the target Azure + /// resource URI in the GET operation for the specific resource. + /// + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// |requestSubmitTime | ge, le, eq, gt, lt + /// |provisioningState eq {QuotaRequestState} + /// |resourceName eq {resourceName} + /// + /// + /// Number of records to return. + /// + /// + /// The **Skiptoken** parameter is used only if a previous operation returned a + /// partial result. If a previous response contains a **nextLink** element, the + /// value of the **nextLink** element includes 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, string filter = default(string), int? top = default(int?), string skiptoken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (top < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "top", 1); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("scope", scope); + tracingParameters.Add("filter", filter); + tracingParameters.Add("top", top); + 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.Quota/quotaLimitsRequests").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 (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (top != null) + { + _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); + } + 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 ExceptionResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ExceptionResponse _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; + } + + /// + /// For the specified location and resource provider, gets the current quota + /// requests under the subscription for a one year period ending at the time is + /// made. Use the **oData** filter can be used to select quota requests. + /// + /// + /// 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 ExceptionResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ExceptionResponse _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/quota/Microsoft.Azure.Management.Quota/src/Generated/QuotaRequestStatusOperationsExtensions.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/QuotaRequestStatusOperationsExtensions.cs new file mode 100644 index 000000000000..40bb9814c954 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/QuotaRequestStatusOperationsExtensions.cs @@ -0,0 +1,195 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Quota +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for QuotaRequestStatusOperations. + /// + public static partial class QuotaRequestStatusOperationsExtensions + { + /// + /// Gets the quota request details and status by quota request ID for the + /// resources of the resource provider at a specific location. The quota + /// request ID **id** is returned in the response of the PUT operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Quota request ID. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + /// This is the target Azure resource URI for the List GET operation. If a + /// `{resourceName}` is added after `/quotaLimits`, then it's the target Azure + /// resource URI in the GET operation for the specific resource. + /// + public static QuotaRequestDetails Get(this IQuotaRequestStatusOperations operations, string id, string scope) + { + return operations.GetAsync(id, scope).GetAwaiter().GetResult(); + } + + /// + /// Gets the quota request details and status by quota request ID for the + /// resources of the resource provider at a specific location. The quota + /// request ID **id** is returned in the response of the PUT operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Quota request ID. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + /// This is the target Azure resource URI for the List GET operation. If a + /// `{resourceName}` is added after `/quotaLimits`, then it's the target Azure + /// resource URI in the GET operation for the specific resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IQuotaRequestStatusOperations operations, string id, string scope, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(id, scope, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// For the specified location and resource provider, gets the current quota + /// requests under the subscription for a one year period ending at the time is + /// made. Use the **oData** filter can be used to select quota requests. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + /// This is the target Azure resource URI for the List GET operation. If a + /// `{resourceName}` is added after `/quotaLimits`, then it's the target Azure + /// resource URI in the GET operation for the specific resource. + /// + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// |requestSubmitTime | ge, le, eq, gt, lt + /// |provisioningState eq {QuotaRequestState} + /// |resourceName eq {resourceName} + /// + /// + /// Number of records to return. + /// + /// + /// The **Skiptoken** parameter is used only if a previous operation returned a + /// partial result. If a previous response contains a **nextLink** element, the + /// value of the **nextLink** element includes a **skiptoken** parameter that + /// specifies a starting point to use for subsequent calls. + /// + public static IPage List(this IQuotaRequestStatusOperations operations, string scope, string filter = default(string), int? top = default(int?), string skiptoken = default(string)) + { + return operations.ListAsync(scope, filter, top, skiptoken).GetAwaiter().GetResult(); + } + + /// + /// For the specified location and resource provider, gets the current quota + /// requests under the subscription for a one year period ending at the time is + /// made. Use the **oData** filter can be used to select quota requests. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/9f6cce51-6baf-4de5-a3c4-6f58b85315b9/resourceGroups/qms-test/providers/Microsoft.Batch/batchAccounts/testAccount/`. + /// This is the target Azure resource URI for the List GET operation. If a + /// `{resourceName}` is added after `/quotaLimits`, then it's the target Azure + /// resource URI in the GET operation for the specific resource. + /// + /// + /// | Field | Supported operators + /// |---------------------|------------------------ + /// + /// |requestSubmitTime | ge, le, eq, gt, lt + /// |provisioningState eq {QuotaRequestState} + /// |resourceName eq {resourceName} + /// + /// + /// Number of records to return. + /// + /// + /// The **Skiptoken** parameter is used only if a previous operation returned a + /// partial result. If a previous response contains a **nextLink** element, the + /// value of the **nextLink** element includes a **skiptoken** parameter that + /// specifies a starting point to use for subsequent calls. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IQuotaRequestStatusOperations operations, string scope, string filter = default(string), int? top = default(int?), string skiptoken = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(scope, filter, top, skiptoken, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// For the specified location and resource provider, gets the current quota + /// requests under the subscription for a one year period ending at the time is + /// made. Use the **oData** filter can be used to select quota requests. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IQuotaRequestStatusOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// For the specified location and resource provider, gets the current quota + /// requests under the subscription for a one year period ending at the time is + /// made. Use the **oData** filter can be used to select quota requests. + /// + /// + /// 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 IQuotaRequestStatusOperations 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/quota/Microsoft.Azure.Management.Quota/src/Generated/QuotaResourceProvidersOperations.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/QuotaResourceProvidersOperations.cs new file mode 100644 index 000000000000..e5caf0c9e610 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/QuotaResourceProvidersOperations.cs @@ -0,0 +1,239 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Quota +{ + 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; + + /// + /// QuotaResourceProvidersOperations operations. + /// + internal partial class QuotaResourceProvidersOperations : IServiceOperations, IQuotaResourceProvidersOperations + { + /// + /// Initializes a new instance of the QuotaResourceProvidersOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal QuotaResourceProvidersOperations(AzureQuotaExtensionAPIClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureQuotaExtensionAPIClient + /// + public AzureQuotaExtensionAPIClient Client { get; private set; } + + /// + /// Gets the list of current resource providers supported by the + /// Microsoft.Quota resource provider. + /// For each resource provider, the resource templates the resource provider + /// supports are be provided. + /// For each resource template, the resource dimensions are listed. The + /// resource dimensions are the name-value pairs in the resource URI. + /// Example: Microsoft.Compute Resource Provider + /// The URI template is + /// '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{locationId}/quotaBucket'. + /// The actual dimensions vary depending on the resource provider. + /// The resource dimensions are {subscriptions},{locations},{quotaBucket}. + /// + /// + /// Headers that 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"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // 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.Quota/quotaLimitProviders").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 ExceptionResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ExceptionResponse _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/quota/Microsoft.Azure.Management.Quota/src/Generated/QuotaResourceProvidersOperationsExtensions.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/QuotaResourceProvidersOperationsExtensions.cs new file mode 100644 index 000000000000..75170268b2ec --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/QuotaResourceProvidersOperationsExtensions.cs @@ -0,0 +1,73 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Quota +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for QuotaResourceProvidersOperations. + /// + public static partial class QuotaResourceProvidersOperationsExtensions + { + /// + /// Gets the list of current resource providers supported by the + /// Microsoft.Quota resource provider. + /// For each resource provider, the resource templates the resource provider + /// supports are be provided. + /// For each resource template, the resource dimensions are listed. The + /// resource dimensions are the name-value pairs in the resource URI. + /// Example: Microsoft.Compute Resource Provider + /// The URI template is + /// '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{locationId}/quotaBucket'. + /// The actual dimensions vary depending on the resource provider. + /// The resource dimensions are {subscriptions},{locations},{quotaBucket}. + /// + /// + /// The operations group for this extension method. + /// + public static ResourceProvidersList List(this IQuotaResourceProvidersOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Gets the list of current resource providers supported by the + /// Microsoft.Quota resource provider. + /// For each resource provider, the resource templates the resource provider + /// supports are be provided. + /// For each resource template, the resource dimensions are listed. The + /// resource dimensions are the name-value pairs in the resource URI. + /// Example: Microsoft.Compute Resource Provider + /// The URI template is + /// '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{locationId}/quotaBucket'. + /// The actual dimensions vary depending on the resource provider. + /// The resource dimensions are {subscriptions},{locations},{quotaBucket}. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task ListAsync(this IQuotaResourceProvidersOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/SdkInfo_AzureQuotaExtensionAPI.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/SdkInfo_AzureQuotaExtensionAPI.cs new file mode 100644 index 000000000000..e67d2b47b475 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/SdkInfo_AzureQuotaExtensionAPI.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.Quota +{ + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_AzureQuotaExtensionAPI + { + get + { + return new Tuple[] + { + new Tuple("Quota", "Operation", "2021-03-15-preview"), + new Tuple("Quota", "Quota", "2021-03-15-preview"), + new Tuple("Quota", "QuotaRequestStatus", "2021-03-15-preview"), + new Tuple("Quota", "QuotaResourceProviders", "2021-03-15-preview"), + }.AsEnumerable(); + } + } + } +}