From c87575a4a3cf0343e26cde5eed6a1f612ff51350 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 31 Aug 2021 02:38:04 +0000 Subject: [PATCH] CodeGen from PR 15416 in Azure/azure-rest-api-specs [QuotaRP] Split QuotaLimits API to - Usages and Quotas API (#15416) * 1.Breaking Change - Removing duplicate autoQuotaIncreaseState from supportTicketAction. 2. Removing state=enabledForPreview. 3. Updating Example. * Updating Provider name in example. * Capacity RP Quota APIs for GA * Adding preview version to stable dir as base files. * Files from preview version, which will be removed. * Updating to GA Version. * 1. Updated reservation version tag to - Microsoft.Capacity/preview/2020-10-01-preview/reservations.json, which matches the previous SDK release. 2. Documentation changes. * Documentation updates for put and patch request, which includes only ONE quota request, so changing quotas to quota. * Update documenation for put. * Doc update. * Adding -preview tag for GO sdk. * Updating Go settings for output folder to be -preview. * Adding preview subdir for GO package. * Adding preview subdir to Go sdk path. * Removing tag - tag: package-2020-10-25-preview * introduce a new tag to keep the go sdk package unchanged * Revert "introduce a new tag to keep the go sdk package unchanged" This reverts commit 8f58d3451e9ae5a4746d2a5883911f14ca261f1b. * Adding Azure CLI readme configuration. * Updating the ReadMe configurations. * Updating readme.md * Removing duplicate cli: tag. * Fixing build issues. * Removing Parameter alias. * cli config changes. * Updating the package name to reservation. * Updates - removin .az.md. * Updating Example names to be unique for Get PUT * Adding operations and python-sdk-output-folder. * Updates. * Removing unused file. * Revert "Removing unused file." This reverts commit 4f763bdb14240a3f1ba8e1dce6c7f0b643ee6a9e. * Revert "Revert "Removing unused file."" This reverts commit 60c520e5b50bc13c42d8227624f32031c7ca7694. * Add reference to python readme.md file. * Adding python readme file. * Adding Operations for test-scenario * Adding split * Disabling few operation, which is not needed. * Removing split for Operation * Disabling the reservation Operations. * Disable reservation operations. * Revert "Disable reservation operations." This reverts commit d98cbcbafeb855395f9de45292dfc9db2f5aea9d. * Adding client-subscription-bound: false * Adding Network RP examples and references. * Updating Network Put and Patch requests. * Updating GetQuotaRequests example. * Fixing formatting. * Updating examples. * Adding error details for the quota request status. * Updating examples * Fixing formatting * Fixing model definition. * Revert "Fixing model definition." This reverts commit cef9f52f142cf6c420a5f89bd0e2d806e29530c1. * Updating example. * Making ResoureType as String, as it will change with different RPs and all possible values cannot be added in advance. * Adding Location header to Put and Path calls 200 response. * Adding example for Network StandardSkuPublicIpAddresses * Fixing spelling * Adding error code to Failed requests and updating examples. * Updating error message and code. * Updating example for Network - StandardSkuPublicIpAddresses * Adding oneOf construct. If supported, then I will update the examples. * Adding discriminator for Limit. * Adding discriminator to limit. * Updating network UsagesValue example for discriminator * Adding limitType definition. * Adding type to the Limit objects. * Updating type and example for discriminator * Updating type for discriminator * fixinf type definition for discriminator * Updating schema for discriminator and example. * Update network example. * Fixing network example. * Fixing schema. * Fixing network example. * Fix example. * Updating schema. * Updating schema and example. * Update example. * Examples update. * Update * Updated schema for discriminator * Adding value as required. * Schema Update. * Replace Limt with LimitObject to fix reference. * Updates. * Updates. * Updating Put/Ptach examples. * Updating erxamples. * Schema updated for requestStatus. * Schema Update. * Updates to QuotaRequestStatus example. Change api to quota. Add usages API and update examples reference. * 1. Split quotas and usages apis. 2. Add and update examples for quotas and usages. * Updating example filename references * Update Put example and operations id. * Updating limiType field to limitObjectType * Updating "limitType" to "limitObjectType" * Updating Get Examples. Adding extra property to quotas/limit object. * 1. Updating tags for usages. 2. Rename LimitObjectType to LimitObjectTypes. * Adding "limitType": "Independent" * Updating Operations Tag. * Updating subscription ids. * Updating Operations Name. * Updating the documentations and examples. * Updates. * Updates. * Updating Quota reference to base object type. * Updating examples and restoring the api name to quotaLimitsProviders. * Updating usages model and examples. * Update quotaLimitProviders to remove resourceQuery. * Revert "Update quotaLimitProviders to remove resourceQuery." This reverts commit 301092d496b2834d2e5110aa7b7f32c6f9802951. * Updating Operation API example for quotaLimitProviders rename. * Removing quotaLimitProviders API, as it's not needed by the azure portal. There wasn't a use case for the end user, that's why our team decided to remove it from public API. * 1. Removing unused models for quotaLimitProviders. 2. Update operations example. * Remove allof from usages. * 1. Updating 202 response schema. 2. Adding location header as per - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#updating-using-patch * Updating Patch 202 response model type. * Updating description of put and API api to check location header for detailed status. * Updates to description. * Update quota.json * Update quota.json Text scrub up to line 256 * Update quota.json Scrubbed all text strings. * Running prettier. * Updating Network examples to include resourceType. * Updating Networking Examples. * Remove 202 response body for Put and Patch. * preRemove example - putMachineLearningServicesQuotaRequestDedicated.json * Remove example - putMachineLearningServicesQuotaRequestDedicated.json Co-authored-by: Arcturus Zhang Co-authored-by: Pilar Ackerman --- .../Generated/AzureQuotaExtensionAPIClient.cs | 375 ++++++ .../IAzureQuotaExtensionAPIClient.cs | 88 ++ .../src/Generated/IOperationOperations.cs | 76 ++ .../src/Generated/IQuotaOperations.cs | 296 +++++ .../IQuotaRequestStatusOperations.cs | 130 ++ .../src/Generated/IUsagesOperations.cs | 112 ++ .../Models/CommonResourceProperties.cs | 68 + .../CreateGenericQuotaRequestParameters.cs | 55 + .../Generated/Models/CurrentQuotaLimitBase.cs | 79 ++ .../src/Generated/Models/CurrentUsagesBase.cs | 91 ++ .../src/Generated/Models/ExceptionResponse.cs | 51 + .../Models/ExceptionResponseException.cs | 62 + .../src/Generated/Models/LimitJsonObject.cs | 35 + .../src/Generated/Models/LimitObject.cs | 78 ++ .../src/Generated/Models/LimitType.cs | 21 + .../src/Generated/Models/LimitValue.cs | 81 ++ .../src/Generated/Models/OperationDisplay.cs | 72 + .../src/Generated/Models/OperationResponse.cs | 58 + .../src/Generated/Models/Page.cs | 53 + .../src/Generated/Models/QuotaGetHeaders.cs | 53 + .../src/Generated/Models/QuotaLimitTypes.cs | 22 + .../Generated/Models/QuotaLimitsResponse.cs | 64 + .../src/Generated/Models/QuotaListHeaders.cs | 53 + .../src/Generated/Models/QuotaProperties.cs | 120 ++ .../Generated/Models/QuotaRequestDetails.cs | 119 ++ .../QuotaRequestOneResourceSubmitResponse.cs | 211 +++ .../Models/QuotaRequestProperties.cs | 92 ++ .../src/Generated/Models/QuotaRequestState.cs | 25 + .../Models/QuotaRequestSubmitResponse.cs | 77 ++ .../Models/QuotaRequestSubmitResponse202.cs | 178 +++ .../src/Generated/Models/ResourceName.cs | 60 + .../src/Generated/Models/ServiceError.cs | 69 + .../Generated/Models/ServiceErrorDetail.cs | 59 + .../src/Generated/Models/SubRequest.cs | 107 ++ .../src/Generated/Models/UsagesGetHeaders.cs | 53 + .../src/Generated/Models/UsagesListHeaders.cs | 54 + .../src/Generated/Models/UsagesObject.cs | 69 + .../src/Generated/Models/UsagesProperties.cs | 135 ++ .../src/Generated/Models/UsagesTypes.cs | 22 + .../src/Generated/OperationOperations.cs | 403 ++++++ .../OperationOperationsExtensions.cs | 99 ++ .../src/Generated/QuotaOperations.cs | 1179 +++++++++++++++++ .../Generated/QuotaOperationsExtensions.cs | 467 +++++++ .../Generated/QuotaRequestStatusOperations.cs | 649 +++++++++ .../QuotaRequestStatusOperationsExtensions.cs | 195 +++ .../SdkInfo_AzureQuotaExtensionAPI.cs | 30 + .../src/Generated/UsagesOperations.cs | 649 +++++++++ .../Generated/UsagesOperationsExtensions.cs | 155 +++ 48 files changed, 7349 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/IUsagesOperations.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/CurrentUsagesBase.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/LimitJsonObject.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/LimitObject.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/LimitType.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/LimitValue.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/QuotaGetHeaders.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaLimitTypes.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/ResourceName.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/Models/UsagesGetHeaders.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/UsagesListHeaders.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/UsagesObject.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/UsagesProperties.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/UsagesTypes.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/SdkInfo_AzureQuotaExtensionAPI.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/UsagesOperations.cs create mode 100644 sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/UsagesOperationsExtensions.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 0000000000000..debfa102a3235 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/AzureQuotaExtensionAPIClient.cs @@ -0,0 +1,375 @@ +// +// 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 IUsagesOperations. + /// + public virtual IUsagesOperations Usages { get; private set; } + + /// + /// Gets the IQuotaOperations. + /// + public virtual IQuotaOperations Quota { get; private set; } + + /// + /// Gets the IQuotaRequestStatusOperations. + /// + public virtual IQuotaRequestStatusOperations QuotaRequestStatus { 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() + { + Usages = new UsagesOperations(this); + Quota = new QuotaOperations(this); + QuotaRequestStatus = new QuotaRequestStatusOperations(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() + } + }; + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("limitObjectType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("limitObjectType")); + 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 0000000000000..13b581527480e --- /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 IUsagesOperations. + /// + IUsagesOperations Usages { get; } + + /// + /// Gets the IQuotaOperations. + /// + IQuotaOperations Quota { get; } + + /// + /// Gets the IQuotaRequestStatusOperations. + /// + IQuotaRequestStatusOperations QuotaRequestStatus { 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 0000000000000..97292ea8d17b0 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/IOperationOperations.cs @@ -0,0 +1,76 @@ +// +// 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 the operations supported by the Microsoft.Quota resource + /// provider. + /// + /// + /// 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 the operations supported by the Microsoft.Quota resource + /// provider. + /// + /// + /// 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 0000000000000..d1f3de6435f73 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/IQuotaOperations.cs @@ -0,0 +1,296 @@ +// +// 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 + { + /// + /// Get the quota limit of a resource. The response can be used to + /// determine the remaining quota to 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 + /// For Microsoft.Network PublicIPAddresses. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/00000000-0000-0000-0000-000000000000/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 `/quotas`, 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 with + /// the requested value. To update the quota, follow these steps: + /// 1. Use the GET operation for quotas and usages 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. Please check + /// the URI in location header for the detailed status of the request. + /// + /// + /// Resource name for a given resource provider. For example: + /// - SKU name for Microsoft.Compute + /// - SKU or TotalLowPriorityCores for + /// Microsoft.MachineLearningServices + /// For Microsoft.Network PublicIPAddresses. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/00000000-0000-0000-0000-000000000000/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 `/quotas`, then it's the + /// target Azure resource URI in the GET operation for the specific + /// resource. + /// + /// + /// Quota properties for the specified resource, based on the API + /// called, Quotas or Usages. + /// + /// + /// 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 Usages-GET and Quota-GET operations to determine the + /// remaining quota 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. Please check + /// the URI in location header for the detailed status of the request. + /// + /// + /// Resource name for a given resource provider. For example: + /// - SKU name for Microsoft.Compute + /// - SKU or TotalLowPriorityCores for + /// Microsoft.MachineLearningServices + /// For Microsoft.Network PublicIPAddresses. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/00000000-0000-0000-0000-000000000000/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 `/quotas`, then it's the + /// target Azure resource URI in the GET operation for the specific + /// resource. + /// + /// + /// Quota properties for the specified resource, based on the API + /// called, Quotas or Usages. + /// + /// + /// 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 of all resources for the + /// specified scope. The response from this GET operation can be + /// leveraged to submit requests to update a quota. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/00000000-0000-0000-0000-000000000000/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 `/quotas`, 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 with + /// the requested value. To update the quota, follow these steps: + /// 1. Use the GET operation for quotas and usages 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. Please check + /// the URI in location header for the detailed status of the request. + /// + /// + /// Resource name for a given resource provider. For example: + /// - SKU name for Microsoft.Compute + /// - SKU or TotalLowPriorityCores for + /// Microsoft.MachineLearningServices + /// For Microsoft.Network PublicIPAddresses. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/00000000-0000-0000-0000-000000000000/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 `/quotas`, then it's the + /// target Azure resource URI in the GET operation for the specific + /// resource. + /// + /// + /// Quota properties for the specified resource, based on the API + /// called, Quotas or Usages. + /// + /// + /// 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 Usages-GET and Quota-GET operations to determine the + /// remaining quota 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. Please check + /// the URI in location header for the detailed status of the request. + /// + /// + /// Resource name for a given resource provider. For example: + /// - SKU name for Microsoft.Compute + /// - SKU or TotalLowPriorityCores for + /// Microsoft.MachineLearningServices + /// For Microsoft.Network PublicIPAddresses. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/00000000-0000-0000-0000-000000000000/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 `/quotas`, then it's the + /// target Azure resource URI in the GET operation for the specific + /// resource. + /// + /// + /// Quota properties for the specified resource, based on the API + /// called, Quotas or Usages. + /// + /// + /// 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 of all resources for the + /// specified scope. 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 0000000000000..af90f76cd1ae7 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/IQuotaRequestStatusOperations.cs @@ -0,0 +1,130 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.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 + { + /// + /// Get 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/00000000-0000-0000-0000-000000000000/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 `/quotas`, 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 scope, get the current quota requests for a one + /// year period ending at the time is made. Use the **oData** filter to + /// select quota requests. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/00000000-0000-0000-0000-000000000000/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 `/quotas`, 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, its value 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 scope, get the current quota requests for a one + /// year period ending at the time is made. Use the **oData** filter 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/IUsagesOperations.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/IUsagesOperations.cs new file mode 100644 index 0000000000000..8949f6ec3f939 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/IUsagesOperations.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 +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// UsagesOperations operations. + /// + public partial interface IUsagesOperations + { + /// + /// Get the current usage of a resource. + /// + /// + /// Resource name for a given resource provider. For example: + /// - SKU name for Microsoft.Compute + /// - SKU or TotalLowPriorityCores for + /// Microsoft.MachineLearningServices + /// For Microsoft.Network PublicIPAddresses. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/00000000-0000-0000-0000-000000000000/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 `/quotas`, 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)); + /// + /// Get a list of current usage for all resources for the scope + /// specified. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/00000000-0000-0000-0000-000000000000/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 `/quotas`, 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,UsagesListHeaders>> ListWithHttpMessagesAsync(string scope, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get a list of current usage for all resources for the scope + /// specified. + /// + /// + /// 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,UsagesListHeaders>> ListNextWithHttpMessagesAsync(string nextPageLink, 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 0000000000000..39cc959102f68 --- /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. Example: + /// "Microsoft.Quota/quotas" + 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. Example: "Microsoft.Quota/quotas" + /// + [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 0000000000000..1449245e77ca3 --- /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 0000000000000..2b424e004fa2d --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/CurrentQuotaLimitBase.cs @@ -0,0 +1,79 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.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, based on the API called, Quotas or Usages. + 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, based on + /// the API called, Quotas or Usages. + /// + [JsonProperty(PropertyName = "properties")] + public QuotaProperties Properties { get; set; } + + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/CurrentUsagesBase.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/CurrentUsagesBase.cs new file mode 100644 index 0000000000000..c32c11b2a87e6 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/CurrentUsagesBase.cs @@ -0,0 +1,91 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Quota.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Resource usage. + /// + public partial class CurrentUsagesBase : IResource + { + /// + /// Initializes a new instance of the CurrentUsagesBase class. + /// + public CurrentUsagesBase() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CurrentUsagesBase class. + /// + /// The resource ID. + /// The resource type. + /// The resource name. + /// Usage properties for the specified + /// resource. + public CurrentUsagesBase(string id = default(string), string type = default(string), string name = default(string), UsagesProperties properties = default(UsagesProperties)) + { + 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 usage properties for the specified resource. + /// + [JsonProperty(PropertyName = "properties")] + public UsagesProperties Properties { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Properties != null) + { + Properties.Validate(); + } + } + } +} 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 0000000000000..ef78bc21cecaf --- /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 0000000000000..702332e97dc53 --- /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/LimitJsonObject.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/LimitJsonObject.cs new file mode 100644 index 0000000000000..a3e7487b8fabc --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/LimitJsonObject.cs @@ -0,0 +1,35 @@ +// +// 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 System.Linq; + + /// + /// LimitJson abstract class. + /// + public partial class LimitJsonObject + { + /// + /// Initializes a new instance of the LimitJsonObject class. + /// + public LimitJsonObject() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/LimitObject.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/LimitObject.cs new file mode 100644 index 0000000000000..98c2c7e1154af --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/LimitObject.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.Linq; + + /// + /// The resource quota limit value. + /// + public partial class LimitObject + { + /// + /// Initializes a new instance of the LimitObject class. + /// + public LimitObject() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LimitObject class. + /// + /// The quota/limit value + /// Possible values include: + /// 'LimitValue' + /// Possible values include: 'Independent', + /// 'Shared' + public LimitObject(int value, string limitObjectType = default(string), string limitType = default(string)) + { + Value = value; + LimitObjectType = limitObjectType; + LimitType = limitType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the quota/limit value + /// + [JsonProperty(PropertyName = "value")] + public int Value { get; set; } + + /// + /// Gets or sets possible values include: 'LimitValue' + /// + [JsonProperty(PropertyName = "limitObjectType")] + public string LimitObjectType { get; set; } + + /// + /// Gets or sets possible values include: 'Independent', 'Shared' + /// + [JsonProperty(PropertyName = "limitType")] + public string LimitType { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + } + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/LimitType.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/LimitType.cs new file mode 100644 index 0000000000000..e243c3112f14e --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/LimitType.cs @@ -0,0 +1,21 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Quota.Models +{ + + /// + /// Defines values for LimitType. + /// + public static class LimitType + { + public const string LimitValue = "LimitValue"; + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/LimitValue.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/LimitValue.cs new file mode 100644 index 0000000000000..b6c85e4784f85 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/LimitValue.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; + + /// + /// The resource quota limit. + /// + public partial class LimitValue + { + /// + /// Initializes a new instance of the LimitValue class. + /// + public LimitValue() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LimitValue class. + /// + /// The quota/limit value + /// Possible values include: 'Independent', + /// 'Shared' + public LimitValue(int value, string limitType = default(string)) + { + Value = value; + LimitType = limitType; + CustomInit(); + } + /// + /// Static constructor for LimitValue class. + /// + static LimitValue() + { + LimitObjectType = "LimitValue"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the quota/limit value + /// + [JsonProperty(PropertyName = "value")] + public int Value { get; set; } + + /// + /// Gets or sets possible values include: 'Independent', 'Shared' + /// + [JsonProperty(PropertyName = "limitType")] + public string LimitType { get; set; } + + /// + /// + [JsonProperty(PropertyName = "limitObjectType")] + public static string LimitObjectType { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + } + } +} 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 0000000000000..704a943a85838 --- /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 0000000000000..8aa37d5c5a875 --- /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 0000000000000..6a9f464aa301f --- /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/QuotaGetHeaders.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaGetHeaders.cs new file mode 100644 index 0000000000000..f9fec318d07c6 --- /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/QuotaLimitTypes.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaLimitTypes.cs new file mode 100644 index 0000000000000..840ba313f775b --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaLimitTypes.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 QuotaLimitTypes. + /// + public static class QuotaLimitTypes + { + public const string Independent = "Independent"; + public const string Shared = "Shared"; + } +} 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 0000000000000..113dad9e0a985 --- /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 0000000000000..8ddd751b666c4 --- /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 0000000000000..7fc723d6b14ce --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaProperties.cs @@ -0,0 +1,120 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.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. + /// + /// Resource quota limit properties. + /// The quota 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. + /// 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(LimitJsonObject limit = default(LimitJsonObject), 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; + 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 resource quota limit properties. + /// + [JsonProperty(PropertyName = "limit")] + public LimitJsonObject Limit { get; set; } + + /// + /// Gets The quota 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. + /// + [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 0000000000000..14edcf57d27e2 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaRequestDetails.cs @@ -0,0 +1,119 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.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/quotas". + /// The quota request status. Possible + /// values include: 'Accepted', 'Invalid', 'Succeeded', 'Failed', + /// 'InProgress' + /// User-friendly status message. + /// Error details of the quota request. + /// 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), ServiceErrorDetail error = default(ServiceErrorDetail), System.DateTime? requestSubmitTime = default(System.DateTime?), IList value = default(IList)) + { + Id = id; + Name = name; + Type = type; + ProvisioningState = provisioningState; + Message = message; + Error = error; + 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/quotas". + /// + [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 or sets error details of the quota request. + /// + [JsonProperty(PropertyName = "properties.error")] + public ServiceErrorDetail Error { get; 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 0000000000000..daacdafcfd5d2 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaRequestOneResourceSubmitResponse.cs @@ -0,0 +1,211 @@ +// +// 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. + /// Resource quota limit properties. + /// 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. + /// 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. + /// Error details of the quota request. + /// 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?), LimitObject limit = default(LimitObject), int? currentValue = default(int?), string unit = default(string), ResourceName name1 = default(ResourceName), string resourceType = default(string), string quotaPeriod = default(string), bool? isQuotaApplicable = default(bool?), ServiceErrorDetail error = default(ServiceErrorDetail), 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; + Error = error; + 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 resource quota limit properties. + /// + [JsonProperty(PropertyName = "properties.limit")] + public LimitObject 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. + /// + [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 error details of the quota request. + /// + [JsonProperty(PropertyName = "properties.error")] + public ServiceErrorDetail Error { get; set; } + + /// + /// Gets or sets additional properties for the specific resource + /// provider. + /// + [JsonProperty(PropertyName = "properties.properties")] + public object Properties { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Limit != null) + { + Limit.Validate(); + } + } + } +} 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 0000000000000..b3fc2dae3457d --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaRequestProperties.cs @@ -0,0 +1,92 @@ +// +// 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. + /// Error details of the quota request. + /// 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), ServiceErrorDetail error = default(ServiceErrorDetail), System.DateTime? requestSubmitTime = default(System.DateTime?), IList value = default(IList)) + { + ProvisioningState = provisioningState; + Message = message; + Error = error; + 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 or sets error details of the quota request. + /// + [JsonProperty(PropertyName = "error")] + public ServiceErrorDetail Error { get; 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 0000000000000..b0905304a5634 --- /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 0000000000000..e88c700f7dd8b --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaRequestSubmitResponse.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.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. + /// Quota request details. + /// Resource type. "Microsoft.Quota/quotas". + 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 quota request details. + /// + [JsonProperty(PropertyName = "properties")] + public QuotaRequestProperties Properties { get; set; } + + /// + /// Gets resource type. "Microsoft.Quota/quotas". + /// + [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 0000000000000..7680065f9dae9 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/QuotaRequestSubmitResponse202.cs @@ -0,0 +1,178 @@ +// +// 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. + /// Resource quota limit properties. + /// 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. + /// 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), LimitObject limit = default(LimitObject), 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; + 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 resource quota limit properties. + /// + [JsonProperty(PropertyName = "properties.limit")] + public LimitObject Limit { get; 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. + /// + [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; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Limit != null) + { + Limit.Validate(); + } + } + } +} 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 0000000000000..b02e2950cdc9c --- /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/ServiceError.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/ServiceError.cs new file mode 100644 index 0000000000000..33f4c6a2a8c54 --- /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 0000000000000..b1ca8ace555a5 --- /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 0000000000000..d69d35ebd7dd9 --- /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 name. + /// Resource type for which the quota + /// properties were requested. + /// 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. + /// Resource quota limit properties. + public SubRequest(ResourceName name = default(ResourceName), string resourceType = default(string), string unit = default(string), string provisioningState = default(string), string message = default(string), string subRequestId = default(string), LimitJsonObject limit = default(LimitJsonObject)) + { + Name = name; + ResourceType = resourceType; + Unit = unit; + ProvisioningState = provisioningState; + Message = message; + SubRequestId = subRequestId; + Limit = limit; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource name. + /// + [JsonProperty(PropertyName = "name")] + public ResourceName Name { get; set; } + + /// + /// Gets resource type for which the quota properties were requested. + /// + [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; } + + /// + /// Gets or sets resource quota limit properties. + /// + [JsonProperty(PropertyName = "limit")] + public LimitJsonObject Limit { get; set; } + + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/UsagesGetHeaders.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/UsagesGetHeaders.cs new file mode 100644 index 0000000000000..c138acaba3703 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/UsagesGetHeaders.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 UsagesGetHeaders + { + /// + /// Initializes a new instance of the UsagesGetHeaders class. + /// + public UsagesGetHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UsagesGetHeaders class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public UsagesGetHeaders(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/UsagesListHeaders.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/UsagesListHeaders.cs new file mode 100644 index 0000000000000..945fcfcf7f2a4 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/UsagesListHeaders.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Quota.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for List operation. + /// + public partial class UsagesListHeaders + { + /// + /// Initializes a new instance of the UsagesListHeaders class. + /// + public UsagesListHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UsagesListHeaders class. + /// + /// Current entity state version. It should be + /// treated as opaque and used to make conditional HTTP + /// requests. + public UsagesListHeaders(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. It 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/UsagesObject.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/UsagesObject.cs new file mode 100644 index 0000000000000..8b3b9c8180c45 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/UsagesObject.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; + + /// + /// The resource usages value. + /// + public partial class UsagesObject + { + /// + /// Initializes a new instance of the UsagesObject class. + /// + public UsagesObject() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UsagesObject class. + /// + /// The usages value. + /// Possible values include: 'Individual', + /// 'Combined' + public UsagesObject(int value, string usagesType = default(string)) + { + Value = value; + UsagesType = usagesType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the usages value. + /// + [JsonProperty(PropertyName = "value")] + public int Value { get; set; } + + /// + /// Gets or sets possible values include: 'Individual', 'Combined' + /// + [JsonProperty(PropertyName = "usagesType")] + public string UsagesType { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + } + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/UsagesProperties.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/UsagesProperties.cs new file mode 100644 index 0000000000000..88b3608df301e --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/UsagesProperties.cs @@ -0,0 +1,135 @@ +// +// 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; + + /// + /// Usage properties for the specified resource. + /// + public partial class UsagesProperties + { + /// + /// Initializes a new instance of the UsagesProperties class. + /// + public UsagesProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UsagesProperties class. + /// + /// The quota limit properties for this + /// resource. + /// The units for the quota usage, 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. + /// The name of the resource type. + /// The time period for the summary of the + /// quota usage values. For example: + /// *P1D (per one day) + /// *PT1M (per one minute) + /// *PT1S (per one second). + /// This parameter is optional because it is not relevant for all + /// resources such as compute. + /// States if quota can be requested + /// for this resource. + /// Additional properties for the specific + /// resource provider. + public UsagesProperties(UsagesObject usages = default(UsagesObject), string unit = default(string), ResourceName name = default(ResourceName), string resourceType = default(string), string quotaPeriod = default(string), bool? isQuotaApplicable = default(bool?), object properties = default(object)) + { + Usages = usages; + 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 the quota limit properties for this resource. + /// + [JsonProperty(PropertyName = "usages")] + public UsagesObject Usages { get; set; } + + /// + /// Gets The units for the quota usage, 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 the name of the resource type. + /// + [JsonProperty(PropertyName = "resourceType")] + public string ResourceType { get; set; } + + /// + /// Gets the time period for the summary of the quota usage values. For + /// example: + /// *P1D (per one day) + /// *PT1M (per one minute) + /// *PT1S (per one second). + /// This parameter is optional because it is not relevant for all + /// resources such as compute. + /// + [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; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Usages != null) + { + Usages.Validate(); + } + } + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/UsagesTypes.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/UsagesTypes.cs new file mode 100644 index 0000000000000..5ebe8dfa41c9e --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/Models/UsagesTypes.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 UsagesTypes. + /// + public static class UsagesTypes + { + public const string Individual = "Individual"; + public const string Combined = "Combined"; + } +} 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 0000000000000..19861e7d84648 --- /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 the operations supported by the Microsoft.Quota resource provider. + /// + /// + /// 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 the operations supported by the Microsoft.Quota resource provider. + /// + /// + /// 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 0000000000000..881c020094545 --- /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 the operations supported by the Microsoft.Quota resource provider. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IOperationOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// GET operations. + /// + /// + /// List all the operations supported by the Microsoft.Quota resource provider. + /// + /// + /// 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 the operations supported by the Microsoft.Quota resource provider. + /// + /// + /// 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 the operations supported by the Microsoft.Quota resource provider. + /// + /// + /// 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 0000000000000..823084ba3a48e --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/QuotaOperations.cs @@ -0,0 +1,1179 @@ +// +// 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; } + + /// + /// Get the quota limit of a resource. The response can be used to determine + /// the remaining quota to 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 + /// For Microsoft.Network PublicIPAddresses. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/00000000-0000-0000-0000-000000000000/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 `/quotas`, 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/quotas/{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 with the + /// requested value. To update the quota, follow these steps: + /// 1. Use the GET operation for quotas and usages 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. Please check the URI + /// in location header for the detailed status of the request. + /// + /// + /// Resource name for a given resource provider. For example: + /// - SKU name for Microsoft.Compute + /// - SKU or TotalLowPriorityCores for Microsoft.MachineLearningServices + /// For Microsoft.Network PublicIPAddresses. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/00000000-0000-0000-0000-000000000000/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 `/quotas`, then it's the target Azure + /// resource URI in the GET operation for the specific resource. + /// + /// + /// Quota properties for the specified resource, based on the API called, + /// Quotas or Usages. + /// + /// + /// 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 Usages-GET and Quota-GET operations to determine the remaining + /// quota 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. Please check the URI + /// in location header for the detailed status of the request. + /// + /// + /// Resource name for a given resource provider. For example: + /// - SKU name for Microsoft.Compute + /// - SKU or TotalLowPriorityCores for Microsoft.MachineLearningServices + /// For Microsoft.Network PublicIPAddresses. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/00000000-0000-0000-0000-000000000000/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 `/quotas`, then it's the target Azure + /// resource URI in the GET operation for the specific resource. + /// + /// + /// Quota properties for the specified resource, based on the API called, + /// Quotas or Usages. + /// + /// + /// 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 of all resources for the specified + /// scope. The response from this GET operation can be leveraged to submit + /// requests to update a quota. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/00000000-0000-0000-0000-000000000000/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 `/quotas`, 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/quotas").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 with the + /// requested value. To update the quota, follow these steps: + /// 1. Use the GET operation for quotas and usages 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. Please check the URI + /// in location header for the detailed status of the request. + /// + /// + /// Resource name for a given resource provider. For example: + /// - SKU name for Microsoft.Compute + /// - SKU or TotalLowPriorityCores for Microsoft.MachineLearningServices + /// For Microsoft.Network PublicIPAddresses. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/00000000-0000-0000-0000-000000000000/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 `/quotas`, then it's the target Azure + /// resource URI in the GET operation for the specific resource. + /// + /// + /// Quota properties for the specified resource, based on the API called, + /// Quotas or Usages. + /// + /// + /// 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/quotas/{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); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Update the quota limit for a specific resource to the specified value: + /// 1. Use the Usages-GET and Quota-GET operations to determine the remaining + /// quota 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. Please check the URI + /// in location header for the detailed status of the request. + /// + /// + /// Resource name for a given resource provider. For example: + /// - SKU name for Microsoft.Compute + /// - SKU or TotalLowPriorityCores for Microsoft.MachineLearningServices + /// For Microsoft.Network PublicIPAddresses. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/00000000-0000-0000-0000-000000000000/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 `/quotas`, then it's the target Azure + /// resource URI in the GET operation for the specific resource. + /// + /// + /// Quota properties for the specified resource, based on the API called, + /// Quotas or Usages. + /// + /// + /// 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/quotas/{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); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get a list of current quota limits of all resources for the specified + /// scope. 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 0000000000000..56921d740912b --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/QuotaOperationsExtensions.cs @@ -0,0 +1,467 @@ +// +// 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 + { + /// + /// Get the quota limit of a resource. The response can be used to determine + /// the remaining quota to 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 + /// For Microsoft.Network PublicIPAddresses. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/00000000-0000-0000-0000-000000000000/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 `/quotas`, 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(); + } + + /// + /// Get the quota limit of a resource. The response can be used to determine + /// the remaining quota to 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 + /// For Microsoft.Network PublicIPAddresses. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/00000000-0000-0000-0000-000000000000/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 `/quotas`, 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 with the + /// requested value. To update the quota, follow these steps: + /// 1. Use the GET operation for quotas and usages 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. Please check the URI + /// in location header for the detailed status of the 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 + /// For Microsoft.Network PublicIPAddresses. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/00000000-0000-0000-0000-000000000000/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 `/quotas`, then it's the target Azure + /// resource URI in the GET operation for the specific resource. + /// + /// + /// Quota properties for the specified resource, based on the API called, + /// Quotas or Usages. + /// + 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 with the + /// requested value. To update the quota, follow these steps: + /// 1. Use the GET operation for quotas and usages 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. Please check the URI + /// in location header for the detailed status of the 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 + /// For Microsoft.Network PublicIPAddresses. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/00000000-0000-0000-0000-000000000000/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 `/quotas`, then it's the target Azure + /// resource URI in the GET operation for the specific resource. + /// + /// + /// Quota properties for the specified resource, based on the API called, + /// Quotas or Usages. + /// + /// + /// 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 Usages-GET and Quota-GET operations to determine the remaining + /// quota 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. Please check the URI + /// in location header for the detailed status of the 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 + /// For Microsoft.Network PublicIPAddresses. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/00000000-0000-0000-0000-000000000000/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 `/quotas`, then it's the target Azure + /// resource URI in the GET operation for the specific resource. + /// + /// + /// Quota properties for the specified resource, based on the API called, + /// Quotas or Usages. + /// + 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 Usages-GET and Quota-GET operations to determine the remaining + /// quota 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. Please check the URI + /// in location header for the detailed status of the 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 + /// For Microsoft.Network PublicIPAddresses. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/00000000-0000-0000-0000-000000000000/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 `/quotas`, then it's the target Azure + /// resource URI in the GET operation for the specific resource. + /// + /// + /// Quota properties for the specified resource, based on the API called, + /// Quotas or Usages. + /// + /// + /// 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 of all resources for the specified + /// scope. 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/00000000-0000-0000-0000-000000000000/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 `/quotas`, 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 of all resources for the specified + /// scope. 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/00000000-0000-0000-0000-000000000000/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 `/quotas`, 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 with the + /// requested value. To update the quota, follow these steps: + /// 1. Use the GET operation for quotas and usages 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. Please check the URI + /// in location header for the detailed status of the 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 + /// For Microsoft.Network PublicIPAddresses. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/00000000-0000-0000-0000-000000000000/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 `/quotas`, then it's the target Azure + /// resource URI in the GET operation for the specific resource. + /// + /// + /// Quota properties for the specified resource, based on the API called, + /// Quotas or Usages. + /// + 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 with the + /// requested value. To update the quota, follow these steps: + /// 1. Use the GET operation for quotas and usages 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. Please check the URI + /// in location header for the detailed status of the 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 + /// For Microsoft.Network PublicIPAddresses. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/00000000-0000-0000-0000-000000000000/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 `/quotas`, then it's the target Azure + /// resource URI in the GET operation for the specific resource. + /// + /// + /// Quota properties for the specified resource, based on the API called, + /// Quotas or Usages. + /// + /// + /// 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 Usages-GET and Quota-GET operations to determine the remaining + /// quota 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. Please check the URI + /// in location header for the detailed status of the 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 + /// For Microsoft.Network PublicIPAddresses. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/00000000-0000-0000-0000-000000000000/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 `/quotas`, then it's the target Azure + /// resource URI in the GET operation for the specific resource. + /// + /// + /// Quota properties for the specified resource, based on the API called, + /// Quotas or Usages. + /// + 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 Usages-GET and Quota-GET operations to determine the remaining + /// quota 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. Please check the URI + /// in location header for the detailed status of the 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 + /// For Microsoft.Network PublicIPAddresses. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/00000000-0000-0000-0000-000000000000/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 `/quotas`, then it's the target Azure + /// resource URI in the GET operation for the specific resource. + /// + /// + /// Quota properties for the specified resource, based on the API called, + /// Quotas or Usages. + /// + /// + /// 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 of all resources for the specified + /// scope. 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 of all resources for the specified + /// scope. 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 0000000000000..cc740fd9eca61 --- /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; } + + /// + /// Get 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/00000000-0000-0000-0000-000000000000/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 `/quotas`, 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/quotaRequests/{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 scope, get the current quota requests for a one year + /// period ending at the time is made. Use the **oData** filter to select quota + /// requests. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/00000000-0000-0000-0000-000000000000/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 `/quotas`, 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, its + /// value 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/quotaRequests").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 scope, get the current quota requests for a one year + /// period ending at the time is made. Use the **oData** filter 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 0000000000000..bdd8bc6e743e4 --- /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 + { + /// + /// Get 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/00000000-0000-0000-0000-000000000000/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 `/quotas`, 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(); + } + + /// + /// Get 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/00000000-0000-0000-0000-000000000000/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 `/quotas`, 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 scope, get the current quota requests for a one year + /// period ending at the time is made. Use the **oData** filter to select quota + /// requests. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/00000000-0000-0000-0000-000000000000/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 `/quotas`, 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, its + /// value 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 scope, get the current quota requests for a one year + /// period ending at the time is made. Use the **oData** filter to select quota + /// requests. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/00000000-0000-0000-0000-000000000000/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 `/quotas`, 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, its + /// value 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 scope, get the current quota requests for a one year + /// period ending at the time is made. Use the **oData** filter 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 scope, get the current quota requests for a one year + /// period ending at the time is made. Use the **oData** filter 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/SdkInfo_AzureQuotaExtensionAPI.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/SdkInfo_AzureQuotaExtensionAPI.cs new file mode 100644 index 0000000000000..b31e0fea35989 --- /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", "Usages", "2021-03-15-preview"), + }.AsEnumerable(); + } + } + } +} diff --git a/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/UsagesOperations.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/UsagesOperations.cs new file mode 100644 index 0000000000000..527350205e7c5 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/UsagesOperations.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; + + /// + /// UsagesOperations operations. + /// + internal partial class UsagesOperations : IServiceOperations, IUsagesOperations + { + /// + /// Initializes a new instance of the UsagesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal UsagesOperations(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 the current usage of a resource. + /// + /// + /// Resource name for a given resource provider. For example: + /// - SKU name for Microsoft.Compute + /// - SKU or TotalLowPriorityCores for Microsoft.MachineLearningServices + /// For Microsoft.Network PublicIPAddresses. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/00000000-0000-0000-0000-000000000000/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 `/quotas`, 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/usages/{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; + } + + /// + /// Get a list of current usage for all resources for the scope specified. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/00000000-0000-0000-0000-000000000000/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 `/quotas`, 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,UsagesListHeaders>> 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/usages").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,UsagesListHeaders>(); + _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; + } + + /// + /// Get a list of current usage for all resources for the scope specified. + /// + /// + /// 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,UsagesListHeaders>> 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,UsagesListHeaders>(); + _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/UsagesOperationsExtensions.cs b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/UsagesOperationsExtensions.cs new file mode 100644 index 0000000000000..8a520dc2d52b3 --- /dev/null +++ b/sdk/quota/Microsoft.Azure.Management.Quota/src/Generated/UsagesOperationsExtensions.cs @@ -0,0 +1,155 @@ +// +// 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 UsagesOperations. + /// + public static partial class UsagesOperationsExtensions + { + /// + /// Get the current usage of a resource. + /// + /// + /// 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 + /// For Microsoft.Network PublicIPAddresses. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/00000000-0000-0000-0000-000000000000/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 `/quotas`, then it's the target Azure + /// resource URI in the GET operation for the specific resource. + /// + public static CurrentUsagesBase Get(this IUsagesOperations operations, string resourceName, string scope) + { + return operations.GetAsync(resourceName, scope).GetAwaiter().GetResult(); + } + + /// + /// Get the current usage of a resource. + /// + /// + /// 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 + /// For Microsoft.Network PublicIPAddresses. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/00000000-0000-0000-0000-000000000000/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 `/quotas`, 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 IUsagesOperations operations, string resourceName, string scope, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceName, scope, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a list of current usage for all resources for the scope specified. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/00000000-0000-0000-0000-000000000000/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 `/quotas`, then it's the target Azure + /// resource URI in the GET operation for the specific resource. + /// + public static IPage List(this IUsagesOperations operations, string scope) + { + return operations.ListAsync(scope).GetAwaiter().GetResult(); + } + + /// + /// Get a list of current usage for all resources for the scope specified. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The target Azure resource URI. For example, + /// `/subscriptions/00000000-0000-0000-0000-000000000000/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 `/quotas`, 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 IUsagesOperations operations, string scope, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(scope, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a list of current usage for all resources for the scope specified. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IUsagesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get a list of current usage for all resources for the scope specified. + /// + /// + /// 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 IUsagesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +}