From 3b83df7e5a3cb43063c7b1d1f9f5020804276a86 Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Thu, 30 Apr 2020 05:41:57 +0000 Subject: [PATCH] Generated from 493a71c9f995bdb1ed037803d35a7b479fd1ba48 Making Tag information same - QuotaInformation. --- .../Generated/AzureReservationAPIClient.cs | 18 +- .../Generated/IAzureReservationAPIClient.cs | 14 +- .../src/Generated/IQuotaOperations.cs | 264 ++++- .../src/Generated/IQuotaRequestOperations.cs | 243 ----- ...ns.cs => IQuotaRequestStatusOperations.cs} | 10 +- .../src/Generated/IQuotasOperations.cs | 89 -- .../Models/{OnFailure.cs => Actions.cs} | 21 +- .../Models/AutoQuotaIncreaseDetail.cs | 6 +- .../src/Generated/Models/EmailActions.cs | 14 +- .../Generated/Models/OnFailureEmailActions.cs | 53 - .../Generated/Models/OnFailurePhoneActions.cs | 53 - ...istStatusHeaders.cs => QuotaGetHeaders.cs} | 12 +- ...stStatusHeaders.cs => QuotaListHeaders.cs} | 12 +- .../src/Generated/QuotaOperations.cs | 997 +++++++++++++++++- .../Generated/QuotaOperationsExtensions.cs | 464 +++++++- .../src/Generated/QuotaRequestOperations.cs | 686 ------------ .../QuotaRequestOperationsExtensions.cs | 409 ------- ...ons.cs => QuotaRequestStatusOperations.cs} | 20 +- ...QuotaRequestStatusOperationsExtensions.cs} | 28 +- .../src/Generated/QuotasOperations.cs | 453 -------- .../Generated/QuotasOperationsExtensions.cs | 129 --- .../Generated/SdkInfo_AzureReservationAPI.cs | 4 +- .../src/generate.ps1 | 2 +- 23 files changed, 1779 insertions(+), 2222 deletions(-) delete mode 100644 sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/IQuotaRequestOperations.cs rename sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/{IQuotaRequestsOperations.cs => IQuotaRequestStatusOperations.cs} (87%) delete mode 100644 sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/IQuotasOperations.cs rename sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/{OnFailure.cs => Actions.cs} (60%) delete mode 100644 sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/OnFailureEmailActions.cs delete mode 100644 sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/OnFailurePhoneActions.cs rename sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/{QuotaListStatusHeaders.cs => QuotaGetHeaders.cs} (78%) rename sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/{QuotasListStatusHeaders.cs => QuotaListHeaders.cs} (78%) delete mode 100644 sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/QuotaRequestOperations.cs delete mode 100644 sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/QuotaRequestOperationsExtensions.cs rename sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/{QuotaRequestsOperations.cs => QuotaRequestStatusOperations.cs} (96%) rename sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/{QuotaRequestsOperationsExtensions.cs => QuotaRequestStatusOperationsExtensions.cs} (80%) delete mode 100644 sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/QuotasOperations.cs delete mode 100644 sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/QuotasOperationsExtensions.cs diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/AzureReservationAPIClient.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/AzureReservationAPIClient.cs index 86d4fcd080d1..77283e252e56 100644 --- a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/AzureReservationAPIClient.cs +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/AzureReservationAPIClient.cs @@ -69,19 +69,9 @@ public partial class AzureReservationAPIClient : ServiceClient - /// Gets the IQuotaRequestOperations. + /// Gets the IQuotaRequestStatusOperations. /// - public virtual IQuotaRequestOperations QuotaRequest { get; private set; } - - /// - /// Gets the IQuotasOperations. - /// - public virtual IQuotasOperations Quotas { get; private set; } - - /// - /// Gets the IQuotaRequestsOperations. - /// - public virtual IQuotaRequestsOperations QuotaRequests { get; private set; } + public virtual IQuotaRequestStatusOperations QuotaRequestStatus { get; private set; } /// /// Gets the IAutoQuotaIncreaseOperations. @@ -345,9 +335,7 @@ public AzureReservationAPIClient(System.Uri baseUri, ServiceClientCredentials cr private void Initialize() { Quota = new QuotaOperations(this); - QuotaRequest = new QuotaRequestOperations(this); - Quotas = new QuotasOperations(this); - QuotaRequests = new QuotaRequestsOperations(this); + QuotaRequestStatus = new QuotaRequestStatusOperations(this); AutoQuotaIncrease = new AutoQuotaIncreaseOperations(this); Reservation = new ReservationOperations(this); ReservationOrder = new ReservationOrderOperations(this); diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/IAzureReservationAPIClient.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/IAzureReservationAPIClient.cs index e010daf83643..fcbde0e33516 100644 --- a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/IAzureReservationAPIClient.cs +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/IAzureReservationAPIClient.cs @@ -68,19 +68,9 @@ public partial interface IAzureReservationAPIClient : System.IDisposable IQuotaOperations Quota { get; } /// - /// Gets the IQuotaRequestOperations. + /// Gets the IQuotaRequestStatusOperations. /// - IQuotaRequestOperations QuotaRequest { get; } - - /// - /// Gets the IQuotasOperations. - /// - IQuotasOperations Quotas { get; } - - /// - /// Gets the IQuotaRequestsOperations. - /// - IQuotaRequestsOperations QuotaRequests { get; } + IQuotaRequestStatusOperations QuotaRequestStatus { get; } /// /// Gets the IAutoQuotaIncreaseOperations. diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/IQuotaOperations.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/IQuotaOperations.cs index 63fa840363f8..503c92d6394b 100644 --- a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/IQuotaOperations.cs +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/IQuotaOperations.cs @@ -61,6 +61,268 @@ public partial interface IQuotaOperations /// /// Thrown when a required parameter is null /// - Task> ListStatusWithHttpMessagesAsync(string subscriptionId, string providerId, string location, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string subscriptionId, string providerId, string location, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Submits a Quota Request for a resource provider at the specified + /// location for the specific resource in the parameter. + /// + /// + /// Submits Quota change request for a resource provider for the + /// specified location for the specific resource in the parameter. To + /// use, first make a Get request to get quota information for the + /// specific resource. This information consists of information + /// regarding that specific resources. For the specific resource, if it + /// requires an update to the quota, update the limit field in the + /// response from the Get request to the new value of quota. Then, + /// submit this updated JSON object to this quota request API. This + /// will update the quota to the value specified. The location header + /// in the response will be used to track the status of the quota + /// request. Please check the provisioningState field in the response. + /// The Patch operation can be used also to update the quota. + /// + /// + /// Azure subscription id. + /// + /// + /// Azure resource Provider id. + /// + /// + /// Azure region. + /// + /// + /// The Resource name for the specific resource provider, such as SKU + /// name for Microsoft.Compute, pool for Microsoft.Batch. + /// + /// + /// Quota requests payload. + /// + /// + /// 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 subscriptionId, string providerId, string location, string resourceName, CurrentQuotaLimitBase createQuotaRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Submits a Quota Request for a resource provider at the specified + /// location for the specific resource in the parameter. + /// + /// + /// Submits Quota change request for a resource provider for the + /// specified location for the specific resource in the parameter. To + /// use, first make a Get request to get quota information for the + /// specific resource. This information consists of information + /// regarding that specific resources. For the specific resource, if it + /// requires an update to the quota, update the limit field in the + /// response from the Get request to the new value of quota. Then, + /// submit this updated JSON object to this quota request API. This + /// will update the quota to the value specified. The location header + /// in the response will be used to track the status of the quota + /// request. Please check the provisioningState field in the response. + /// The Put operation can be used also to update the quota. + /// + /// + /// Azure subscription id. + /// + /// + /// Azure resource Provider id. + /// + /// + /// Azure region. + /// + /// + /// The Resource name for the specific resource provider, such as SKU + /// name for Microsoft.Compute, pool for Microsoft.Batch. + /// + /// + /// Quota requests payload. + /// + /// + /// 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 subscriptionId, string providerId, string location, string resourceName, CurrentQuotaLimitBase createQuotaRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the current quota limit and usages for all the resources by + /// the resource provider at the specified location. + /// + /// + /// This API gets the current quota limits and usages for the resource + /// provider for the specified location. This response can be used to + /// submit quotaRequests. + /// + /// + /// Azure subscription id. + /// + /// + /// Azure resource Provider id. + /// + /// + /// Azure region. + /// + /// + /// 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 subscriptionId, string providerId, string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Submits a Quota Request for a resource provider at the specified + /// location for the specific resource in the parameter. + /// + /// + /// Submits Quota change request for a resource provider for the + /// specified location for the specific resource in the parameter. To + /// use, first make a Get request to get quota information for the + /// specific resource. This information consists of information + /// regarding that specific resources. For the specific resource, if it + /// requires an update to the quota, update the limit field in the + /// response from the Get request to the new value of quota. Then, + /// submit this updated JSON object to this quota request API. This + /// will update the quota to the value specified. The location header + /// in the response will be used to track the status of the quota + /// request. Please check the provisioningState field in the response. + /// The Patch operation can be used also to update the quota. + /// + /// + /// Azure subscription id. + /// + /// + /// Azure resource Provider id. + /// + /// + /// Azure region. + /// + /// + /// The Resource name for the specific resource provider, such as SKU + /// name for Microsoft.Compute, pool for Microsoft.Batch. + /// + /// + /// Quota requests payload. + /// + /// + /// 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 subscriptionId, string providerId, string location, string resourceName, CurrentQuotaLimitBase createQuotaRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Submits a Quota Request for a resource provider at the specified + /// location for the specific resource in the parameter. + /// + /// + /// Submits Quota change request for a resource provider for the + /// specified location for the specific resource in the parameter. To + /// use, first make a Get request to get quota information for the + /// specific resource. This information consists of information + /// regarding that specific resources. For the specific resource, if it + /// requires an update to the quota, update the limit field in the + /// response from the Get request to the new value of quota. Then, + /// submit this updated JSON object to this quota request API. This + /// will update the quota to the value specified. The location header + /// in the response will be used to track the status of the quota + /// request. Please check the provisioningState field in the response. + /// The Put operation can be used also to update the quota. + /// + /// + /// Azure subscription id. + /// + /// + /// Azure resource Provider id. + /// + /// + /// Azure region. + /// + /// + /// The Resource name for the specific resource provider, such as SKU + /// name for Microsoft.Compute, pool for Microsoft.Batch. + /// + /// + /// Quota requests payload. + /// + /// + /// 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 subscriptionId, string providerId, string location, string resourceName, CurrentQuotaLimitBase createQuotaRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the current quota limit and usages for all the resources by + /// the resource provider at the specified location. + /// + /// + /// This API gets the current quota limits and usages for the resource + /// provider for the specified location. This response can be used to + /// submit quotaRequests. + /// + /// + /// 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/reservations/Microsoft.Azure.Management.Reservations/src/Generated/IQuotaRequestOperations.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/IQuotaRequestOperations.cs deleted file mode 100644 index 9af9dc9d0ce1..000000000000 --- a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/IQuotaRequestOperations.cs +++ /dev/null @@ -1,243 +0,0 @@ -// -// 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.Reservations -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// QuotaRequestOperations operations. - /// - public partial interface IQuotaRequestOperations - { - /// - /// Submits a Quota Request for a resource provider at the specified - /// location for the specific resource in the parameter. - /// - /// - /// Submits Quota change request for a resource provider for the - /// specified location for the specific resource in the parameter. To - /// use, first make a Get request to get quota information for the - /// specific resource. This information consists of information - /// regarding that specific resources. For the specific resource, if it - /// requires an update to the quota, update the limit field in the - /// response from the Get request to the new value of quota. Then, - /// submit this updated JSON object to this quota request API. This - /// will update the quota to the value specified. The location header - /// in the response will be used to track the status of the quota - /// request. Please check the provisioningState field in the response. - /// - /// - /// Azure subscription id. - /// - /// - /// Azure resource Provider id. - /// - /// - /// Azure region. - /// - /// - /// The Resource name for the specific resource provider, such as SKU - /// name for Microsoft.Compute, pool for Microsoft.Batch. - /// - /// - /// Quota requests payload. - /// - /// - /// ETag of the Entity. ETag should match the current entity state from - /// the header response of the GET request or it should be * for - /// unconditional update. - /// - /// - /// 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> CreateWithHttpMessagesAsync(string subscriptionId, string providerId, string location, string resourceName, CurrentQuotaLimitBase createQuotaRequest, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Submits a Quota Request for a resource provider at the specified - /// location for the specific resource in the parameter. - /// - /// - /// Submits Quota change request for a resource provider for the - /// specified location for the specific resource in the parameter. To - /// use, first make a Get request to get quota information for the - /// specific resource. This information consists of information - /// regarding that specific resources. For the specific resource, if it - /// requires an update to the quota, update the limit field in the - /// response from the Get request to the new value of quota. Then, - /// submit this updated JSON object to this quota request API. This - /// will update the quota to the value specified. The location header - /// in the response will be used to track the status of the quota - /// request. Please check the provisioningState field in the response. - /// - /// - /// Azure subscription id. - /// - /// - /// Azure resource Provider id. - /// - /// - /// Azure region. - /// - /// - /// The Resource name for the specific resource provider, such as SKU - /// name for Microsoft.Compute, pool for Microsoft.Batch. - /// - /// - /// Quota requests payload. - /// - /// - /// ETag of the Entity. ETag should match the current entity state from - /// the header response of the GET request or it should be * for - /// unconditional update. - /// - /// - /// 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 subscriptionId, string providerId, string location, string resourceName, CurrentQuotaLimitBase createQuotaRequest, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Submits a Quota Request for a resource provider at the specified - /// location for the specific resource in the parameter. - /// - /// - /// Submits Quota change request for a resource provider for the - /// specified location for the specific resource in the parameter. To - /// use, first make a Get request to get quota information for the - /// specific resource. This information consists of information - /// regarding that specific resources. For the specific resource, if it - /// requires an update to the quota, update the limit field in the - /// response from the Get request to the new value of quota. Then, - /// submit this updated JSON object to this quota request API. This - /// will update the quota to the value specified. The location header - /// in the response will be used to track the status of the quota - /// request. Please check the provisioningState field in the response. - /// - /// - /// Azure subscription id. - /// - /// - /// Azure resource Provider id. - /// - /// - /// Azure region. - /// - /// - /// The Resource name for the specific resource provider, such as SKU - /// name for Microsoft.Compute, pool for Microsoft.Batch. - /// - /// - /// Quota requests payload. - /// - /// - /// ETag of the Entity. ETag should match the current entity state from - /// the header response of the GET request or it should be * for - /// unconditional update. - /// - /// - /// 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> BeginCreateWithHttpMessagesAsync(string subscriptionId, string providerId, string location, string resourceName, CurrentQuotaLimitBase createQuotaRequest, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Submits a Quota Request for a resource provider at the specified - /// location for the specific resource in the parameter. - /// - /// - /// Submits Quota change request for a resource provider for the - /// specified location for the specific resource in the parameter. To - /// use, first make a Get request to get quota information for the - /// specific resource. This information consists of information - /// regarding that specific resources. For the specific resource, if it - /// requires an update to the quota, update the limit field in the - /// response from the Get request to the new value of quota. Then, - /// submit this updated JSON object to this quota request API. This - /// will update the quota to the value specified. The location header - /// in the response will be used to track the status of the quota - /// request. Please check the provisioningState field in the response. - /// - /// - /// Azure subscription id. - /// - /// - /// Azure resource Provider id. - /// - /// - /// Azure region. - /// - /// - /// The Resource name for the specific resource provider, such as SKU - /// name for Microsoft.Compute, pool for Microsoft.Batch. - /// - /// - /// Quota requests payload. - /// - /// - /// ETag of the Entity. ETag should match the current entity state from - /// the header response of the GET request or it should be * for - /// unconditional update. - /// - /// - /// 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 subscriptionId, string providerId, string location, string resourceName, CurrentQuotaLimitBase createQuotaRequest, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/IQuotaRequestsOperations.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/IQuotaRequestStatusOperations.cs similarity index 87% rename from sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/IQuotaRequestsOperations.cs rename to sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/IQuotaRequestStatusOperations.cs index a30d455c1e18..0f6535ee7b24 100644 --- a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/IQuotaRequestsOperations.cs +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/IQuotaRequestStatusOperations.cs @@ -19,9 +19,9 @@ namespace Microsoft.Azure.Management.Reservations using System.Threading.Tasks; /// - /// QuotaRequestsOperations operations. + /// QuotaRequestStatusOperations operations. /// - public partial interface IQuotaRequestsOperations + public partial interface IQuotaRequestStatusOperations { /// /// Gets the Quota request status by requestId, for the specified @@ -60,7 +60,7 @@ public partial interface IQuotaRequestsOperations /// /// Thrown when a required parameter is null /// - Task> GetStatusWithHttpMessagesAsync(string subscriptionId, string providerId, string location, string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string subscriptionId, string providerId, string location, string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// For the specified location and resource Provider, gets the quota /// requests under the subscription over the time @@ -112,7 +112,7 @@ public partial interface IQuotaRequestsOperations /// /// Thrown when a required parameter is null /// - Task>> ListStatusWithHttpMessagesAsync(string subscriptionId, string providerId, string location, string filter = default(string), int? top = default(int?), string skiptoken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string subscriptionId, string providerId, string location, string filter = default(string), int? top = default(int?), string skiptoken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// For the specified location and resource Provider, gets the quota /// requests under the subscription over the time @@ -143,6 +143,6 @@ public partial interface IQuotaRequestsOperations /// /// Thrown when a required parameter is null /// - Task>> ListStatusNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/IQuotasOperations.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/IQuotasOperations.cs deleted file mode 100644 index 7d31a62a1c03..000000000000 --- a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/IQuotasOperations.cs +++ /dev/null @@ -1,89 +0,0 @@ -// -// 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.Reservations -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// QuotasOperations operations. - /// - public partial interface IQuotasOperations - { - /// - /// Gets the current quota limit and usages for all the resources by - /// the resource provider at the specified location. - /// - /// - /// This API gets the current quota limits and usages for the resource - /// provider for the specified location. This response can be used to - /// submit quotaRequests. - /// - /// - /// Azure subscription id. - /// - /// - /// Azure resource Provider id. - /// - /// - /// Azure region. - /// - /// - /// 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,QuotasListStatusHeaders>> ListStatusWithHttpMessagesAsync(string subscriptionId, string providerId, string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets the current quota limit and usages for all the resources by - /// the resource provider at the specified location. - /// - /// - /// This API gets the current quota limits and usages for the resource - /// provider for the specified location. This response can be used to - /// submit quotaRequests. - /// - /// - /// 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,QuotasListStatusHeaders>> ListStatusNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/OnFailure.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/Actions.cs similarity index 60% rename from sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/OnFailure.cs rename to sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/Actions.cs index f23a55796e78..4a3babe28a9c 100644 --- a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/OnFailure.cs +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/Actions.cs @@ -16,27 +16,24 @@ namespace Microsoft.Azure.Management.Reservations.Models /// /// The actions for auto quota increase. /// - public partial class OnFailure + public partial class Actions { /// - /// Initializes a new instance of the OnFailure class. + /// Initializes a new instance of the Actions class. /// - public OnFailure() + public Actions() { CustomInit(); } /// - /// Initializes a new instance of the OnFailure class. + /// Initializes a new instance of the Actions class. /// /// The email actions for auto quota /// increase. - /// The phone actions for auto quota - /// increase. - public OnFailure(OnFailureEmailActions emailActions = default(OnFailureEmailActions), OnFailurePhoneActions phoneActions = default(OnFailurePhoneActions)) + public Actions(EmailActions emailActions = default(EmailActions)) { EmailActions = emailActions; - PhoneActions = phoneActions; CustomInit(); } @@ -49,13 +46,7 @@ public OnFailure() /// Gets or sets the email actions for auto quota increase. /// [JsonProperty(PropertyName = "emailActions")] - public OnFailureEmailActions EmailActions { get; set; } - - /// - /// Gets or sets the phone actions for auto quota increase. - /// - [JsonProperty(PropertyName = "phoneActions")] - public OnFailurePhoneActions PhoneActions { get; set; } + public EmailActions EmailActions { get; set; } } } diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/AutoQuotaIncreaseDetail.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/AutoQuotaIncreaseDetail.cs index 0f3151b2da88..7f2ed8f88b13 100644 --- a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/AutoQuotaIncreaseDetail.cs +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/AutoQuotaIncreaseDetail.cs @@ -42,7 +42,7 @@ public AutoQuotaIncreaseDetail() /// The on success Actions. /// The support ticket /// action. - public AutoQuotaIncreaseDetail(string id = default(string), string name = default(string), string type = default(string), AqiSettings settings = default(AqiSettings), OnFailure onFailure = default(OnFailure), OnFailure onSuccess = default(OnFailure), SupportRequestAction supportTicketAction = default(SupportRequestAction)) + public AutoQuotaIncreaseDetail(string id = default(string), string name = default(string), string type = default(string), AqiSettings settings = default(AqiSettings), Actions onFailure = default(Actions), Actions onSuccess = default(Actions), SupportRequestAction supportTicketAction = default(SupportRequestAction)) { Id = id; Name = name; @@ -87,13 +87,13 @@ public AutoQuotaIncreaseDetail() /// Gets or sets the on failure Actions. /// [JsonProperty(PropertyName = "properties.onFailure")] - public OnFailure OnFailure { get; set; } + public Actions OnFailure { get; set; } /// /// Gets or sets the on success Actions. /// [JsonProperty(PropertyName = "properties.onSuccess")] - public OnFailure OnSuccess { get; set; } + public Actions OnSuccess { get; set; } /// /// Gets or sets the support ticket action. diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/EmailActions.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/EmailActions.cs index 3fa45340ceab..138af82a66c2 100644 --- a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/EmailActions.cs +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/EmailActions.cs @@ -31,11 +31,10 @@ public EmailActions() /// /// Initializes a new instance of the EmailActions class. /// - /// The list of email actions based on the success - /// or failure of automatic quota increase action. - public EmailActions(IList value = default(IList)) + /// The list of email actions. + public EmailActions(IList emailAddresses = default(IList)) { - Value = value; + EmailAddresses = emailAddresses; CustomInit(); } @@ -45,11 +44,10 @@ public EmailActions() partial void CustomInit(); /// - /// Gets or sets the list of email actions based on the success or - /// failure of automatic quota increase action. + /// Gets or sets the list of email actions. /// - [JsonProperty(PropertyName = "value")] - public IList Value { get; set; } + [JsonProperty(PropertyName = "emailAddresses")] + public IList EmailAddresses { get; set; } } } diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/OnFailureEmailActions.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/OnFailureEmailActions.cs deleted file mode 100644 index fda567f2d595..000000000000 --- a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/OnFailureEmailActions.cs +++ /dev/null @@ -1,53 +0,0 @@ -// -// 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.Reservations.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The email actions for auto quota increase. - /// - public partial class OnFailureEmailActions - { - /// - /// Initializes a new instance of the OnFailureEmailActions class. - /// - public OnFailureEmailActions() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the OnFailureEmailActions class. - /// - /// The list of email actions. - public OnFailureEmailActions(IList value = default(IList)) - { - Value = value; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the list of email actions. - /// - [JsonProperty(PropertyName = "value")] - public IList Value { get; set; } - - } -} diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/OnFailurePhoneActions.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/OnFailurePhoneActions.cs deleted file mode 100644 index c746b4b0d192..000000000000 --- a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/OnFailurePhoneActions.cs +++ /dev/null @@ -1,53 +0,0 @@ -// -// 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.Reservations.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The phone actions for auto quota increase. - /// - public partial class OnFailurePhoneActions - { - /// - /// Initializes a new instance of the OnFailurePhoneActions class. - /// - public OnFailurePhoneActions() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the OnFailurePhoneActions class. - /// - /// The list of phone actions. - public OnFailurePhoneActions(IList value = default(IList)) - { - Value = value; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the list of phone actions. - /// - [JsonProperty(PropertyName = "value")] - public IList Value { get; set; } - - } -} diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/QuotaListStatusHeaders.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/QuotaGetHeaders.cs similarity index 78% rename from sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/QuotaListStatusHeaders.cs rename to sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/QuotaGetHeaders.cs index c1b1eb125b67..77ce8524452e 100644 --- a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/QuotaListStatusHeaders.cs +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/QuotaGetHeaders.cs @@ -14,24 +14,24 @@ namespace Microsoft.Azure.Management.Reservations.Models using System.Linq; /// - /// Defines headers for listStatus operation. + /// Defines headers for Get operation. /// - public partial class QuotaListStatusHeaders + public partial class QuotaGetHeaders { /// - /// Initializes a new instance of the QuotaListStatusHeaders class. + /// Initializes a new instance of the QuotaGetHeaders class. /// - public QuotaListStatusHeaders() + public QuotaGetHeaders() { CustomInit(); } /// - /// Initializes a new instance of the QuotaListStatusHeaders class. + /// 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 QuotaListStatusHeaders(string eTag = default(string)) + public QuotaGetHeaders(string eTag = default(string)) { ETag = eTag; CustomInit(); diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/QuotasListStatusHeaders.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/QuotaListHeaders.cs similarity index 78% rename from sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/QuotasListStatusHeaders.cs rename to sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/QuotaListHeaders.cs index efe6455bf1c1..d06c74c6e97f 100644 --- a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/QuotasListStatusHeaders.cs +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/Models/QuotaListHeaders.cs @@ -14,24 +14,24 @@ namespace Microsoft.Azure.Management.Reservations.Models using System.Linq; /// - /// Defines headers for listStatus operation. + /// Defines headers for List operation. /// - public partial class QuotasListStatusHeaders + public partial class QuotaListHeaders { /// - /// Initializes a new instance of the QuotasListStatusHeaders class. + /// Initializes a new instance of the QuotaListHeaders class. /// - public QuotasListStatusHeaders() + public QuotaListHeaders() { CustomInit(); } /// - /// Initializes a new instance of the QuotasListStatusHeaders class. + /// 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 QuotasListStatusHeaders(string eTag = default(string)) + public QuotaListHeaders(string eTag = default(string)) { ETag = eTag; CustomInit(); diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/QuotaOperations.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/QuotaOperations.cs index 7a2ae6113569..54afa97d831a 100644 --- a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/QuotaOperations.cs +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/QuotaOperations.cs @@ -93,7 +93,7 @@ internal QuotaOperations(AzureReservationAPIClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListStatusWithHttpMessagesAsync(string subscriptionId, string providerId, string location, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string subscriptionId, string providerId, string location, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (subscriptionId == null) { @@ -125,7 +125,7 @@ internal QuotaOperations(AzureReservationAPIClient client) tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceName", resourceName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListStatus", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -227,7 +227,7 @@ internal QuotaOperations(AzureReservationAPIClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -254,7 +254,996 @@ internal QuotaOperations(AzureReservationAPIClient client) } try { - _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + _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; + } + + /// + /// Submits a Quota Request for a resource provider at the specified location + /// for the specific resource in the parameter. + /// + /// + /// Submits Quota change request for a resource provider for the specified + /// location for the specific resource in the parameter. To use, first make a + /// Get request to get quota information for the specific resource. This + /// information consists of information regarding that specific resources. For + /// the specific resource, if it requires an update to the quota, update the + /// limit field in the response from the Get request to the new value of quota. + /// Then, submit this updated JSON object to this quota request API. This will + /// update the quota to the value specified. The location header in the + /// response will be used to track the status of the quota request. Please + /// check the provisioningState field in the response. The Patch operation can + /// be used also to update the quota. + /// + /// + /// Azure subscription id. + /// + /// + /// Azure resource Provider id. + /// + /// + /// Azure region. + /// + /// + /// The Resource name for the specific resource provider, such as SKU name for + /// Microsoft.Compute, pool for Microsoft.Batch. + /// + /// + /// Quota requests payload. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string subscriptionId, string providerId, string location, string resourceName, CurrentQuotaLimitBase createQuotaRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(subscriptionId, providerId, location, resourceName, createQuotaRequest, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Submits a Quota Request for a resource provider at the specified location + /// for the specific resource in the parameter. + /// + /// + /// Submits Quota change request for a resource provider for the specified + /// location for the specific resource in the parameter. To use, first make a + /// Get request to get quota information for the specific resource. This + /// information consists of information regarding that specific resources. For + /// the specific resource, if it requires an update to the quota, update the + /// limit field in the response from the Get request to the new value of quota. + /// Then, submit this updated JSON object to this quota request API. This will + /// update the quota to the value specified. The location header in the + /// response will be used to track the status of the quota request. Please + /// check the provisioningState field in the response. The Put operation can be + /// used also to update the quota. + /// + /// + /// Azure subscription id. + /// + /// + /// Azure resource Provider id. + /// + /// + /// Azure region. + /// + /// + /// The Resource name for the specific resource provider, such as SKU name for + /// Microsoft.Compute, pool for Microsoft.Batch. + /// + /// + /// Quota requests payload. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string subscriptionId, string providerId, string location, string resourceName, CurrentQuotaLimitBase createQuotaRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(subscriptionId, providerId, location, resourceName, createQuotaRequest, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the current quota limit and usages for all the resources by the + /// resource provider at the specified location. + /// + /// + /// This API gets the current quota limits and usages for the resource provider + /// for the specified location. This response can be used to submit + /// quotaRequests. + /// + /// + /// Azure subscription id. + /// + /// + /// Azure resource Provider id. + /// + /// + /// Azure region. + /// + /// + /// 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 subscriptionId, string providerId, string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (subscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "subscriptionId"); + } + if (providerId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "providerId"); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + string apiVersion = "2019-07-19-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("subscriptionId", subscriptionId); + tracingParameters.Add("providerId", providerId); + tracingParameters.Add("location", location); + tracingParameters.Add("apiVersion", apiVersion); + 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("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(subscriptionId)); + _url = _url.Replace("{providerId}", System.Uri.EscapeDataString(providerId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; + } + + /// + /// Submits a Quota Request for a resource provider at the specified location + /// for the specific resource in the parameter. + /// + /// + /// Submits Quota change request for a resource provider for the specified + /// location for the specific resource in the parameter. To use, first make a + /// Get request to get quota information for the specific resource. This + /// information consists of information regarding that specific resources. For + /// the specific resource, if it requires an update to the quota, update the + /// limit field in the response from the Get request to the new value of quota. + /// Then, submit this updated JSON object to this quota request API. This will + /// update the quota to the value specified. The location header in the + /// response will be used to track the status of the quota request. Please + /// check the provisioningState field in the response. The Patch operation can + /// be used also to update the quota. + /// + /// + /// Azure subscription id. + /// + /// + /// Azure resource Provider id. + /// + /// + /// Azure region. + /// + /// + /// The Resource name for the specific resource provider, such as SKU name for + /// Microsoft.Compute, pool for Microsoft.Batch. + /// + /// + /// Quota requests payload. + /// + /// + /// 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 subscriptionId, string providerId, string location, string resourceName, CurrentQuotaLimitBase createQuotaRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (subscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "subscriptionId"); + } + if (providerId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "providerId"); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (createQuotaRequest == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "createQuotaRequest"); + } + string apiVersion = "2019-07-19-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("subscriptionId", subscriptionId); + tracingParameters.Add("providerId", providerId); + tracingParameters.Add("location", location); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("apiVersion", apiVersion); + 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("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(subscriptionId)); + _url = _url.Replace("{providerId}", System.Uri.EscapeDataString(providerId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 != 201) + { + var ex = new ExceptionResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ExceptionResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Submits a Quota Request for a resource provider at the specified location + /// for the specific resource in the parameter. + /// + /// + /// Submits Quota change request for a resource provider for the specified + /// location for the specific resource in the parameter. To use, first make a + /// Get request to get quota information for the specific resource. This + /// information consists of information regarding that specific resources. For + /// the specific resource, if it requires an update to the quota, update the + /// limit field in the response from the Get request to the new value of quota. + /// Then, submit this updated JSON object to this quota request API. This will + /// update the quota to the value specified. The location header in the + /// response will be used to track the status of the quota request. Please + /// check the provisioningState field in the response. The Put operation can be + /// used also to update the quota. + /// + /// + /// Azure subscription id. + /// + /// + /// Azure resource Provider id. + /// + /// + /// Azure region. + /// + /// + /// The Resource name for the specific resource provider, such as SKU name for + /// Microsoft.Compute, pool for Microsoft.Batch. + /// + /// + /// Quota requests payload. + /// + /// + /// 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 subscriptionId, string providerId, string location, string resourceName, CurrentQuotaLimitBase createQuotaRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (subscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "subscriptionId"); + } + if (providerId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "providerId"); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (createQuotaRequest == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "createQuotaRequest"); + } + string apiVersion = "2019-07-19-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("subscriptionId", subscriptionId); + tracingParameters.Add("providerId", providerId); + tracingParameters.Add("location", location); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("apiVersion", apiVersion); + 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("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(subscriptionId)); + _url = _url.Replace("{providerId}", System.Uri.EscapeDataString(providerId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 != 201) + { + var ex = new ExceptionResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ExceptionResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the current quota limit and usages for all the resources by the + /// resource provider at the specified location. + /// + /// + /// This API gets the current quota limits and usages for the resource provider + /// for the specified location. This response can be used to submit + /// quotaRequests. + /// + /// + /// 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) { diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/QuotaOperationsExtensions.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/QuotaOperationsExtensions.cs index 4982df10f680..9255945dbab2 100644 --- a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/QuotaOperationsExtensions.cs +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/QuotaOperationsExtensions.cs @@ -46,9 +46,9 @@ public static partial class QuotaOperationsExtensions /// The Resource name for the specific resource provider, such as SKU name for /// Microsoft.Compute, pool for Microsoft.Batch. /// - public static CurrentQuotaLimitBase ListStatus(this IQuotaOperations operations, string subscriptionId, string providerId, string location, string resourceName) + public static CurrentQuotaLimitBase Get(this IQuotaOperations operations, string subscriptionId, string providerId, string location, string resourceName) { - return operations.ListStatusAsync(subscriptionId, providerId, location, resourceName).GetAwaiter().GetResult(); + return operations.GetAsync(subscriptionId, providerId, location, resourceName).GetAwaiter().GetResult(); } /// @@ -79,9 +79,465 @@ public static CurrentQuotaLimitBase ListStatus(this IQuotaOperations operations, /// /// The cancellation token. /// - public static async Task ListStatusAsync(this IQuotaOperations operations, string subscriptionId, string providerId, string location, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IQuotaOperations operations, string subscriptionId, string providerId, string location, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListStatusWithHttpMessagesAsync(subscriptionId, providerId, location, resourceName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(subscriptionId, providerId, location, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Submits a Quota Request for a resource provider at the specified location + /// for the specific resource in the parameter. + /// + /// + /// Submits Quota change request for a resource provider for the specified + /// location for the specific resource in the parameter. To use, first make a + /// Get request to get quota information for the specific resource. This + /// information consists of information regarding that specific resources. For + /// the specific resource, if it requires an update to the quota, update the + /// limit field in the response from the Get request to the new value of quota. + /// Then, submit this updated JSON object to this quota request API. This will + /// update the quota to the value specified. The location header in the + /// response will be used to track the status of the quota request. Please + /// check the provisioningState field in the response. The Patch operation can + /// be used also to update the quota. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure subscription id. + /// + /// + /// Azure resource Provider id. + /// + /// + /// Azure region. + /// + /// + /// The Resource name for the specific resource provider, such as SKU name for + /// Microsoft.Compute, pool for Microsoft.Batch. + /// + /// + /// Quota requests payload. + /// + public static object CreateOrUpdate(this IQuotaOperations operations, string subscriptionId, string providerId, string location, string resourceName, CurrentQuotaLimitBase createQuotaRequest) + { + return operations.CreateOrUpdateAsync(subscriptionId, providerId, location, resourceName, createQuotaRequest).GetAwaiter().GetResult(); + } + + /// + /// Submits a Quota Request for a resource provider at the specified location + /// for the specific resource in the parameter. + /// + /// + /// Submits Quota change request for a resource provider for the specified + /// location for the specific resource in the parameter. To use, first make a + /// Get request to get quota information for the specific resource. This + /// information consists of information regarding that specific resources. For + /// the specific resource, if it requires an update to the quota, update the + /// limit field in the response from the Get request to the new value of quota. + /// Then, submit this updated JSON object to this quota request API. This will + /// update the quota to the value specified. The location header in the + /// response will be used to track the status of the quota request. Please + /// check the provisioningState field in the response. The Patch operation can + /// be used also to update the quota. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure subscription id. + /// + /// + /// Azure resource Provider id. + /// + /// + /// Azure region. + /// + /// + /// The Resource name for the specific resource provider, such as SKU name for + /// Microsoft.Compute, pool for Microsoft.Batch. + /// + /// + /// Quota requests payload. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IQuotaOperations operations, string subscriptionId, string providerId, string location, string resourceName, CurrentQuotaLimitBase createQuotaRequest, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(subscriptionId, providerId, location, resourceName, createQuotaRequest, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Submits a Quota Request for a resource provider at the specified location + /// for the specific resource in the parameter. + /// + /// + /// Submits Quota change request for a resource provider for the specified + /// location for the specific resource in the parameter. To use, first make a + /// Get request to get quota information for the specific resource. This + /// information consists of information regarding that specific resources. For + /// the specific resource, if it requires an update to the quota, update the + /// limit field in the response from the Get request to the new value of quota. + /// Then, submit this updated JSON object to this quota request API. This will + /// update the quota to the value specified. The location header in the + /// response will be used to track the status of the quota request. Please + /// check the provisioningState field in the response. The Put operation can be + /// used also to update the quota. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure subscription id. + /// + /// + /// Azure resource Provider id. + /// + /// + /// Azure region. + /// + /// + /// The Resource name for the specific resource provider, such as SKU name for + /// Microsoft.Compute, pool for Microsoft.Batch. + /// + /// + /// Quota requests payload. + /// + public static object Update(this IQuotaOperations operations, string subscriptionId, string providerId, string location, string resourceName, CurrentQuotaLimitBase createQuotaRequest) + { + return operations.UpdateAsync(subscriptionId, providerId, location, resourceName, createQuotaRequest).GetAwaiter().GetResult(); + } + + /// + /// Submits a Quota Request for a resource provider at the specified location + /// for the specific resource in the parameter. + /// + /// + /// Submits Quota change request for a resource provider for the specified + /// location for the specific resource in the parameter. To use, first make a + /// Get request to get quota information for the specific resource. This + /// information consists of information regarding that specific resources. For + /// the specific resource, if it requires an update to the quota, update the + /// limit field in the response from the Get request to the new value of quota. + /// Then, submit this updated JSON object to this quota request API. This will + /// update the quota to the value specified. The location header in the + /// response will be used to track the status of the quota request. Please + /// check the provisioningState field in the response. The Put operation can be + /// used also to update the quota. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure subscription id. + /// + /// + /// Azure resource Provider id. + /// + /// + /// Azure region. + /// + /// + /// The Resource name for the specific resource provider, such as SKU name for + /// Microsoft.Compute, pool for Microsoft.Batch. + /// + /// + /// Quota requests payload. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IQuotaOperations operations, string subscriptionId, string providerId, string location, string resourceName, CurrentQuotaLimitBase createQuotaRequest, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(subscriptionId, providerId, location, resourceName, createQuotaRequest, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the current quota limit and usages for all the resources by the + /// resource provider at the specified location. + /// + /// + /// This API gets the current quota limits and usages for the resource provider + /// for the specified location. This response can be used to submit + /// quotaRequests. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure subscription id. + /// + /// + /// Azure resource Provider id. + /// + /// + /// Azure region. + /// + public static IPage List(this IQuotaOperations operations, string subscriptionId, string providerId, string location) + { + return operations.ListAsync(subscriptionId, providerId, location).GetAwaiter().GetResult(); + } + + /// + /// Gets the current quota limit and usages for all the resources by the + /// resource provider at the specified location. + /// + /// + /// This API gets the current quota limits and usages for the resource provider + /// for the specified location. This response can be used to submit + /// quotaRequests. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure subscription id. + /// + /// + /// Azure resource Provider id. + /// + /// + /// Azure region. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IQuotaOperations operations, string subscriptionId, string providerId, string location, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(subscriptionId, providerId, location, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Submits a Quota Request for a resource provider at the specified location + /// for the specific resource in the parameter. + /// + /// + /// Submits Quota change request for a resource provider for the specified + /// location for the specific resource in the parameter. To use, first make a + /// Get request to get quota information for the specific resource. This + /// information consists of information regarding that specific resources. For + /// the specific resource, if it requires an update to the quota, update the + /// limit field in the response from the Get request to the new value of quota. + /// Then, submit this updated JSON object to this quota request API. This will + /// update the quota to the value specified. The location header in the + /// response will be used to track the status of the quota request. Please + /// check the provisioningState field in the response. The Patch operation can + /// be used also to update the quota. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure subscription id. + /// + /// + /// Azure resource Provider id. + /// + /// + /// Azure region. + /// + /// + /// The Resource name for the specific resource provider, such as SKU name for + /// Microsoft.Compute, pool for Microsoft.Batch. + /// + /// + /// Quota requests payload. + /// + public static object BeginCreateOrUpdate(this IQuotaOperations operations, string subscriptionId, string providerId, string location, string resourceName, CurrentQuotaLimitBase createQuotaRequest) + { + return operations.BeginCreateOrUpdateAsync(subscriptionId, providerId, location, resourceName, createQuotaRequest).GetAwaiter().GetResult(); + } + + /// + /// Submits a Quota Request for a resource provider at the specified location + /// for the specific resource in the parameter. + /// + /// + /// Submits Quota change request for a resource provider for the specified + /// location for the specific resource in the parameter. To use, first make a + /// Get request to get quota information for the specific resource. This + /// information consists of information regarding that specific resources. For + /// the specific resource, if it requires an update to the quota, update the + /// limit field in the response from the Get request to the new value of quota. + /// Then, submit this updated JSON object to this quota request API. This will + /// update the quota to the value specified. The location header in the + /// response will be used to track the status of the quota request. Please + /// check the provisioningState field in the response. The Patch operation can + /// be used also to update the quota. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure subscription id. + /// + /// + /// Azure resource Provider id. + /// + /// + /// Azure region. + /// + /// + /// The Resource name for the specific resource provider, such as SKU name for + /// Microsoft.Compute, pool for Microsoft.Batch. + /// + /// + /// Quota requests payload. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IQuotaOperations operations, string subscriptionId, string providerId, string location, string resourceName, CurrentQuotaLimitBase createQuotaRequest, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(subscriptionId, providerId, location, resourceName, createQuotaRequest, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Submits a Quota Request for a resource provider at the specified location + /// for the specific resource in the parameter. + /// + /// + /// Submits Quota change request for a resource provider for the specified + /// location for the specific resource in the parameter. To use, first make a + /// Get request to get quota information for the specific resource. This + /// information consists of information regarding that specific resources. For + /// the specific resource, if it requires an update to the quota, update the + /// limit field in the response from the Get request to the new value of quota. + /// Then, submit this updated JSON object to this quota request API. This will + /// update the quota to the value specified. The location header in the + /// response will be used to track the status of the quota request. Please + /// check the provisioningState field in the response. The Put operation can be + /// used also to update the quota. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure subscription id. + /// + /// + /// Azure resource Provider id. + /// + /// + /// Azure region. + /// + /// + /// The Resource name for the specific resource provider, such as SKU name for + /// Microsoft.Compute, pool for Microsoft.Batch. + /// + /// + /// Quota requests payload. + /// + public static object BeginUpdate(this IQuotaOperations operations, string subscriptionId, string providerId, string location, string resourceName, CurrentQuotaLimitBase createQuotaRequest) + { + return operations.BeginUpdateAsync(subscriptionId, providerId, location, resourceName, createQuotaRequest).GetAwaiter().GetResult(); + } + + /// + /// Submits a Quota Request for a resource provider at the specified location + /// for the specific resource in the parameter. + /// + /// + /// Submits Quota change request for a resource provider for the specified + /// location for the specific resource in the parameter. To use, first make a + /// Get request to get quota information for the specific resource. This + /// information consists of information regarding that specific resources. For + /// the specific resource, if it requires an update to the quota, update the + /// limit field in the response from the Get request to the new value of quota. + /// Then, submit this updated JSON object to this quota request API. This will + /// update the quota to the value specified. The location header in the + /// response will be used to track the status of the quota request. Please + /// check the provisioningState field in the response. The Put operation can be + /// used also to update the quota. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure subscription id. + /// + /// + /// Azure resource Provider id. + /// + /// + /// Azure region. + /// + /// + /// The Resource name for the specific resource provider, such as SKU name for + /// Microsoft.Compute, pool for Microsoft.Batch. + /// + /// + /// Quota requests payload. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IQuotaOperations operations, string subscriptionId, string providerId, string location, string resourceName, CurrentQuotaLimitBase createQuotaRequest, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(subscriptionId, providerId, location, resourceName, createQuotaRequest, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the current quota limit and usages for all the resources by the + /// resource provider at the specified location. + /// + /// + /// This API gets the current quota limits and usages for the resource provider + /// for the specified location. This response can be used to submit + /// quotaRequests. + /// + /// + /// 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(); + } + + /// + /// Gets the current quota limit and usages for all the resources by the + /// resource provider at the specified location. + /// + /// + /// This API gets the current quota limits and usages for the resource provider + /// for the specified location. This response can be used to submit + /// quotaRequests. + /// + /// + /// 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/reservations/Microsoft.Azure.Management.Reservations/src/Generated/QuotaRequestOperations.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/QuotaRequestOperations.cs deleted file mode 100644 index 9036496a6d76..000000000000 --- a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/QuotaRequestOperations.cs +++ /dev/null @@ -1,686 +0,0 @@ -// -// 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.Reservations -{ - 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; - - /// - /// QuotaRequestOperations operations. - /// - internal partial class QuotaRequestOperations : IServiceOperations, IQuotaRequestOperations - { - /// - /// Initializes a new instance of the QuotaRequestOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal QuotaRequestOperations(AzureReservationAPIClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the AzureReservationAPIClient - /// - public AzureReservationAPIClient Client { get; private set; } - - /// - /// Submits a Quota Request for a resource provider at the specified location - /// for the specific resource in the parameter. - /// - /// - /// Submits Quota change request for a resource provider for the specified - /// location for the specific resource in the parameter. To use, first make a - /// Get request to get quota information for the specific resource. This - /// information consists of information regarding that specific resources. For - /// the specific resource, if it requires an update to the quota, update the - /// limit field in the response from the Get request to the new value of quota. - /// Then, submit this updated JSON object to this quota request API. This will - /// update the quota to the value specified. The location header in the - /// response will be used to track the status of the quota request. Please - /// check the provisioningState field in the response. - /// - /// - /// Azure subscription id. - /// - /// - /// Azure resource Provider id. - /// - /// - /// Azure region. - /// - /// - /// The Resource name for the specific resource provider, such as SKU name for - /// Microsoft.Compute, pool for Microsoft.Batch. - /// - /// - /// Quota requests payload. - /// - /// - /// ETag of the Entity. ETag should match the current entity state from the - /// header response of the GET request or it should be * for unconditional - /// update. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> CreateWithHttpMessagesAsync(string subscriptionId, string providerId, string location, string resourceName, CurrentQuotaLimitBase createQuotaRequest, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send Request - AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(subscriptionId, providerId, location, resourceName, createQuotaRequest, ifMatch, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Submits a Quota Request for a resource provider at the specified location - /// for the specific resource in the parameter. - /// - /// - /// Submits Quota change request for a resource provider for the specified - /// location for the specific resource in the parameter. To use, first make a - /// Get request to get quota information for the specific resource. This - /// information consists of information regarding that specific resources. For - /// the specific resource, if it requires an update to the quota, update the - /// limit field in the response from the Get request to the new value of quota. - /// Then, submit this updated JSON object to this quota request API. This will - /// update the quota to the value specified. The location header in the - /// response will be used to track the status of the quota request. Please - /// check the provisioningState field in the response. - /// - /// - /// Azure subscription id. - /// - /// - /// Azure resource Provider id. - /// - /// - /// Azure region. - /// - /// - /// The Resource name for the specific resource provider, such as SKU name for - /// Microsoft.Compute, pool for Microsoft.Batch. - /// - /// - /// Quota requests payload. - /// - /// - /// ETag of the Entity. ETag should match the current entity state from the - /// header response of the GET request or it should be * for unconditional - /// update. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> UpdateWithHttpMessagesAsync(string subscriptionId, string providerId, string location, string resourceName, CurrentQuotaLimitBase createQuotaRequest, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send Request - AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(subscriptionId, providerId, location, resourceName, createQuotaRequest, ifMatch, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Submits a Quota Request for a resource provider at the specified location - /// for the specific resource in the parameter. - /// - /// - /// Submits Quota change request for a resource provider for the specified - /// location for the specific resource in the parameter. To use, first make a - /// Get request to get quota information for the specific resource. This - /// information consists of information regarding that specific resources. For - /// the specific resource, if it requires an update to the quota, update the - /// limit field in the response from the Get request to the new value of quota. - /// Then, submit this updated JSON object to this quota request API. This will - /// update the quota to the value specified. The location header in the - /// response will be used to track the status of the quota request. Please - /// check the provisioningState field in the response. - /// - /// - /// Azure subscription id. - /// - /// - /// Azure resource Provider id. - /// - /// - /// Azure region. - /// - /// - /// The Resource name for the specific resource provider, such as SKU name for - /// Microsoft.Compute, pool for Microsoft.Batch. - /// - /// - /// Quota requests payload. - /// - /// - /// ETag of the Entity. ETag should match the current entity state from the - /// header response of the GET request or it should be * for unconditional - /// update. - /// - /// - /// 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> BeginCreateWithHttpMessagesAsync(string subscriptionId, string providerId, string location, string resourceName, CurrentQuotaLimitBase createQuotaRequest, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (subscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "subscriptionId"); - } - if (providerId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "providerId"); - } - if (location == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "location"); - } - if (resourceName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); - } - if (createQuotaRequest == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "createQuotaRequest"); - } - if (ifMatch == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); - } - string apiVersion = "2019-07-19-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("subscriptionId", subscriptionId); - tracingParameters.Add("providerId", providerId); - tracingParameters.Add("location", location); - tracingParameters.Add("resourceName", resourceName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("createQuotaRequest", createQuotaRequest); - tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(subscriptionId)); - _url = _url.Replace("{providerId}", System.Uri.EscapeDataString(providerId)); - _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); - _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 (ifMatch != null) - { - if (_httpRequest.Headers.Contains("If-Match")) - { - _httpRequest.Headers.Remove("If-Match"); - } - _httpRequest.Headers.TryAddWithoutValidation("If-Match", ifMatch); - } - 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 != 201) - { - var ex = new ExceptionResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ExceptionResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - // Deserialize Response - if ((int)_statusCode == 201) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Submits a Quota Request for a resource provider at the specified location - /// for the specific resource in the parameter. - /// - /// - /// Submits Quota change request for a resource provider for the specified - /// location for the specific resource in the parameter. To use, first make a - /// Get request to get quota information for the specific resource. This - /// information consists of information regarding that specific resources. For - /// the specific resource, if it requires an update to the quota, update the - /// limit field in the response from the Get request to the new value of quota. - /// Then, submit this updated JSON object to this quota request API. This will - /// update the quota to the value specified. The location header in the - /// response will be used to track the status of the quota request. Please - /// check the provisioningState field in the response. - /// - /// - /// Azure subscription id. - /// - /// - /// Azure resource Provider id. - /// - /// - /// Azure region. - /// - /// - /// The Resource name for the specific resource provider, such as SKU name for - /// Microsoft.Compute, pool for Microsoft.Batch. - /// - /// - /// Quota requests payload. - /// - /// - /// ETag of the Entity. ETag should match the current entity state from the - /// header response of the GET request or it should be * for unconditional - /// update. - /// - /// - /// 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 subscriptionId, string providerId, string location, string resourceName, CurrentQuotaLimitBase createQuotaRequest, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (subscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "subscriptionId"); - } - if (providerId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "providerId"); - } - if (location == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "location"); - } - if (resourceName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); - } - if (createQuotaRequest == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "createQuotaRequest"); - } - if (ifMatch == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); - } - string apiVersion = "2019-07-19-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("subscriptionId", subscriptionId); - tracingParameters.Add("providerId", providerId); - tracingParameters.Add("location", location); - tracingParameters.Add("resourceName", resourceName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("createQuotaRequest", createQuotaRequest); - tracingParameters.Add("ifMatch", ifMatch); - 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("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(subscriptionId)); - _url = _url.Replace("{providerId}", System.Uri.EscapeDataString(providerId)); - _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); - _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 (ifMatch != null) - { - if (_httpRequest.Headers.Contains("If-Match")) - { - _httpRequest.Headers.Remove("If-Match"); - } - _httpRequest.Headers.TryAddWithoutValidation("If-Match", ifMatch); - } - 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 != 201) - { - var ex = new ExceptionResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ExceptionResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - // Deserialize Response - if ((int)_statusCode == 201) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/QuotaRequestOperationsExtensions.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/QuotaRequestOperationsExtensions.cs deleted file mode 100644 index a7b416ac0a4a..000000000000 --- a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/QuotaRequestOperationsExtensions.cs +++ /dev/null @@ -1,409 +0,0 @@ -// -// 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.Reservations -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for QuotaRequestOperations. - /// - public static partial class QuotaRequestOperationsExtensions - { - /// - /// Submits a Quota Request for a resource provider at the specified location - /// for the specific resource in the parameter. - /// - /// - /// Submits Quota change request for a resource provider for the specified - /// location for the specific resource in the parameter. To use, first make a - /// Get request to get quota information for the specific resource. This - /// information consists of information regarding that specific resources. For - /// the specific resource, if it requires an update to the quota, update the - /// limit field in the response from the Get request to the new value of quota. - /// Then, submit this updated JSON object to this quota request API. This will - /// update the quota to the value specified. The location header in the - /// response will be used to track the status of the quota request. Please - /// check the provisioningState field in the response. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Azure subscription id. - /// - /// - /// Azure resource Provider id. - /// - /// - /// Azure region. - /// - /// - /// The Resource name for the specific resource provider, such as SKU name for - /// Microsoft.Compute, pool for Microsoft.Batch. - /// - /// - /// Quota requests payload. - /// - /// - /// ETag of the Entity. ETag should match the current entity state from the - /// header response of the GET request or it should be * for unconditional - /// update. - /// - public static object Create(this IQuotaRequestOperations operations, string subscriptionId, string providerId, string location, string resourceName, CurrentQuotaLimitBase createQuotaRequest, string ifMatch) - { - return operations.CreateAsync(subscriptionId, providerId, location, resourceName, createQuotaRequest, ifMatch).GetAwaiter().GetResult(); - } - - /// - /// Submits a Quota Request for a resource provider at the specified location - /// for the specific resource in the parameter. - /// - /// - /// Submits Quota change request for a resource provider for the specified - /// location for the specific resource in the parameter. To use, first make a - /// Get request to get quota information for the specific resource. This - /// information consists of information regarding that specific resources. For - /// the specific resource, if it requires an update to the quota, update the - /// limit field in the response from the Get request to the new value of quota. - /// Then, submit this updated JSON object to this quota request API. This will - /// update the quota to the value specified. The location header in the - /// response will be used to track the status of the quota request. Please - /// check the provisioningState field in the response. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Azure subscription id. - /// - /// - /// Azure resource Provider id. - /// - /// - /// Azure region. - /// - /// - /// The Resource name for the specific resource provider, such as SKU name for - /// Microsoft.Compute, pool for Microsoft.Batch. - /// - /// - /// Quota requests payload. - /// - /// - /// ETag of the Entity. ETag should match the current entity state from the - /// header response of the GET request or it should be * for unconditional - /// update. - /// - /// - /// The cancellation token. - /// - public static async Task CreateAsync(this IQuotaRequestOperations operations, string subscriptionId, string providerId, string location, string resourceName, CurrentQuotaLimitBase createQuotaRequest, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateWithHttpMessagesAsync(subscriptionId, providerId, location, resourceName, createQuotaRequest, ifMatch, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Submits a Quota Request for a resource provider at the specified location - /// for the specific resource in the parameter. - /// - /// - /// Submits Quota change request for a resource provider for the specified - /// location for the specific resource in the parameter. To use, first make a - /// Get request to get quota information for the specific resource. This - /// information consists of information regarding that specific resources. For - /// the specific resource, if it requires an update to the quota, update the - /// limit field in the response from the Get request to the new value of quota. - /// Then, submit this updated JSON object to this quota request API. This will - /// update the quota to the value specified. The location header in the - /// response will be used to track the status of the quota request. Please - /// check the provisioningState field in the response. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Azure subscription id. - /// - /// - /// Azure resource Provider id. - /// - /// - /// Azure region. - /// - /// - /// The Resource name for the specific resource provider, such as SKU name for - /// Microsoft.Compute, pool for Microsoft.Batch. - /// - /// - /// Quota requests payload. - /// - /// - /// ETag of the Entity. ETag should match the current entity state from the - /// header response of the GET request or it should be * for unconditional - /// update. - /// - public static object Update(this IQuotaRequestOperations operations, string subscriptionId, string providerId, string location, string resourceName, CurrentQuotaLimitBase createQuotaRequest, string ifMatch) - { - return operations.UpdateAsync(subscriptionId, providerId, location, resourceName, createQuotaRequest, ifMatch).GetAwaiter().GetResult(); - } - - /// - /// Submits a Quota Request for a resource provider at the specified location - /// for the specific resource in the parameter. - /// - /// - /// Submits Quota change request for a resource provider for the specified - /// location for the specific resource in the parameter. To use, first make a - /// Get request to get quota information for the specific resource. This - /// information consists of information regarding that specific resources. For - /// the specific resource, if it requires an update to the quota, update the - /// limit field in the response from the Get request to the new value of quota. - /// Then, submit this updated JSON object to this quota request API. This will - /// update the quota to the value specified. The location header in the - /// response will be used to track the status of the quota request. Please - /// check the provisioningState field in the response. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Azure subscription id. - /// - /// - /// Azure resource Provider id. - /// - /// - /// Azure region. - /// - /// - /// The Resource name for the specific resource provider, such as SKU name for - /// Microsoft.Compute, pool for Microsoft.Batch. - /// - /// - /// Quota requests payload. - /// - /// - /// ETag of the Entity. ETag should match the current entity state from the - /// header response of the GET request or it should be * for unconditional - /// update. - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this IQuotaRequestOperations operations, string subscriptionId, string providerId, string location, string resourceName, CurrentQuotaLimitBase createQuotaRequest, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.UpdateWithHttpMessagesAsync(subscriptionId, providerId, location, resourceName, createQuotaRequest, ifMatch, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Submits a Quota Request for a resource provider at the specified location - /// for the specific resource in the parameter. - /// - /// - /// Submits Quota change request for a resource provider for the specified - /// location for the specific resource in the parameter. To use, first make a - /// Get request to get quota information for the specific resource. This - /// information consists of information regarding that specific resources. For - /// the specific resource, if it requires an update to the quota, update the - /// limit field in the response from the Get request to the new value of quota. - /// Then, submit this updated JSON object to this quota request API. This will - /// update the quota to the value specified. The location header in the - /// response will be used to track the status of the quota request. Please - /// check the provisioningState field in the response. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Azure subscription id. - /// - /// - /// Azure resource Provider id. - /// - /// - /// Azure region. - /// - /// - /// The Resource name for the specific resource provider, such as SKU name for - /// Microsoft.Compute, pool for Microsoft.Batch. - /// - /// - /// Quota requests payload. - /// - /// - /// ETag of the Entity. ETag should match the current entity state from the - /// header response of the GET request or it should be * for unconditional - /// update. - /// - public static object BeginCreate(this IQuotaRequestOperations operations, string subscriptionId, string providerId, string location, string resourceName, CurrentQuotaLimitBase createQuotaRequest, string ifMatch) - { - return operations.BeginCreateAsync(subscriptionId, providerId, location, resourceName, createQuotaRequest, ifMatch).GetAwaiter().GetResult(); - } - - /// - /// Submits a Quota Request for a resource provider at the specified location - /// for the specific resource in the parameter. - /// - /// - /// Submits Quota change request for a resource provider for the specified - /// location for the specific resource in the parameter. To use, first make a - /// Get request to get quota information for the specific resource. This - /// information consists of information regarding that specific resources. For - /// the specific resource, if it requires an update to the quota, update the - /// limit field in the response from the Get request to the new value of quota. - /// Then, submit this updated JSON object to this quota request API. This will - /// update the quota to the value specified. The location header in the - /// response will be used to track the status of the quota request. Please - /// check the provisioningState field in the response. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Azure subscription id. - /// - /// - /// Azure resource Provider id. - /// - /// - /// Azure region. - /// - /// - /// The Resource name for the specific resource provider, such as SKU name for - /// Microsoft.Compute, pool for Microsoft.Batch. - /// - /// - /// Quota requests payload. - /// - /// - /// ETag of the Entity. ETag should match the current entity state from the - /// header response of the GET request or it should be * for unconditional - /// update. - /// - /// - /// The cancellation token. - /// - public static async Task BeginCreateAsync(this IQuotaRequestOperations operations, string subscriptionId, string providerId, string location, string resourceName, CurrentQuotaLimitBase createQuotaRequest, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.BeginCreateWithHttpMessagesAsync(subscriptionId, providerId, location, resourceName, createQuotaRequest, ifMatch, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Submits a Quota Request for a resource provider at the specified location - /// for the specific resource in the parameter. - /// - /// - /// Submits Quota change request for a resource provider for the specified - /// location for the specific resource in the parameter. To use, first make a - /// Get request to get quota information for the specific resource. This - /// information consists of information regarding that specific resources. For - /// the specific resource, if it requires an update to the quota, update the - /// limit field in the response from the Get request to the new value of quota. - /// Then, submit this updated JSON object to this quota request API. This will - /// update the quota to the value specified. The location header in the - /// response will be used to track the status of the quota request. Please - /// check the provisioningState field in the response. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Azure subscription id. - /// - /// - /// Azure resource Provider id. - /// - /// - /// Azure region. - /// - /// - /// The Resource name for the specific resource provider, such as SKU name for - /// Microsoft.Compute, pool for Microsoft.Batch. - /// - /// - /// Quota requests payload. - /// - /// - /// ETag of the Entity. ETag should match the current entity state from the - /// header response of the GET request or it should be * for unconditional - /// update. - /// - public static object BeginUpdate(this IQuotaRequestOperations operations, string subscriptionId, string providerId, string location, string resourceName, CurrentQuotaLimitBase createQuotaRequest, string ifMatch) - { - return operations.BeginUpdateAsync(subscriptionId, providerId, location, resourceName, createQuotaRequest, ifMatch).GetAwaiter().GetResult(); - } - - /// - /// Submits a Quota Request for a resource provider at the specified location - /// for the specific resource in the parameter. - /// - /// - /// Submits Quota change request for a resource provider for the specified - /// location for the specific resource in the parameter. To use, first make a - /// Get request to get quota information for the specific resource. This - /// information consists of information regarding that specific resources. For - /// the specific resource, if it requires an update to the quota, update the - /// limit field in the response from the Get request to the new value of quota. - /// Then, submit this updated JSON object to this quota request API. This will - /// update the quota to the value specified. The location header in the - /// response will be used to track the status of the quota request. Please - /// check the provisioningState field in the response. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Azure subscription id. - /// - /// - /// Azure resource Provider id. - /// - /// - /// Azure region. - /// - /// - /// The Resource name for the specific resource provider, such as SKU name for - /// Microsoft.Compute, pool for Microsoft.Batch. - /// - /// - /// Quota requests payload. - /// - /// - /// ETag of the Entity. ETag should match the current entity state from the - /// header response of the GET request or it should be * for unconditional - /// update. - /// - /// - /// The cancellation token. - /// - public static async Task BeginUpdateAsync(this IQuotaRequestOperations operations, string subscriptionId, string providerId, string location, string resourceName, CurrentQuotaLimitBase createQuotaRequest, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(subscriptionId, providerId, location, resourceName, createQuotaRequest, ifMatch, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/QuotaRequestsOperations.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/QuotaRequestStatusOperations.cs similarity index 96% rename from sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/QuotaRequestsOperations.cs rename to sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/QuotaRequestStatusOperations.cs index fef97f23bf33..973ea49592e7 100644 --- a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/QuotaRequestsOperations.cs +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/QuotaRequestStatusOperations.cs @@ -23,12 +23,12 @@ namespace Microsoft.Azure.Management.Reservations using System.Threading.Tasks; /// - /// QuotaRequestsOperations operations. + /// QuotaRequestStatusOperations operations. /// - internal partial class QuotaRequestsOperations : IServiceOperations, IQuotaRequestsOperations + internal partial class QuotaRequestStatusOperations : IServiceOperations, IQuotaRequestStatusOperations { /// - /// Initializes a new instance of the QuotaRequestsOperations class. + /// Initializes a new instance of the QuotaRequestStatusOperations class. /// /// /// Reference to the service client. @@ -36,7 +36,7 @@ internal partial class QuotaRequestsOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal QuotaRequestsOperations(AzureReservationAPIClient client) + internal QuotaRequestStatusOperations(AzureReservationAPIClient client) { if (client == null) { @@ -92,7 +92,7 @@ internal QuotaRequestsOperations(AzureReservationAPIClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetStatusWithHttpMessagesAsync(string subscriptionId, string providerId, string location, string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string subscriptionId, string providerId, string location, string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (subscriptionId == null) { @@ -124,7 +124,7 @@ internal QuotaRequestsOperations(AzureReservationAPIClient client) tracingParameters.Add("location", location); tracingParameters.Add("id", id); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetStatus", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -314,7 +314,7 @@ internal QuotaRequestsOperations(AzureReservationAPIClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListStatusWithHttpMessagesAsync(string subscriptionId, string providerId, string location, string filter = default(string), int? top = default(int?), string skiptoken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(string subscriptionId, string providerId, string location, string filter = default(string), int? top = default(int?), string skiptoken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (subscriptionId == null) { @@ -348,7 +348,7 @@ internal QuotaRequestsOperations(AzureReservationAPIClient client) tracingParameters.Add("top", top); tracingParameters.Add("skiptoken", skiptoken); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListStatus", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -528,7 +528,7 @@ internal QuotaRequestsOperations(AzureReservationAPIClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListStatusNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -543,7 +543,7 @@ internal QuotaRequestsOperations(AzureReservationAPIClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListStatusNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/QuotaRequestsOperationsExtensions.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/QuotaRequestStatusOperationsExtensions.cs similarity index 80% rename from sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/QuotaRequestsOperationsExtensions.cs rename to sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/QuotaRequestStatusOperationsExtensions.cs index b6d58952a7e6..ea5158cfd6ad 100644 --- a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/QuotaRequestsOperationsExtensions.cs +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/QuotaRequestStatusOperationsExtensions.cs @@ -17,9 +17,9 @@ namespace Microsoft.Azure.Management.Reservations using System.Threading.Tasks; /// - /// Extension methods for QuotaRequestsOperations. + /// Extension methods for QuotaRequestStatusOperations. /// - public static partial class QuotaRequestsOperationsExtensions + public static partial class QuotaRequestStatusOperationsExtensions { /// /// Gets the Quota request status by requestId, for the specified resource @@ -45,9 +45,9 @@ public static partial class QuotaRequestsOperationsExtensions /// /// Quota Request id. /// - public static QuotaRequestDetails GetStatus(this IQuotaRequestsOperations operations, string subscriptionId, string providerId, string location, string id) + public static QuotaRequestDetails Get(this IQuotaRequestStatusOperations operations, string subscriptionId, string providerId, string location, string id) { - return operations.GetStatusAsync(subscriptionId, providerId, location, id).GetAwaiter().GetResult(); + return operations.GetAsync(subscriptionId, providerId, location, id).GetAwaiter().GetResult(); } /// @@ -77,9 +77,9 @@ public static QuotaRequestDetails GetStatus(this IQuotaRequestsOperations operat /// /// The cancellation token. /// - public static async Task GetStatusAsync(this IQuotaRequestsOperations operations, string subscriptionId, string providerId, string location, string id, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IQuotaRequestStatusOperations operations, string subscriptionId, string providerId, string location, string id, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetStatusWithHttpMessagesAsync(subscriptionId, providerId, location, id, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(subscriptionId, providerId, location, id, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -123,9 +123,9 @@ public static QuotaRequestDetails GetStatus(this IQuotaRequestsOperations operat /// nextLink element will include a skiptoken parameter that specifies a /// starting point to use for subsequent calls /// - public static IPage ListStatus(this IQuotaRequestsOperations operations, string subscriptionId, string providerId, string location, string filter = default(string), int? top = default(int?), string skiptoken = default(string)) + public static IPage List(this IQuotaRequestStatusOperations operations, string subscriptionId, string providerId, string location, string filter = default(string), int? top = default(int?), string skiptoken = default(string)) { - return operations.ListStatusAsync(subscriptionId, providerId, location, filter, top, skiptoken).GetAwaiter().GetResult(); + return operations.ListAsync(subscriptionId, providerId, location, filter, top, skiptoken).GetAwaiter().GetResult(); } /// @@ -169,9 +169,9 @@ public static QuotaRequestDetails GetStatus(this IQuotaRequestsOperations operat /// /// The cancellation token. /// - public static async Task> ListStatusAsync(this IQuotaRequestsOperations operations, string subscriptionId, string providerId, string location, string filter = default(string), int? top = default(int?), string skiptoken = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this IQuotaRequestStatusOperations operations, string subscriptionId, string providerId, string location, string filter = default(string), int? top = default(int?), string skiptoken = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListStatusWithHttpMessagesAsync(subscriptionId, providerId, location, filter, top, skiptoken, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListWithHttpMessagesAsync(subscriptionId, providerId, location, filter, top, skiptoken, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -194,9 +194,9 @@ public static QuotaRequestDetails GetStatus(this IQuotaRequestsOperations operat /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListStatusNext(this IQuotaRequestsOperations operations, string nextPageLink) + public static IPage ListNext(this IQuotaRequestStatusOperations operations, string nextPageLink) { - return operations.ListStatusNextAsync(nextPageLink).GetAwaiter().GetResult(); + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// @@ -219,9 +219,9 @@ public static IPage ListStatusNext(this IQuotaRequestsOpera /// /// The cancellation token. /// - public static async Task> ListStatusNextAsync(this IQuotaRequestsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListNextAsync(this IQuotaRequestStatusOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListStatusNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/QuotasOperations.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/QuotasOperations.cs deleted file mode 100644 index e83fbbecc2c5..000000000000 --- a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/QuotasOperations.cs +++ /dev/null @@ -1,453 +0,0 @@ -// -// 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.Reservations -{ - 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; - - /// - /// QuotasOperations operations. - /// - internal partial class QuotasOperations : IServiceOperations, IQuotasOperations - { - /// - /// Initializes a new instance of the QuotasOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal QuotasOperations(AzureReservationAPIClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the AzureReservationAPIClient - /// - public AzureReservationAPIClient Client { get; private set; } - - /// - /// Gets the current quota limit and usages for all the resources by the - /// resource provider at the specified location. - /// - /// - /// This API gets the current quota limits and usages for the resource provider - /// for the specified location. This response can be used to submit - /// quotaRequests. - /// - /// - /// Azure subscription id. - /// - /// - /// Azure resource Provider id. - /// - /// - /// Azure region. - /// - /// - /// 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,QuotasListStatusHeaders>> ListStatusWithHttpMessagesAsync(string subscriptionId, string providerId, string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (subscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "subscriptionId"); - } - if (providerId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "providerId"); - } - if (location == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "location"); - } - string apiVersion = "2019-07-19-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("subscriptionId", subscriptionId); - tracingParameters.Add("providerId", providerId); - tracingParameters.Add("location", location); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListStatus", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(subscriptionId)); - _url = _url.Replace("{providerId}", System.Uri.EscapeDataString(providerId)); - _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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,QuotasListStatusHeaders>(); - _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; - } - - /// - /// Gets the current quota limit and usages for all the resources by the - /// resource provider at the specified location. - /// - /// - /// This API gets the current quota limits and usages for the resource provider - /// for the specified location. This response can be used to submit - /// quotaRequests. - /// - /// - /// 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,QuotasListStatusHeaders>> ListStatusNextWithHttpMessagesAsync(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, "ListStatusNext", 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,QuotasListStatusHeaders>(); - _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/reservations/Microsoft.Azure.Management.Reservations/src/Generated/QuotasOperationsExtensions.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/QuotasOperationsExtensions.cs deleted file mode 100644 index 0e8a52509112..000000000000 --- a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/QuotasOperationsExtensions.cs +++ /dev/null @@ -1,129 +0,0 @@ -// -// 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.Reservations -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for QuotasOperations. - /// - public static partial class QuotasOperationsExtensions - { - /// - /// Gets the current quota limit and usages for all the resources by the - /// resource provider at the specified location. - /// - /// - /// This API gets the current quota limits and usages for the resource provider - /// for the specified location. This response can be used to submit - /// quotaRequests. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Azure subscription id. - /// - /// - /// Azure resource Provider id. - /// - /// - /// Azure region. - /// - public static IPage ListStatus(this IQuotasOperations operations, string subscriptionId, string providerId, string location) - { - return operations.ListStatusAsync(subscriptionId, providerId, location).GetAwaiter().GetResult(); - } - - /// - /// Gets the current quota limit and usages for all the resources by the - /// resource provider at the specified location. - /// - /// - /// This API gets the current quota limits and usages for the resource provider - /// for the specified location. This response can be used to submit - /// quotaRequests. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Azure subscription id. - /// - /// - /// Azure resource Provider id. - /// - /// - /// Azure region. - /// - /// - /// The cancellation token. - /// - public static async Task> ListStatusAsync(this IQuotasOperations operations, string subscriptionId, string providerId, string location, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListStatusWithHttpMessagesAsync(subscriptionId, providerId, location, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets the current quota limit and usages for all the resources by the - /// resource provider at the specified location. - /// - /// - /// This API gets the current quota limits and usages for the resource provider - /// for the specified location. This response can be used to submit - /// quotaRequests. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListStatusNext(this IQuotasOperations operations, string nextPageLink) - { - return operations.ListStatusNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Gets the current quota limit and usages for all the resources by the - /// resource provider at the specified location. - /// - /// - /// This API gets the current quota limits and usages for the resource provider - /// for the specified location. This response can be used to submit - /// quotaRequests. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListStatusNextAsync(this IQuotasOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListStatusNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/SdkInfo_AzureReservationAPI.cs b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/SdkInfo_AzureReservationAPI.cs index 3c3805bec35d..481a259e1a4e 100644 --- a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/SdkInfo_AzureReservationAPI.cs +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/Generated/SdkInfo_AzureReservationAPI.cs @@ -24,9 +24,7 @@ public static IEnumerable> ApiInfo_AzureReservatio new Tuple("Capacity", "GetCatalog", "2019-04-01"), new Tuple("Capacity", "Operation", "2019-04-01"), new Tuple("Capacity", "Quota", "2019-07-19-preview"), - new Tuple("Capacity", "QuotaRequest", "2019-07-19-preview"), - new Tuple("Capacity", "QuotaRequests", "2019-07-19-preview"), - new Tuple("Capacity", "Quotas", "2019-07-19-preview"), + new Tuple("Capacity", "QuotaRequestStatus", "2019-07-19-preview"), new Tuple("Capacity", "Reservation", "2019-04-01"), new Tuple("Capacity", "ReservationOrder", "2019-04-01"), }.AsEnumerable(); diff --git a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/generate.ps1 b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/generate.ps1 index ef44eea0e0d7..c318b23175f0 100644 --- a/sdk/reservations/Microsoft.Azure.Management.Reservations/src/generate.ps1 +++ b/sdk/reservations/Microsoft.Azure.Management.Reservations/src/generate.ps1 @@ -1 +1 @@ -Start-AutoRestCodeGeneration -ResourceProvider "reservations/resource-manager" -AutoRestVersion "latest" \ No newline at end of file +Start-AutoRestCodeGeneration -ResourceProvider "reservations/resource-manager" -AutoRestVersion "v2" \ No newline at end of file