From ec249191201899788c9f3e122c648ec58c0df640 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 1 Jul 2021 06:31:52 +0000 Subject: [PATCH] CodeGen from PR 15047 in Azure/azure-rest-api-specs Remove files from package which are not part of management plane SDK - update readme.md (#15047) * Update readme.md * Update readme.md --- .../Generated/IKeyVaultManagementClient.cs | 23 +- ...HSMPrivateEndpointConnectionsOperations.cs | 199 +++ .../IMHSMPrivateLinkResourcesOperations.cs | 52 + .../src/Generated/IManagedHsmsOperations.cs | 112 ++ .../IPrivateEndpointConnectionsOperations.cs | 49 + .../src/Generated/IVaultsOperations.cs | 6 + .../src/Generated/KeyVaultManagementClient.cs | 28 +- ...HSMPrivateEndpointConnectionsOperations.cs | 1098 +++++++++++++++++ ...EndpointConnectionsOperationsExtensions.cs | 309 +++++ .../MHSMPrivateLinkResourcesOperations.cs | 250 ++++ ...rivateLinkResourcesOperationsExtensions.cs | 65 + .../src/Generated/ManagedHsmsOperations.cs | 1038 +++++++++++++--- .../ManagedHsmsOperationsExtensions.cs | 180 +++ .../src/Generated/Models/ActionsRequired.cs | 21 + .../Models/CertificatePermissions.cs | 1 - .../src/Generated/Models/DeletedManagedHsm.cs | 76 ++ .../Models/DeletedManagedHsmProperties.cs | 98 ++ .../Models/DeletedVaultProperties.cs | 11 +- .../Generated/Models/DimensionProperties.cs | 69 ++ .../src/Generated/Models/IdentityType.cs | 24 + .../src/Generated/Models/KeyPermissions.cs | 2 +- .../src/Generated/Models/MHSMIPRule.cs | 70 ++ .../Generated/Models/MHSMNetworkRuleSet.cs | 90 ++ .../Generated/Models/MHSMPrivateEndpoint.cs | 52 + .../Models/MHSMPrivateEndpointConnection.cs | 90 ++ .../MHSMPrivateEndpointConnectionItem.cs | 79 ++ ...PrivateEndpointConnectionsDeleteHeaders.cs | 64 + ...HSMPrivateEndpointConnectionsPutHeaders.cs | 70 ++ .../Models/MHSMPrivateLinkResource.cs | 96 ++ .../MHSMPrivateLinkResourceListResult.cs | 55 + .../MHSMPrivateLinkServiceConnectionState.cs | 80 ++ .../Models/MHSMVirtualNetworkRule.cs | 68 + .../src/Generated/Models/ManagedHsm.cs | 4 +- .../Generated/Models/ManagedHsmProperties.cs | 49 +- .../Generated/Models/ManagedHsmResource.cs | 8 +- .../Generated/Models/MetricSpecification.cs | 143 +++ .../src/Generated/Models/Operation.cs | 12 +- .../Models/PrivateEndpointConnection.cs | 12 +- .../Models/PrivateEndpointConnectionItem.cs | 20 +- .../PrivateLinkServiceConnectionState.cs | 16 +- .../Generated/Models/PublicNetworkAccess.cs | 22 + .../src/Generated/Models/SecretPermissions.cs | 1 - .../Generated/Models/ServiceSpecification.cs | 11 +- .../Generated/Models/StoragePermissions.cs | 1 - .../src/Generated/Models/SystemData.cs | 107 ++ .../src/Generated/Models/Vault.cs | 10 +- .../src/Generated/Models/VaultProperties.cs | 21 +- .../Models/VaultProvisioningState.cs | 22 + .../Generated/Models/VirtualNetworkRule.cs | 13 +- .../src/Generated/Operations.cs | 16 +- .../PrivateEndpointConnectionsOperations.cs | 410 +++++- ...EndpointConnectionsOperationsExtensions.cs | 78 ++ .../PrivateLinkResourcesOperations.cs | 10 +- .../SdkInfo_KeyVaultManagementClient.cs | 25 +- .../src/Generated/VaultsOperations.cs | 153 ++- 55 files changed, 5420 insertions(+), 269 deletions(-) create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IMHSMPrivateEndpointConnectionsOperations.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IMHSMPrivateLinkResourcesOperations.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/MHSMPrivateEndpointConnectionsOperations.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/MHSMPrivateEndpointConnectionsOperationsExtensions.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/MHSMPrivateLinkResourcesOperations.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/MHSMPrivateLinkResourcesOperationsExtensions.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ActionsRequired.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/DeletedManagedHsm.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/DeletedManagedHsmProperties.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/DimensionProperties.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/IdentityType.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMIPRule.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMNetworkRuleSet.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMPrivateEndpoint.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMPrivateEndpointConnection.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMPrivateEndpointConnectionItem.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMPrivateEndpointConnectionsDeleteHeaders.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMPrivateEndpointConnectionsPutHeaders.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMPrivateLinkResource.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMPrivateLinkResourceListResult.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMPrivateLinkServiceConnectionState.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMVirtualNetworkRule.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MetricSpecification.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PublicNetworkAccess.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SystemData.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/VaultProvisioningState.cs diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IKeyVaultManagementClient.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IKeyVaultManagementClient.cs index f3de174aee621..1e2109012fb92 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IKeyVaultManagementClient.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IKeyVaultManagementClient.cs @@ -48,6 +48,11 @@ public partial interface IKeyVaultManagementClient : System.IDisposable /// string SubscriptionId { get; set; } + /// + /// Client Api Version. + /// + string ApiVersion { get; } + /// /// The preferred language for the response. /// @@ -83,14 +88,24 @@ public partial interface IKeyVaultManagementClient : System.IDisposable IPrivateLinkResourcesOperations PrivateLinkResources { get; } /// - /// Gets the IOperations. + /// Gets the IManagedHsmsOperations. /// - IOperations Operations { get; } + IManagedHsmsOperations ManagedHsms { get; } /// - /// Gets the IManagedHsmsOperations. + /// Gets the IMHSMPrivateEndpointConnectionsOperations. /// - IManagedHsmsOperations ManagedHsms { get; } + IMHSMPrivateEndpointConnectionsOperations MHSMPrivateEndpointConnections { get; } + + /// + /// Gets the IMHSMPrivateLinkResourcesOperations. + /// + IMHSMPrivateLinkResourcesOperations MHSMPrivateLinkResources { get; } + + /// + /// Gets the IOperations. + /// + IOperations Operations { get; } } } diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IMHSMPrivateEndpointConnectionsOperations.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IMHSMPrivateEndpointConnectionsOperations.cs new file mode 100644 index 0000000000000..a7ce081fb2836 --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IMHSMPrivateEndpointConnectionsOperations.cs @@ -0,0 +1,199 @@ +// +// 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.KeyVault +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// MHSMPrivateEndpointConnectionsOperations operations. + /// + public partial interface IMHSMPrivateEndpointConnectionsOperations + { + /// + /// The List operation gets information about the private endpoint + /// connections associated with the managed HSM Pool. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Name of the managed HSM Pool + /// + /// + /// 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>> ListByResourceWithHttpMessagesAsync(string resourceGroupName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the specified private endpoint connection associated with the + /// managed HSM Pool. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Name of the managed HSM Pool + /// + /// + /// Name of the private endpoint connection associated with the managed + /// hsm pool. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string name, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates the specified private endpoint connection associated with + /// the managed hsm pool. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Name of the managed HSM Pool + /// + /// + /// Name of the private endpoint connection associated with the managed + /// hsm pool. + /// + /// + /// The intended state of private endpoint connection. + /// + /// + /// 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> PutWithHttpMessagesAsync(string resourceGroupName, string name, string privateEndpointConnectionName, MHSMPrivateEndpointConnection properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the specified private endpoint connection associated with + /// the managed hsm pool. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Name of the managed HSM Pool + /// + /// + /// Name of the private endpoint connection associated with the managed + /// hsm pool. + /// + /// + /// 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> DeleteWithHttpMessagesAsync(string resourceGroupName, string name, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the specified private endpoint connection associated with + /// the managed hsm pool. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Name of the managed HSM Pool + /// + /// + /// Name of the private endpoint connection associated with the managed + /// hsm pool. + /// + /// + /// 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> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string name, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The List operation gets information about the private endpoint + /// connections associated with the managed HSM Pool. + /// + /// + /// 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>> ListByResourceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IMHSMPrivateLinkResourcesOperations.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IMHSMPrivateLinkResourcesOperations.cs new file mode 100644 index 0000000000000..26caed2c0466a --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IMHSMPrivateLinkResourcesOperations.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KeyVault +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// MHSMPrivateLinkResourcesOperations operations. + /// + public partial interface IMHSMPrivateLinkResourcesOperations + { + /// + /// Gets the private link resources supported for the managed hsm pool. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Name of the managed HSM Pool + /// + /// + /// 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> ListByMHSMResourceWithHttpMessagesAsync(string resourceGroupName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IManagedHsmsOperations.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IManagedHsmsOperations.cs index 0d326629baf74..6e619810db768 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IManagedHsmsOperations.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IManagedHsmsOperations.cs @@ -177,6 +177,73 @@ public partial interface IManagedHsmsOperations /// Task>> ListBySubscriptionWithHttpMessagesAsync(int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// The List operation gets information about the deleted managed HSMs + /// associated with the subscription. + /// + /// + /// 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>> ListDeletedWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the specified deleted managed HSM. + /// + /// + /// The name of the deleted managed HSM. + /// + /// + /// The location of the deleted managed HSM. + /// + /// + /// 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> GetDeletedWithHttpMessagesAsync(string name, string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Permanently deletes the specified managed HSM. + /// + /// + /// The name of the soft-deleted managed HSM. + /// + /// + /// The location of the soft-deleted managed HSM. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task PurgeDeletedWithHttpMessagesAsync(string name, string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Create or update a managed HSM Pool in the specified subscription. /// /// @@ -255,6 +322,28 @@ public partial interface IManagedHsmsOperations /// Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Permanently deletes the specified managed HSM. + /// + /// + /// The name of the soft-deleted managed HSM. + /// + /// + /// The location of the soft-deleted managed HSM. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginPurgeDeletedWithHttpMessagesAsync(string name, string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// The List operation gets information about the managed HSM Pools /// associated with the subscription and within the specified resource /// group. @@ -301,5 +390,28 @@ public partial interface IManagedHsmsOperations /// Thrown when a required parameter is null /// Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The List operation gets information about the deleted managed HSMs + /// associated with the subscription. + /// + /// + /// 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>> ListDeletedNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IPrivateEndpointConnectionsOperations.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IPrivateEndpointConnectionsOperations.cs index d71345f8e4914..c0b133434d083 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IPrivateEndpointConnectionsOperations.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IPrivateEndpointConnectionsOperations.cs @@ -117,6 +117,32 @@ public partial interface IPrivateEndpointConnectionsOperations /// Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string vaultName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// The List operation gets information about the private endpoint + /// connections associated with the vault. + /// + /// + /// Name of the resource group that contains the key vault. + /// + /// + /// The name of the key vault. + /// + /// + /// 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>> ListByResourceWithHttpMessagesAsync(string resourceGroupName, string vaultName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Deletes the specified private endpoint connection associated with /// the key vault. /// @@ -146,5 +172,28 @@ public partial interface IPrivateEndpointConnectionsOperations /// Thrown when a required parameter is null /// Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string vaultName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The List operation gets information about the private endpoint + /// connections associated with the vault. + /// + /// + /// 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>> ListByResourceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IVaultsOperations.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IVaultsOperations.cs index 6db3cb92976b5..f97617486ad8b 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IVaultsOperations.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IVaultsOperations.cs @@ -271,6 +271,9 @@ public partial interface IVaultsOperations /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -367,6 +370,9 @@ public partial interface IVaultsOperations /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/KeyVaultManagementClient.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/KeyVaultManagementClient.cs index 5445b99956e7e..784dbec737646 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/KeyVaultManagementClient.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/KeyVaultManagementClient.cs @@ -54,6 +54,11 @@ public partial class KeyVaultManagementClient : ServiceClient public string SubscriptionId { get; set; } + /// + /// Client Api Version. + /// + public string ApiVersion { get; private set; } + /// /// The preferred language for the response. /// @@ -88,14 +93,24 @@ public partial class KeyVaultManagementClient : ServiceClient - /// Gets the IOperations. + /// Gets the IManagedHsmsOperations. /// - public virtual IOperations Operations { get; private set; } + public virtual IManagedHsmsOperations ManagedHsms { get; private set; } /// - /// Gets the IManagedHsmsOperations. + /// Gets the IMHSMPrivateEndpointConnectionsOperations. /// - public virtual IManagedHsmsOperations ManagedHsms { get; private set; } + public virtual IMHSMPrivateEndpointConnectionsOperations MHSMPrivateEndpointConnections { get; private set; } + + /// + /// Gets the IMHSMPrivateLinkResourcesOperations. + /// + public virtual IMHSMPrivateLinkResourcesOperations MHSMPrivateLinkResources { get; private set; } + + /// + /// Gets the IOperations. + /// + public virtual IOperations Operations { get; private set; } /// /// Initializes a new instance of the KeyVaultManagementClient class. @@ -341,9 +356,12 @@ private void Initialize() Vaults = new VaultsOperations(this); PrivateEndpointConnections = new PrivateEndpointConnectionsOperations(this); PrivateLinkResources = new PrivateLinkResourcesOperations(this); - Operations = new Operations(this); ManagedHsms = new ManagedHsmsOperations(this); + MHSMPrivateEndpointConnections = new MHSMPrivateEndpointConnectionsOperations(this); + MHSMPrivateLinkResources = new MHSMPrivateLinkResourcesOperations(this); + Operations = new Operations(this); BaseUri = new System.Uri("https://management.azure.com"); + ApiVersion = "2021-04-01-preview"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/MHSMPrivateEndpointConnectionsOperations.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/MHSMPrivateEndpointConnectionsOperations.cs new file mode 100644 index 0000000000000..24377d6cc25fb --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/MHSMPrivateEndpointConnectionsOperations.cs @@ -0,0 +1,1098 @@ +// +// 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.KeyVault +{ + 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; + + /// + /// MHSMPrivateEndpointConnectionsOperations operations. + /// + internal partial class MHSMPrivateEndpointConnectionsOperations : IServiceOperations, IMHSMPrivateEndpointConnectionsOperations + { + /// + /// Initializes a new instance of the MHSMPrivateEndpointConnectionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal MHSMPrivateEndpointConnectionsOperations(KeyVaultManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the KeyVaultManagementClient + /// + public KeyVaultManagementClient Client { get; private set; } + + /// + /// The List operation gets information about the private endpoint connections + /// associated with the managed HSM Pool. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Name of the managed HSM Pool + /// + /// + /// 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>> ListByResourceWithHttpMessagesAsync(string resourceGroupName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("name", name); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResource", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ManagedHsmErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ManagedHsmError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the specified private endpoint connection associated with the managed + /// HSM Pool. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Name of the managed HSM Pool + /// + /// + /// Name of the private endpoint connection associated with the managed hsm + /// pool. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string name, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (privateEndpointConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("name", name); + tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ManagedHsmErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ManagedHsmError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates the specified private endpoint connection associated with the + /// managed hsm pool. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Name of the managed HSM Pool + /// + /// + /// Name of the private endpoint connection associated with the managed hsm + /// pool. + /// + /// + /// The intended state of private endpoint connection. + /// + /// + /// 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> PutWithHttpMessagesAsync(string resourceGroupName, string name, string privateEndpointConnectionName, MHSMPrivateEndpointConnection properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (privateEndpointConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "properties"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("name", name); + tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); + tracingParameters.Add("properties", properties); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Put", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(properties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(properties, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes the specified private endpoint connection associated with the + /// managed hsm pool. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Name of the managed HSM Pool + /// + /// + /// Name of the private endpoint connection associated with the managed hsm + /// pool. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string name, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, name, privateEndpointConnectionName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes the specified private endpoint connection associated with the + /// managed hsm pool. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Name of the managed HSM Pool + /// + /// + /// Name of the private endpoint connection associated with the managed hsm + /// pool. + /// + /// + /// 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> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string name, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (privateEndpointConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("name", name); + tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The List operation gets information about the private endpoint connections + /// associated with the managed HSM Pool. + /// + /// + /// 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>> ListByResourceNextWithHttpMessagesAsync(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, "ListByResourceNext", 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 ManagedHsmErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ManagedHsmError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/MHSMPrivateEndpointConnectionsOperationsExtensions.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/MHSMPrivateEndpointConnectionsOperationsExtensions.cs new file mode 100644 index 0000000000000..ac29fa78f68f6 --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/MHSMPrivateEndpointConnectionsOperationsExtensions.cs @@ -0,0 +1,309 @@ +// +// 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.KeyVault +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for MHSMPrivateEndpointConnectionsOperations. + /// + public static partial class MHSMPrivateEndpointConnectionsOperationsExtensions + { + /// + /// The List operation gets information about the private endpoint connections + /// associated with the managed HSM Pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Name of the managed HSM Pool + /// + public static IPage ListByResource(this IMHSMPrivateEndpointConnectionsOperations operations, string resourceGroupName, string name) + { + return operations.ListByResourceAsync(resourceGroupName, name).GetAwaiter().GetResult(); + } + + /// + /// The List operation gets information about the private endpoint connections + /// associated with the managed HSM Pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Name of the managed HSM Pool + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceAsync(this IMHSMPrivateEndpointConnectionsOperations operations, string resourceGroupName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceWithHttpMessagesAsync(resourceGroupName, name, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the specified private endpoint connection associated with the managed + /// HSM Pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Name of the managed HSM Pool + /// + /// + /// Name of the private endpoint connection associated with the managed hsm + /// pool. + /// + public static MHSMPrivateEndpointConnection Get(this IMHSMPrivateEndpointConnectionsOperations operations, string resourceGroupName, string name, string privateEndpointConnectionName) + { + return operations.GetAsync(resourceGroupName, name, privateEndpointConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Gets the specified private endpoint connection associated with the managed + /// HSM Pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Name of the managed HSM Pool + /// + /// + /// Name of the private endpoint connection associated with the managed hsm + /// pool. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IMHSMPrivateEndpointConnectionsOperations operations, string resourceGroupName, string name, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, name, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates the specified private endpoint connection associated with the + /// managed hsm pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Name of the managed HSM Pool + /// + /// + /// Name of the private endpoint connection associated with the managed hsm + /// pool. + /// + /// + /// The intended state of private endpoint connection. + /// + public static MHSMPrivateEndpointConnection Put(this IMHSMPrivateEndpointConnectionsOperations operations, string resourceGroupName, string name, string privateEndpointConnectionName, MHSMPrivateEndpointConnection properties) + { + return operations.PutAsync(resourceGroupName, name, privateEndpointConnectionName, properties).GetAwaiter().GetResult(); + } + + /// + /// Updates the specified private endpoint connection associated with the + /// managed hsm pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Name of the managed HSM Pool + /// + /// + /// Name of the private endpoint connection associated with the managed hsm + /// pool. + /// + /// + /// The intended state of private endpoint connection. + /// + /// + /// The cancellation token. + /// + public static async Task PutAsync(this IMHSMPrivateEndpointConnectionsOperations operations, string resourceGroupName, string name, string privateEndpointConnectionName, MHSMPrivateEndpointConnection properties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PutWithHttpMessagesAsync(resourceGroupName, name, privateEndpointConnectionName, properties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the specified private endpoint connection associated with the + /// managed hsm pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Name of the managed HSM Pool + /// + /// + /// Name of the private endpoint connection associated with the managed hsm + /// pool. + /// + public static MHSMPrivateEndpointConnection Delete(this IMHSMPrivateEndpointConnectionsOperations operations, string resourceGroupName, string name, string privateEndpointConnectionName) + { + return operations.DeleteAsync(resourceGroupName, name, privateEndpointConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the specified private endpoint connection associated with the + /// managed hsm pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Name of the managed HSM Pool + /// + /// + /// Name of the private endpoint connection associated with the managed hsm + /// pool. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IMHSMPrivateEndpointConnectionsOperations operations, string resourceGroupName, string name, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceGroupName, name, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the specified private endpoint connection associated with the + /// managed hsm pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Name of the managed HSM Pool + /// + /// + /// Name of the private endpoint connection associated with the managed hsm + /// pool. + /// + public static MHSMPrivateEndpointConnection BeginDelete(this IMHSMPrivateEndpointConnectionsOperations operations, string resourceGroupName, string name, string privateEndpointConnectionName) + { + return operations.BeginDeleteAsync(resourceGroupName, name, privateEndpointConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the specified private endpoint connection associated with the + /// managed hsm pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Name of the managed HSM Pool + /// + /// + /// Name of the private endpoint connection associated with the managed hsm + /// pool. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IMHSMPrivateEndpointConnectionsOperations operations, string resourceGroupName, string name, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, name, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The List operation gets information about the private endpoint connections + /// associated with the managed HSM Pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceNext(this IMHSMPrivateEndpointConnectionsOperations operations, string nextPageLink) + { + return operations.ListByResourceNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// The List operation gets information about the private endpoint connections + /// associated with the managed HSM Pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceNextAsync(this IMHSMPrivateEndpointConnectionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/MHSMPrivateLinkResourcesOperations.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/MHSMPrivateLinkResourcesOperations.cs new file mode 100644 index 0000000000000..6fb4db165bca3 --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/MHSMPrivateLinkResourcesOperations.cs @@ -0,0 +1,250 @@ +// +// 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.KeyVault +{ + 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; + + /// + /// MHSMPrivateLinkResourcesOperations operations. + /// + internal partial class MHSMPrivateLinkResourcesOperations : IServiceOperations, IMHSMPrivateLinkResourcesOperations + { + /// + /// Initializes a new instance of the MHSMPrivateLinkResourcesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal MHSMPrivateLinkResourcesOperations(KeyVaultManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the KeyVaultManagementClient + /// + public KeyVaultManagementClient Client { get; private set; } + + /// + /// Gets the private link resources supported for the managed hsm pool. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Name of the managed HSM Pool + /// + /// + /// 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> ListByMHSMResourceWithHttpMessagesAsync(string resourceGroupName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("name", name); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByMHSMResource", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateLinkResources").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/MHSMPrivateLinkResourcesOperationsExtensions.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/MHSMPrivateLinkResourcesOperationsExtensions.cs new file mode 100644 index 0000000000000..0f58e3d91702d --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/MHSMPrivateLinkResourcesOperationsExtensions.cs @@ -0,0 +1,65 @@ +// +// 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.KeyVault +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for MHSMPrivateLinkResourcesOperations. + /// + public static partial class MHSMPrivateLinkResourcesOperationsExtensions + { + /// + /// Gets the private link resources supported for the managed hsm pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Name of the managed HSM Pool + /// + public static MHSMPrivateLinkResourceListResult ListByMHSMResource(this IMHSMPrivateLinkResourcesOperations operations, string resourceGroupName, string name) + { + return operations.ListByMHSMResourceAsync(resourceGroupName, name).GetAwaiter().GetResult(); + } + + /// + /// Gets the private link resources supported for the managed hsm pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Name of the managed HSM Pool + /// + /// + /// The cancellation token. + /// + public static async Task ListByMHSMResourceAsync(this IMHSMPrivateLinkResourcesOperations operations, string resourceGroupName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByMHSMResourceWithHttpMessagesAsync(resourceGroupName, name, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/ManagedHsmsOperations.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/ManagedHsmsOperations.cs index eb4f7bb6f55fb..c42ca48c6aaa7 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/ManagedHsmsOperations.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/ManagedHsmsOperations.cs @@ -162,11 +162,14 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "name"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-04-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -176,7 +179,6 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("name", name); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -187,9 +189,9 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -249,7 +251,7 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) { var ex = new ManagedHsmErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -348,11 +350,14 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-04-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -362,7 +367,6 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("top", top); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); } @@ -376,9 +380,9 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) { _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -530,11 +534,14 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) /// public async Task>> ListBySubscriptionWithHttpMessagesAsync(int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-04-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -543,7 +550,6 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("top", top); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); } @@ -556,9 +562,9 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) { _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -681,17 +687,9 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) } /// - /// Create or update a managed HSM Pool in the specified subscription. + /// The List operation gets information about the deleted managed HSMs + /// associated with the subscription. /// - /// - /// Name of the resource group that contains the managed HSM pool. - /// - /// - /// Name of the managed HSM Pool - /// - /// - /// Parameters to create or update the managed HSM Pool - /// /// /// Headers that will be added to request. /// @@ -713,29 +711,16 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string name, ManagedHsm parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListDeletedWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - if (parameters != null) + if (Client.ApiVersion == null) { - parameters.Validate(); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-04-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -743,23 +728,17 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("name", name); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListDeleted", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedManagedHSMs").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -768,7 +747,7 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -799,12 +778,6 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) // Serialize Request string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -825,7 +798,7 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202) + if ((int)_statusCode != 200) { var ex = new ManagedHsmErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -855,7 +828,7 @@ internal ManagedHsmsOperations(KeyVaultManagementClient 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")) @@ -868,25 +841,7 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - // Deserialize Response - if ((int)_statusCode == 202) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -906,16 +861,13 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) } /// - /// Update a managed HSM Pool in the specified subscription. + /// Gets the specified deleted managed HSM. /// - /// - /// Name of the resource group that contains the managed HSM pool. - /// /// - /// Name of the managed HSM Pool + /// The name of the deleted managed HSM. /// - /// - /// Parameters to patch the managed HSM Pool + /// + /// The location of the deleted managed HSM. /// /// /// Headers that will be added to request. @@ -938,25 +890,24 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string name, ManagedHsm parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetDeletedWithHttpMessagesAsync(string name, string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } if (name == null) { throw new ValidationException(ValidationRules.CannotBeNull, "name"); } - if (parameters == null) + if (location == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-04-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -964,23 +915,21 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("name", name); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("parameters", parameters); + tracingParameters.Add("location", location); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetDeleted", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}").ToString(); _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -989,7 +938,7 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1020,12 +969,6 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) // Serialize Request string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -1046,7 +989,7 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202) + if ((int)_statusCode != 200) { var ex = new ManagedHsmErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1076,7 +1019,7 @@ internal ManagedHsmsOperations(KeyVaultManagementClient 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")) @@ -1089,25 +1032,7 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - // Deserialize Response - if ((int)_statusCode == 202) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1127,13 +1052,38 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) } /// - /// Deletes the specified managed HSM Pool. + /// Permanently deletes the specified managed HSM. + /// + /// + /// The name of the soft-deleted managed HSM. + /// + /// + /// The location of the soft-deleted managed HSM. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task PurgeDeletedWithHttpMessagesAsync(string name, string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginPurgeDeletedWithHttpMessagesAsync(name, location, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Create or update a managed HSM Pool in the specified subscription. /// /// /// Name of the resource group that contains the managed HSM pool. /// /// - /// The name of the managed HSM Pool to delete + /// Name of the managed HSM Pool + /// + /// + /// Parameters to create or update the managed HSM Pool /// /// /// Headers that will be added to request. @@ -1144,6 +1094,9 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -1153,7 +1106,7 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string name, ManagedHsm parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1163,11 +1116,22 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "name"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-04-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1177,9 +1141,9 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("name", name); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -1188,9 +1152,9 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1199,7 +1163,7 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1230,6 +1194,12 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) // Serialize Request string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -1250,7 +1220,7 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + if ((int)_statusCode != 200 && (int)_statusCode != 202) { var ex = new ManagedHsmErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1280,13 +1250,49 @@ internal ManagedHsmsOperations(KeyVaultManagementClient 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")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -1295,11 +1301,16 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) } /// - /// The List operation gets information about the managed HSM Pools associated - /// with the subscription and within the specified resource group. + /// Update a managed HSM Pool in the specified subscription. /// - /// - /// The NextLink from the previous successful call to List operation. + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Name of the managed HSM Pool + /// + /// + /// Parameters to patch the managed HSM Pool /// /// /// Headers that will be added to request. @@ -1322,11 +1333,27 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string name, ManagedHsm parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (nextPageLink == null) + if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -1335,13 +1362,555 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("name", name); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); } // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ManagedHsmErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ManagedHsmError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes the specified managed HSM Pool. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// The name of the managed HSM Pool to delete + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("name", name); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ManagedHsmErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ManagedHsmError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Permanently deletes the specified managed HSM. + /// + /// + /// The name of the soft-deleted managed HSM. + /// + /// + /// The location of the soft-deleted managed HSM. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginPurgeDeletedWithHttpMessagesAsync(string name, string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("name", name); + tracingParameters.Add("location", location); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginPurgeDeleted", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}/purge").ToString(); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 202) + { + var ex = new ManagedHsmErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ManagedHsmError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The List operation gets information about the managed HSM Pools associated + /// with the subscription and within the specified resource group. + /// + /// + /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(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, "ListByResourceGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); List _queryParameters = new List(); if (_queryParameters.Count > 0) { @@ -1632,5 +2201,174 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) return _result; } + /// + /// The List operation gets information about the deleted managed HSMs + /// associated with the subscription. + /// + /// + /// 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>> ListDeletedNextWithHttpMessagesAsync(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, "ListDeletedNext", 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 ManagedHsmErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ManagedHsmError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + } } diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/ManagedHsmsOperationsExtensions.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/ManagedHsmsOperationsExtensions.cs index b58e3160edf31..8f6f72ba2a0a2 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/ManagedHsmsOperationsExtensions.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/ManagedHsmsOperationsExtensions.cs @@ -268,6 +268,113 @@ public static ManagedHsm Get(this IManagedHsmsOperations operations, string reso } } + /// + /// The List operation gets information about the deleted managed HSMs + /// associated with the subscription. + /// + /// + /// The operations group for this extension method. + /// + public static IPage ListDeleted(this IManagedHsmsOperations operations) + { + return operations.ListDeletedAsync().GetAwaiter().GetResult(); + } + + /// + /// The List operation gets information about the deleted managed HSMs + /// associated with the subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListDeletedAsync(this IManagedHsmsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListDeletedWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the specified deleted managed HSM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the deleted managed HSM. + /// + /// + /// The location of the deleted managed HSM. + /// + public static DeletedManagedHsm GetDeleted(this IManagedHsmsOperations operations, string name, string location) + { + return operations.GetDeletedAsync(name, location).GetAwaiter().GetResult(); + } + + /// + /// Gets the specified deleted managed HSM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the deleted managed HSM. + /// + /// + /// The location of the deleted managed HSM. + /// + /// + /// The cancellation token. + /// + public static async Task GetDeletedAsync(this IManagedHsmsOperations operations, string name, string location, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetDeletedWithHttpMessagesAsync(name, location, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Permanently deletes the specified managed HSM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the soft-deleted managed HSM. + /// + /// + /// The location of the soft-deleted managed HSM. + /// + public static void PurgeDeleted(this IManagedHsmsOperations operations, string name, string location) + { + operations.PurgeDeletedAsync(name, location).GetAwaiter().GetResult(); + } + + /// + /// Permanently deletes the specified managed HSM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the soft-deleted managed HSM. + /// + /// + /// The location of the soft-deleted managed HSM. + /// + /// + /// The cancellation token. + /// + public static async Task PurgeDeletedAsync(this IManagedHsmsOperations operations, string name, string location, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.PurgeDeletedWithHttpMessagesAsync(name, location, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// Create or update a managed HSM Pool in the specified subscription. /// @@ -397,6 +504,43 @@ public static void BeginDelete(this IManagedHsmsOperations operations, string re (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// Permanently deletes the specified managed HSM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the soft-deleted managed HSM. + /// + /// + /// The location of the soft-deleted managed HSM. + /// + public static void BeginPurgeDeleted(this IManagedHsmsOperations operations, string name, string location) + { + operations.BeginPurgeDeletedAsync(name, location).GetAwaiter().GetResult(); + } + + /// + /// Permanently deletes the specified managed HSM. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the soft-deleted managed HSM. + /// + /// + /// The location of the soft-deleted managed HSM. + /// + /// + /// The cancellation token. + /// + public static async Task BeginPurgeDeletedAsync(this IManagedHsmsOperations operations, string name, string location, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginPurgeDeletedWithHttpMessagesAsync(name, location, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// The List operation gets information about the managed HSM Pools associated /// with the subscription and within the specified resource group. @@ -469,5 +613,41 @@ public static IPage ListBySubscriptionNext(this IManagedHsmsOperatio } } + /// + /// The List operation gets information about the deleted managed HSMs + /// associated with the subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListDeletedNext(this IManagedHsmsOperations operations, string nextPageLink) + { + return operations.ListDeletedNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// The List operation gets information about the deleted managed HSMs + /// associated with the subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListDeletedNextAsync(this IManagedHsmsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListDeletedNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } } diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ActionsRequired.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ActionsRequired.cs new file mode 100644 index 0000000000000..7025f2f0e13c5 --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ActionsRequired.cs @@ -0,0 +1,21 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KeyVault.Models +{ + + /// + /// Defines values for ActionsRequired. + /// + public static class ActionsRequired + { + public const string None = "None"; + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/CertificatePermissions.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/CertificatePermissions.cs index da3ebb7b9ff8b..e67ca8c27a2b9 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/CertificatePermissions.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/CertificatePermissions.cs @@ -16,7 +16,6 @@ namespace Microsoft.Azure.Management.KeyVault.Models /// public static class CertificatePermissions { - public const string All = "all"; public const string Get = "get"; public const string List = "list"; public const string Delete = "delete"; diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/DeletedManagedHsm.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/DeletedManagedHsm.cs new file mode 100644 index 0000000000000..ba00325b6cceb --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/DeletedManagedHsm.cs @@ -0,0 +1,76 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KeyVault.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class DeletedManagedHsm + { + /// + /// Initializes a new instance of the DeletedManagedHsm class. + /// + public DeletedManagedHsm() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeletedManagedHsm class. + /// + /// The Azure Resource Manager resource ID for the + /// deleted managed HSM Pool. + /// The name of the managed HSM Pool. + /// The resource type of the managed HSM + /// Pool. + /// Properties of the deleted managed + /// HSM + public DeletedManagedHsm(string id = default(string), string name = default(string), string type = default(string), DeletedManagedHsmProperties properties = default(DeletedManagedHsmProperties)) + { + Id = id; + Name = name; + Type = type; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the Azure Resource Manager resource ID for the deleted managed + /// HSM Pool. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the name of the managed HSM Pool. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the resource type of the managed HSM Pool. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets properties of the deleted managed HSM + /// + [JsonProperty(PropertyName = "properties")] + public DeletedManagedHsmProperties Properties { get; set; } + + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/DeletedManagedHsmProperties.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/DeletedManagedHsmProperties.cs new file mode 100644 index 0000000000000..91ede45fe5657 --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/DeletedManagedHsmProperties.cs @@ -0,0 +1,98 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KeyVault.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties of the deleted managed HSM. + /// + public partial class DeletedManagedHsmProperties + { + /// + /// Initializes a new instance of the DeletedManagedHsmProperties + /// class. + /// + public DeletedManagedHsmProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeletedManagedHsmProperties + /// class. + /// + /// The resource id of the original managed + /// HSM. + /// The location of the original managed + /// HSM. + /// The deleted date. + /// The scheduled purged date. + /// Purge protection status of the + /// original managed HSM. + /// Tags of the original managed HSM. + public DeletedManagedHsmProperties(string mhsmId = default(string), string location = default(string), System.DateTime? deletionDate = default(System.DateTime?), System.DateTime? scheduledPurgeDate = default(System.DateTime?), bool? purgeProtectionEnabled = default(bool?), IDictionary tags = default(IDictionary)) + { + MhsmId = mhsmId; + Location = location; + DeletionDate = deletionDate; + ScheduledPurgeDate = scheduledPurgeDate; + PurgeProtectionEnabled = purgeProtectionEnabled; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the resource id of the original managed HSM. + /// + [JsonProperty(PropertyName = "mhsmId")] + public string MhsmId { get; private set; } + + /// + /// Gets the location of the original managed HSM. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; private set; } + + /// + /// Gets the deleted date. + /// + [JsonProperty(PropertyName = "deletionDate")] + public System.DateTime? DeletionDate { get; private set; } + + /// + /// Gets the scheduled purged date. + /// + [JsonProperty(PropertyName = "scheduledPurgeDate")] + public System.DateTime? ScheduledPurgeDate { get; private set; } + + /// + /// Gets purge protection status of the original managed HSM. + /// + [JsonProperty(PropertyName = "purgeProtectionEnabled")] + public bool? PurgeProtectionEnabled { get; private set; } + + /// + /// Gets tags of the original managed HSM. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; private set; } + + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/DeletedVaultProperties.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/DeletedVaultProperties.cs index 9b4d32e9463bf..f90ab1882fbf4 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/DeletedVaultProperties.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/DeletedVaultProperties.cs @@ -37,13 +37,16 @@ public DeletedVaultProperties() /// The deleted date. /// The scheduled purged date. /// Tags of the original vault. - public DeletedVaultProperties(string vaultId = default(string), string location = default(string), System.DateTime? deletionDate = default(System.DateTime?), System.DateTime? scheduledPurgeDate = default(System.DateTime?), IDictionary tags = default(IDictionary)) + /// Purge protection status of the + /// original vault. + public DeletedVaultProperties(string vaultId = default(string), string location = default(string), System.DateTime? deletionDate = default(System.DateTime?), System.DateTime? scheduledPurgeDate = default(System.DateTime?), IDictionary tags = default(IDictionary), bool? purgeProtectionEnabled = default(bool?)) { VaultId = vaultId; Location = location; DeletionDate = deletionDate; ScheduledPurgeDate = scheduledPurgeDate; Tags = tags; + PurgeProtectionEnabled = purgeProtectionEnabled; CustomInit(); } @@ -82,5 +85,11 @@ public DeletedVaultProperties() [JsonProperty(PropertyName = "tags")] public IDictionary Tags { get; private set; } + /// + /// Gets purge protection status of the original vault. + /// + [JsonProperty(PropertyName = "purgeProtectionEnabled")] + public bool? PurgeProtectionEnabled { get; private set; } + } } diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/DimensionProperties.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/DimensionProperties.cs new file mode 100644 index 0000000000000..27309e260c72d --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/DimensionProperties.cs @@ -0,0 +1,69 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KeyVault.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Type of operation: get, read, delete, etc. + /// + public partial class DimensionProperties + { + /// + /// Initializes a new instance of the DimensionProperties class. + /// + public DimensionProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DimensionProperties class. + /// + /// Name of dimension. + /// Display name of dimension. + /// Property to specify whether + /// the dimension should be exported for Shoebox. + public DimensionProperties(string name = default(string), string displayName = default(string), bool? toBeExportedForShoebox = default(bool?)) + { + Name = name; + DisplayName = displayName; + ToBeExportedForShoebox = toBeExportedForShoebox; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of dimension. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets display name of dimension. + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets property to specify whether the dimension should be + /// exported for Shoebox. + /// + [JsonProperty(PropertyName = "toBeExportedForShoebox")] + public bool? ToBeExportedForShoebox { get; set; } + + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/IdentityType.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/IdentityType.cs new file mode 100644 index 0000000000000..3da7ed8b99bd1 --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/IdentityType.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KeyVault.Models +{ + + /// + /// Defines values for IdentityType. + /// + public static class IdentityType + { + public const string User = "User"; + public const string Application = "Application"; + public const string ManagedIdentity = "ManagedIdentity"; + public const string Key = "Key"; + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/KeyPermissions.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/KeyPermissions.cs index 52b1c230ef81a..08d9c7a2a4c90 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/KeyPermissions.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/KeyPermissions.cs @@ -16,7 +16,6 @@ namespace Microsoft.Azure.Management.KeyVault.Models /// public static class KeyPermissions { - public const string All = "all"; public const string Encrypt = "encrypt"; public const string Decrypt = "decrypt"; public const string WrapKey = "wrapKey"; @@ -33,5 +32,6 @@ public static class KeyPermissions public const string Restore = "restore"; public const string Recover = "recover"; public const string Purge = "purge"; + public const string Release = "release"; } } diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMIPRule.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMIPRule.cs new file mode 100644 index 0000000000000..159b6d70279ea --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMIPRule.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KeyVault.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A rule governing the accessibility of a managed hsm pool from a + /// specific ip address or ip range. + /// + public partial class MHSMIPRule + { + /// + /// Initializes a new instance of the MHSMIPRule class. + /// + public MHSMIPRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MHSMIPRule class. + /// + /// An IPv4 address range in CIDR notation, such as + /// '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all + /// addresses that start with 124.56.78). + public MHSMIPRule(string value) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets an IPv4 address range in CIDR notation, such as + /// '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all + /// addresses that start with 124.56.78). + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Value == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Value"); + } + } + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMNetworkRuleSet.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMNetworkRuleSet.cs new file mode 100644 index 0000000000000..279a01775065c --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMNetworkRuleSet.cs @@ -0,0 +1,90 @@ +// +// 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.KeyVault.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A set of rules governing the network accessibility of a managed hsm + /// pool. + /// + public partial class MHSMNetworkRuleSet + { + /// + /// Initializes a new instance of the MHSMNetworkRuleSet class. + /// + public MHSMNetworkRuleSet() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MHSMNetworkRuleSet class. + /// + /// Tells what traffic can bypass network rules. + /// This can be 'AzureServices' or 'None'. If not specified the + /// default is 'AzureServices'. Possible values include: + /// 'AzureServices', 'None' + /// The default action when no rule from + /// ipRules and from virtualNetworkRules match. This is only used after + /// the bypass property has been evaluated. Possible values include: + /// 'Allow', 'Deny' + /// The list of IP address rules. + /// The list of virtual network + /// rules. + public MHSMNetworkRuleSet(string bypass = default(string), string defaultAction = default(string), IList ipRules = default(IList), IList virtualNetworkRules = default(IList)) + { + Bypass = bypass; + DefaultAction = defaultAction; + IpRules = ipRules; + VirtualNetworkRules = virtualNetworkRules; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets tells what traffic can bypass network rules. This can + /// be 'AzureServices' or 'None'. If not specified the default is + /// 'AzureServices'. Possible values include: 'AzureServices', 'None' + /// + [JsonProperty(PropertyName = "bypass")] + public string Bypass { get; set; } + + /// + /// Gets or sets the default action when no rule from ipRules and from + /// virtualNetworkRules match. This is only used after the bypass + /// property has been evaluated. Possible values include: 'Allow', + /// 'Deny' + /// + [JsonProperty(PropertyName = "defaultAction")] + public string DefaultAction { get; set; } + + /// + /// Gets or sets the list of IP address rules. + /// + [JsonProperty(PropertyName = "ipRules")] + public IList IpRules { get; set; } + + /// + /// Gets or sets the list of virtual network rules. + /// + [JsonProperty(PropertyName = "virtualNetworkRules")] + public IList VirtualNetworkRules { get; set; } + + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMPrivateEndpoint.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMPrivateEndpoint.cs new file mode 100644 index 0000000000000..c8a20f6e08293 --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMPrivateEndpoint.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KeyVault.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Private endpoint object properties. + /// + public partial class MHSMPrivateEndpoint + { + /// + /// Initializes a new instance of the MHSMPrivateEndpoint class. + /// + public MHSMPrivateEndpoint() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MHSMPrivateEndpoint class. + /// + /// Full identifier of the private endpoint + /// resource. + public MHSMPrivateEndpoint(string id = default(string)) + { + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets full identifier of the private endpoint resource. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMPrivateEndpointConnection.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMPrivateEndpointConnection.cs new file mode 100644 index 0000000000000..3b25f819bc53a --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMPrivateEndpointConnection.cs @@ -0,0 +1,90 @@ +// +// 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.KeyVault.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Private endpoint connection resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class MHSMPrivateEndpointConnection : IResource + { + /// + /// Initializes a new instance of the MHSMPrivateEndpointConnection + /// class. + /// + public MHSMPrivateEndpointConnection() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MHSMPrivateEndpointConnection + /// class. + /// + /// Properties of the private endpoint + /// object. + /// Approval state of + /// the private link connection. + /// Provisioning state of the private + /// endpoint connection. Possible values include: 'Succeeded', + /// 'Creating', 'Updating', 'Deleting', 'Failed', + /// 'Disconnected' + /// Modified whenever there is a change in the state + /// of private endpoint connection. + public MHSMPrivateEndpointConnection(MHSMPrivateEndpoint privateEndpoint = default(MHSMPrivateEndpoint), MHSMPrivateLinkServiceConnectionState privateLinkServiceConnectionState = default(MHSMPrivateLinkServiceConnectionState), string provisioningState = default(string), string etag = default(string)) + { + PrivateEndpoint = privateEndpoint; + PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; + ProvisioningState = provisioningState; + Etag = etag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets properties of the private endpoint object. + /// + [JsonProperty(PropertyName = "properties.privateEndpoint")] + public MHSMPrivateEndpoint PrivateEndpoint { get; set; } + + /// + /// Gets or sets approval state of the private link connection. + /// + [JsonProperty(PropertyName = "properties.privateLinkServiceConnectionState")] + public MHSMPrivateLinkServiceConnectionState PrivateLinkServiceConnectionState { get; set; } + + /// + /// Gets or sets provisioning state of the private endpoint connection. + /// Possible values include: 'Succeeded', 'Creating', 'Updating', + /// 'Deleting', 'Failed', 'Disconnected' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// Gets or sets modified whenever there is a change in the state of + /// private endpoint connection. + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; set; } + + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMPrivateEndpointConnectionItem.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMPrivateEndpointConnectionItem.cs new file mode 100644 index 0000000000000..4edc0803c13a5 --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMPrivateEndpointConnectionItem.cs @@ -0,0 +1,79 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KeyVault.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Private endpoint connection item. + /// + [Rest.Serialization.JsonTransformation] + public partial class MHSMPrivateEndpointConnectionItem + { + /// + /// Initializes a new instance of the MHSMPrivateEndpointConnectionItem + /// class. + /// + public MHSMPrivateEndpointConnectionItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MHSMPrivateEndpointConnectionItem + /// class. + /// + /// Properties of the private endpoint + /// object. + /// Approval state of + /// the private link connection. + /// Provisioning state of the private + /// endpoint connection. Possible values include: 'Succeeded', + /// 'Creating', 'Updating', 'Deleting', 'Failed', + /// 'Disconnected' + public MHSMPrivateEndpointConnectionItem(MHSMPrivateEndpoint privateEndpoint = default(MHSMPrivateEndpoint), MHSMPrivateLinkServiceConnectionState privateLinkServiceConnectionState = default(MHSMPrivateLinkServiceConnectionState), string provisioningState = default(string)) + { + PrivateEndpoint = privateEndpoint; + PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets properties of the private endpoint object. + /// + [JsonProperty(PropertyName = "properties.privateEndpoint")] + public MHSMPrivateEndpoint PrivateEndpoint { get; set; } + + /// + /// Gets or sets approval state of the private link connection. + /// + [JsonProperty(PropertyName = "properties.privateLinkServiceConnectionState")] + public MHSMPrivateLinkServiceConnectionState PrivateLinkServiceConnectionState { get; set; } + + /// + /// Gets or sets provisioning state of the private endpoint connection. + /// Possible values include: 'Succeeded', 'Creating', 'Updating', + /// 'Deleting', 'Failed', 'Disconnected' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMPrivateEndpointConnectionsDeleteHeaders.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMPrivateEndpointConnectionsDeleteHeaders.cs new file mode 100644 index 0000000000000..b5df64effb35b --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMPrivateEndpointConnectionsDeleteHeaders.cs @@ -0,0 +1,64 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KeyVault.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Delete operation. + /// + public partial class MHSMPrivateEndpointConnectionsDeleteHeaders + { + /// + /// Initializes a new instance of the + /// MHSMPrivateEndpointConnectionsDeleteHeaders class. + /// + public MHSMPrivateEndpointConnectionsDeleteHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// MHSMPrivateEndpointConnectionsDeleteHeaders class. + /// + /// The recommended number of seconds to wait + /// before calling the URI specified in the location header. + /// The URI to poll for completion + /// status. + public MHSMPrivateEndpointConnectionsDeleteHeaders(int? retryAfter = default(int?), string location = default(string)) + { + RetryAfter = retryAfter; + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the recommended number of seconds to wait before + /// calling the URI specified in the location header. + /// + [JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter { get; set; } + + /// + /// Gets or sets the URI to poll for completion status. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMPrivateEndpointConnectionsPutHeaders.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMPrivateEndpointConnectionsPutHeaders.cs new file mode 100644 index 0000000000000..440e8d3197f66 --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMPrivateEndpointConnectionsPutHeaders.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KeyVault.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Put operation. + /// + public partial class MHSMPrivateEndpointConnectionsPutHeaders + { + /// + /// Initializes a new instance of the + /// MHSMPrivateEndpointConnectionsPutHeaders class. + /// + public MHSMPrivateEndpointConnectionsPutHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// MHSMPrivateEndpointConnectionsPutHeaders class. + /// + /// (specified only if operation does not + /// finish synchronously) The recommended number of seconds to wait + /// before calling the URI specified in Azure-AsyncOperation. + /// (specified only if operation does + /// not finish synchronously) The URI to poll for completion status. + /// The response of this URI may be synchronous or + /// asynchronous. + public MHSMPrivateEndpointConnectionsPutHeaders(int? retryAfter = default(int?), string azureAsyncOperation = default(string)) + { + RetryAfter = retryAfter; + AzureAsyncOperation = azureAsyncOperation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets (specified only if operation does not finish + /// synchronously) The recommended number of seconds to wait before + /// calling the URI specified in Azure-AsyncOperation. + /// + [JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter { get; set; } + + /// + /// Gets or sets (specified only if operation does not finish + /// synchronously) The URI to poll for completion status. The response + /// of this URI may be synchronous or asynchronous. + /// + [JsonProperty(PropertyName = "Azure-AsyncOperation")] + public string AzureAsyncOperation { get; set; } + + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMPrivateLinkResource.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMPrivateLinkResource.cs new file mode 100644 index 0000000000000..c249dee421fba --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMPrivateLinkResource.cs @@ -0,0 +1,96 @@ +// +// 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.KeyVault.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A private link resource + /// + [Rest.Serialization.JsonTransformation] + public partial class MHSMPrivateLinkResource : ManagedHsmResource + { + /// + /// Initializes a new instance of the MHSMPrivateLinkResource class. + /// + public MHSMPrivateLinkResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MHSMPrivateLinkResource class. + /// + /// The Azure Resource Manager resource ID for the + /// managed HSM Pool. + /// The name of the managed HSM Pool. + /// The resource type of the managed HSM + /// Pool. + /// The supported Azure location where the + /// managed HSM Pool should be created. + /// SKU details + /// Resource tags + /// Group identifier of private link + /// resource. + /// Required member names of private link + /// resource. + /// Required DNS zone names of the the + /// private link resource. + public MHSMPrivateLinkResource(string id = default(string), string name = default(string), string type = default(string), string location = default(string), ManagedHsmSku sku = default(ManagedHsmSku), IDictionary tags = default(IDictionary), SystemData systemData = default(SystemData), string groupId = default(string), IList requiredMembers = default(IList), IList requiredZoneNames = default(IList)) + : base(id, name, type, location, sku, tags, systemData) + { + GroupId = groupId; + RequiredMembers = requiredMembers; + RequiredZoneNames = requiredZoneNames; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets group identifier of private link resource. + /// + [JsonProperty(PropertyName = "properties.groupId")] + public string GroupId { get; private set; } + + /// + /// Gets required member names of private link resource. + /// + [JsonProperty(PropertyName = "properties.requiredMembers")] + public IList RequiredMembers { get; private set; } + + /// + /// Gets or sets required DNS zone names of the the private link + /// resource. + /// + [JsonProperty(PropertyName = "properties.requiredZoneNames")] + public IList RequiredZoneNames { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMPrivateLinkResourceListResult.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMPrivateLinkResourceListResult.cs new file mode 100644 index 0000000000000..cdb333623a18e --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMPrivateLinkResourceListResult.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KeyVault.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A list of private link resources + /// + public partial class MHSMPrivateLinkResourceListResult + { + /// + /// Initializes a new instance of the MHSMPrivateLinkResourceListResult + /// class. + /// + public MHSMPrivateLinkResourceListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MHSMPrivateLinkResourceListResult + /// class. + /// + /// Array of private link resources + public MHSMPrivateLinkResourceListResult(IList value = default(IList)) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets array of private link resources + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMPrivateLinkServiceConnectionState.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMPrivateLinkServiceConnectionState.cs new file mode 100644 index 0000000000000..5148269d34df0 --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMPrivateLinkServiceConnectionState.cs @@ -0,0 +1,80 @@ +// +// 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.KeyVault.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// An object that represents the approval state of the private link + /// connection. + /// + public partial class MHSMPrivateLinkServiceConnectionState + { + /// + /// Initializes a new instance of the + /// MHSMPrivateLinkServiceConnectionState class. + /// + public MHSMPrivateLinkServiceConnectionState() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// MHSMPrivateLinkServiceConnectionState class. + /// + /// Indicates whether the connection has been + /// approved, rejected or removed by the key vault owner. Possible + /// values include: 'Pending', 'Approved', 'Rejected', + /// 'Disconnected' + /// The reason for approval or + /// rejection. + /// A message indicating if changes on + /// the service provider require any updates on the consumer. Possible + /// values include: 'None' + public MHSMPrivateLinkServiceConnectionState(string status = default(string), string description = default(string), string actionsRequired = default(string)) + { + Status = status; + Description = description; + ActionsRequired = actionsRequired; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets indicates whether the connection has been approved, + /// rejected or removed by the key vault owner. Possible values + /// include: 'Pending', 'Approved', 'Rejected', 'Disconnected' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Gets or sets the reason for approval or rejection. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets a message indicating if changes on the service + /// provider require any updates on the consumer. Possible values + /// include: 'None' + /// + [JsonProperty(PropertyName = "actionsRequired")] + public string ActionsRequired { get; set; } + + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMVirtualNetworkRule.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMVirtualNetworkRule.cs new file mode 100644 index 0000000000000..53bba346e65fa --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MHSMVirtualNetworkRule.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KeyVault.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A rule governing the accessibility of a managed hsm pool from a + /// specific virtual network. + /// + public partial class MHSMVirtualNetworkRule + { + /// + /// Initializes a new instance of the MHSMVirtualNetworkRule class. + /// + public MHSMVirtualNetworkRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MHSMVirtualNetworkRule class. + /// + /// Full resource id of a vnet subnet, such as + /// '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + public MHSMVirtualNetworkRule(string id) + { + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets full resource id of a vnet subnet, such as + /// '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Id"); + } + } + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsm.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsm.cs index 2c8d405f635e8..c7a4e610430ba 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsm.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsm.cs @@ -41,8 +41,8 @@ public ManagedHsm() /// SKU details /// Resource tags /// Properties of the managed HSM - public ManagedHsm(string id = default(string), string name = default(string), string type = default(string), string location = default(string), ManagedHsmSku sku = default(ManagedHsmSku), IDictionary tags = default(IDictionary), ManagedHsmProperties properties = default(ManagedHsmProperties)) - : base(id, name, type, location, sku, tags) + public ManagedHsm(string id = default(string), string name = default(string), string type = default(string), string location = default(string), ManagedHsmSku sku = default(ManagedHsmSku), IDictionary tags = default(IDictionary), SystemData systemData = default(SystemData), ManagedHsmProperties properties = default(ManagedHsmProperties)) + : base(id, name, type, location, sku, tags, systemData) { Properties = properties; CustomInit(); diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsmProperties.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsmProperties.cs index 7597b3595ef14..61aa0d8406ff8 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsmProperties.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsmProperties.cs @@ -60,7 +60,16 @@ public ManagedHsmProperties() /// include: 'Succeeded', 'Provisioning', 'Failed', 'Updating', /// 'Deleting', 'Activated', 'SecurityDomainRestore', /// 'Restoring' - public ManagedHsmProperties(System.Guid? tenantId = default(System.Guid?), IList initialAdminObjectIds = default(IList), string hsmUri = default(string), bool? enableSoftDelete = default(bool?), int? softDeleteRetentionInDays = default(int?), bool? enablePurgeProtection = default(bool?), CreateMode? createMode = default(CreateMode?), string statusMessage = default(string), string provisioningState = default(string)) + /// Rules governing the accessibility of the + /// key vault from specific network locations. + /// List of private endpoint + /// connections associated with the managed hsm pool. + /// Control permission for data plane + /// traffic coming from public networks while private endpoint is + /// enabled. Possible values include: 'Enabled', 'Disabled' + /// The scheduled purge date in + /// UTC. + public ManagedHsmProperties(System.Guid? tenantId = default(System.Guid?), IList initialAdminObjectIds = default(IList), string hsmUri = default(string), bool? enableSoftDelete = default(bool?), int? softDeleteRetentionInDays = default(int?), bool? enablePurgeProtection = default(bool?), CreateMode? createMode = default(CreateMode?), string statusMessage = default(string), string provisioningState = default(string), MHSMNetworkRuleSet networkAcls = default(MHSMNetworkRuleSet), IList privateEndpointConnections = default(IList), string publicNetworkAccess = default(string), System.DateTime? scheduledPurgeDate = default(System.DateTime?)) { TenantId = tenantId; InitialAdminObjectIds = initialAdminObjectIds; @@ -71,6 +80,10 @@ public ManagedHsmProperties() CreateMode = createMode; StatusMessage = statusMessage; ProvisioningState = provisioningState; + NetworkAcls = networkAcls; + PrivateEndpointConnections = privateEndpointConnections; + PublicNetworkAccess = publicNetworkAccess; + ScheduledPurgeDate = scheduledPurgeDate; CustomInit(); } @@ -94,11 +107,11 @@ public ManagedHsmProperties() public IList InitialAdminObjectIds { get; set; } /// - /// Gets or sets the URI of the managed hsm pool for performing - /// operations on keys. + /// Gets the URI of the managed hsm pool for performing operations on + /// keys. /// [JsonProperty(PropertyName = "hsmUri")] - public string HsmUri { get; set; } + public string HsmUri { get; private set; } /// /// Gets or sets property to specify whether the 'soft delete' @@ -151,5 +164,33 @@ public ManagedHsmProperties() [JsonProperty(PropertyName = "provisioningState")] public string ProvisioningState { get; private set; } + /// + /// Gets or sets rules governing the accessibility of the key vault + /// from specific network locations. + /// + [JsonProperty(PropertyName = "networkAcls")] + public MHSMNetworkRuleSet NetworkAcls { get; set; } + + /// + /// Gets list of private endpoint connections associated with the + /// managed hsm pool. + /// + [JsonProperty(PropertyName = "privateEndpointConnections")] + public IList PrivateEndpointConnections { get; private set; } + + /// + /// Gets or sets control permission for data plane traffic coming from + /// public networks while private endpoint is enabled. Possible values + /// include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "publicNetworkAccess")] + public string PublicNetworkAccess { get; set; } + + /// + /// Gets the scheduled purge date in UTC. + /// + [JsonProperty(PropertyName = "scheduledPurgeDate")] + public System.DateTime? ScheduledPurgeDate { get; private set; } + } } diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsmResource.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsmResource.cs index 5d65eecafb53b..3f282842f285b 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsmResource.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsmResource.cs @@ -42,7 +42,7 @@ public ManagedHsmResource() /// managed HSM Pool should be created. /// SKU details /// Resource tags - public ManagedHsmResource(string id = default(string), string name = default(string), string type = default(string), string location = default(string), ManagedHsmSku sku = default(ManagedHsmSku), IDictionary tags = default(IDictionary)) + public ManagedHsmResource(string id = default(string), string name = default(string), string type = default(string), string location = default(string), ManagedHsmSku sku = default(ManagedHsmSku), IDictionary tags = default(IDictionary), SystemData systemData = default(SystemData)) { Id = id; Name = name; @@ -50,6 +50,7 @@ public ManagedHsmResource() Location = location; Sku = sku; Tags = tags; + SystemData = systemData; CustomInit(); } @@ -96,6 +97,11 @@ public ManagedHsmResource() [JsonProperty(PropertyName = "tags")] public IDictionary Tags { get; set; } + /// + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; set; } + /// /// Validate the object. /// diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MetricSpecification.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MetricSpecification.cs new file mode 100644 index 0000000000000..7ac33c2e62309 --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/MetricSpecification.cs @@ -0,0 +1,143 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KeyVault.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Metric specification of operation. + /// + public partial class MetricSpecification + { + /// + /// Initializes a new instance of the MetricSpecification class. + /// + public MetricSpecification() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetricSpecification class. + /// + /// Name of metric specification. + /// Display name of metric + /// specification. + /// Display description of metric + /// specification. + /// The metric unit. Possible values include: + /// 'Bytes', 'Count', 'Milliseconds'. + /// The metric aggregation type. Possible + /// values include: 'Average', 'Count', 'Total'. + /// The supported aggregation + /// types for the metrics. + /// The supported time grain + /// types for the metrics. + /// The metric lock aggregation + /// type. + /// The dimensions of metric + /// Property to specify whether to fill + /// gap with zero. + /// The internal metric name. + public MetricSpecification(string name = default(string), string displayName = default(string), string displayDescription = default(string), string unit = default(string), string aggregationType = default(string), IList supportedAggregationTypes = default(IList), IList supportedTimeGrainTypes = default(IList), string lockAggregationType = default(string), IList dimensions = default(IList), bool? fillGapWithZero = default(bool?), string internalMetricName = default(string)) + { + Name = name; + DisplayName = displayName; + DisplayDescription = displayDescription; + Unit = unit; + AggregationType = aggregationType; + SupportedAggregationTypes = supportedAggregationTypes; + SupportedTimeGrainTypes = supportedTimeGrainTypes; + LockAggregationType = lockAggregationType; + Dimensions = dimensions; + FillGapWithZero = fillGapWithZero; + InternalMetricName = internalMetricName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of metric specification. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets display name of metric specification. + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets display description of metric specification. + /// + [JsonProperty(PropertyName = "displayDescription")] + public string DisplayDescription { get; set; } + + /// + /// Gets or sets the metric unit. Possible values include: 'Bytes', + /// 'Count', 'Milliseconds'. + /// + [JsonProperty(PropertyName = "unit")] + public string Unit { get; set; } + + /// + /// Gets or sets the metric aggregation type. Possible values include: + /// 'Average', 'Count', 'Total'. + /// + [JsonProperty(PropertyName = "aggregationType")] + public string AggregationType { get; set; } + + /// + /// Gets or sets the supported aggregation types for the metrics. + /// + [JsonProperty(PropertyName = "supportedAggregationTypes")] + public IList SupportedAggregationTypes { get; set; } + + /// + /// Gets or sets the supported time grain types for the metrics. + /// + [JsonProperty(PropertyName = "supportedTimeGrainTypes")] + public IList SupportedTimeGrainTypes { get; set; } + + /// + /// Gets or sets the metric lock aggregation type. + /// + [JsonProperty(PropertyName = "lockAggregationType")] + public string LockAggregationType { get; set; } + + /// + /// Gets or sets the dimensions of metric + /// + [JsonProperty(PropertyName = "dimensions")] + public IList Dimensions { get; set; } + + /// + /// Gets or sets property to specify whether to fill gap with zero. + /// + [JsonProperty(PropertyName = "fillGapWithZero")] + public bool? FillGapWithZero { get; set; } + + /// + /// Gets or sets the internal metric name. + /// + [JsonProperty(PropertyName = "internalMetricName")] + public string InternalMetricName { get; set; } + + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/Operation.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/Operation.cs index 6e861fda06ada..8a291e578396f 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/Operation.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/Operation.cs @@ -39,12 +39,15 @@ public Operation() /// The origin of operations. /// One property of operation, /// include metric specifications. - public Operation(string name = default(string), OperationDisplay display = default(OperationDisplay), string origin = default(string), ServiceSpecification serviceSpecification = default(ServiceSpecification)) + /// Property to specify whether the action + /// is a data action. + public Operation(string name = default(string), OperationDisplay display = default(OperationDisplay), string origin = default(string), ServiceSpecification serviceSpecification = default(ServiceSpecification), bool? isDataAction = default(bool?)) { Name = name; Display = display; Origin = origin; ServiceSpecification = serviceSpecification; + IsDataAction = isDataAction; CustomInit(); } @@ -78,5 +81,12 @@ public Operation() [JsonProperty(PropertyName = "properties.serviceSpecification")] public ServiceSpecification ServiceSpecification { get; set; } + /// + /// Gets or sets property to specify whether the action is a data + /// action. + /// + [JsonProperty(PropertyName = "isDataAction")] + public bool? IsDataAction { get; set; } + } } diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateEndpointConnection.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateEndpointConnection.cs index ba2311ec14ca8..71e654425e6cd 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateEndpointConnection.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateEndpointConnection.cs @@ -41,11 +41,14 @@ public PrivateEndpointConnection() /// endpoint connection. Possible values include: 'Succeeded', /// 'Creating', 'Updating', 'Deleting', 'Failed', /// 'Disconnected' - public PrivateEndpointConnection(PrivateEndpoint privateEndpoint = default(PrivateEndpoint), PrivateLinkServiceConnectionState privateLinkServiceConnectionState = default(PrivateLinkServiceConnectionState), string provisioningState = default(string)) + /// Modified whenever there is a change in the state + /// of private endpoint connection. + public PrivateEndpointConnection(PrivateEndpoint privateEndpoint = default(PrivateEndpoint), PrivateLinkServiceConnectionState privateLinkServiceConnectionState = default(PrivateLinkServiceConnectionState), string provisioningState = default(string), string etag = default(string)) { PrivateEndpoint = privateEndpoint; PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; ProvisioningState = provisioningState; + Etag = etag; CustomInit(); } @@ -74,5 +77,12 @@ public PrivateEndpointConnection() [JsonProperty(PropertyName = "properties.provisioningState")] public string ProvisioningState { get; set; } + /// + /// Gets or sets modified whenever there is a change in the state of + /// private endpoint connection. + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; set; } + } } diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateEndpointConnectionItem.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateEndpointConnectionItem.cs index fc159b9dc2af0..d382fb6cafee8 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateEndpointConnectionItem.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateEndpointConnectionItem.cs @@ -34,6 +34,9 @@ public PrivateEndpointConnectionItem() /// Initializes a new instance of the PrivateEndpointConnectionItem /// class. /// + /// Id of private endpoint connection. + /// Modified whenever there is a change in the state + /// of private endpoint connection. /// Properties of the private endpoint /// object. /// Approval state of @@ -42,8 +45,10 @@ public PrivateEndpointConnectionItem() /// endpoint connection. Possible values include: 'Succeeded', /// 'Creating', 'Updating', 'Deleting', 'Failed', /// 'Disconnected' - public PrivateEndpointConnectionItem(PrivateEndpoint privateEndpoint = default(PrivateEndpoint), PrivateLinkServiceConnectionState privateLinkServiceConnectionState = default(PrivateLinkServiceConnectionState), string provisioningState = default(string)) + public PrivateEndpointConnectionItem(string id = default(string), string etag = default(string), PrivateEndpoint privateEndpoint = default(PrivateEndpoint), PrivateLinkServiceConnectionState privateLinkServiceConnectionState = default(PrivateLinkServiceConnectionState), string provisioningState = default(string)) { + Id = id; + Etag = etag; PrivateEndpoint = privateEndpoint; PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; ProvisioningState = provisioningState; @@ -55,6 +60,19 @@ public PrivateEndpointConnectionItem() /// partial void CustomInit(); + /// + /// Gets or sets id of private endpoint connection. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets modified whenever there is a change in the state of + /// private endpoint connection. + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; set; } + /// /// Gets or sets properties of the private endpoint object. /// diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateLinkServiceConnectionState.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateLinkServiceConnectionState.cs index 936f811c968d6..0c2590407a181 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateLinkServiceConnectionState.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PrivateLinkServiceConnectionState.cs @@ -38,13 +38,14 @@ public PrivateLinkServiceConnectionState() /// 'Disconnected' /// The reason for approval or /// rejection. - /// A message indicating if changes on the - /// service provider require any updates on the consumer. - public PrivateLinkServiceConnectionState(string status = default(string), string description = default(string), string actionRequired = default(string)) + /// A message indicating if changes on + /// the service provider require any updates on the consumer. Possible + /// values include: 'None' + public PrivateLinkServiceConnectionState(string status = default(string), string description = default(string), string actionsRequired = default(string)) { Status = status; Description = description; - ActionRequired = actionRequired; + ActionsRequired = actionsRequired; CustomInit(); } @@ -69,10 +70,11 @@ public PrivateLinkServiceConnectionState() /// /// Gets or sets a message indicating if changes on the service - /// provider require any updates on the consumer. + /// provider require any updates on the consumer. Possible values + /// include: 'None' /// - [JsonProperty(PropertyName = "actionRequired")] - public string ActionRequired { get; set; } + [JsonProperty(PropertyName = "actionsRequired")] + public string ActionsRequired { get; set; } } } diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PublicNetworkAccess.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PublicNetworkAccess.cs new file mode 100644 index 0000000000000..beabc883aed20 --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/PublicNetworkAccess.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KeyVault.Models +{ + + /// + /// Defines values for PublicNetworkAccess. + /// + public static class PublicNetworkAccess + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretPermissions.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretPermissions.cs index ed8a95736ee83..efe8c1730fecb 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretPermissions.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretPermissions.cs @@ -16,7 +16,6 @@ namespace Microsoft.Azure.Management.KeyVault.Models /// public static class SecretPermissions { - public const string All = "all"; public const string Get = "get"; public const string List = "list"; public const string Set = "set"; diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ServiceSpecification.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ServiceSpecification.cs index cf63b07f6169b..b8e2847b4225f 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ServiceSpecification.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ServiceSpecification.cs @@ -33,9 +33,12 @@ public ServiceSpecification() /// /// Log specifications of /// operation. - public ServiceSpecification(IList logSpecifications = default(IList)) + /// Metric specifications of + /// operation. + public ServiceSpecification(IList logSpecifications = default(IList), IList metricSpecifications = default(IList)) { LogSpecifications = logSpecifications; + MetricSpecifications = metricSpecifications; CustomInit(); } @@ -50,5 +53,11 @@ public ServiceSpecification() [JsonProperty(PropertyName = "logSpecifications")] public IList LogSpecifications { get; set; } + /// + /// Gets or sets metric specifications of operation. + /// + [JsonProperty(PropertyName = "metricSpecifications")] + public IList MetricSpecifications { get; set; } + } } diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/StoragePermissions.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/StoragePermissions.cs index 2604b8dfb8460..dfa64ca47cf79 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/StoragePermissions.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/StoragePermissions.cs @@ -16,7 +16,6 @@ namespace Microsoft.Azure.Management.KeyVault.Models /// public static class StoragePermissions { - public const string All = "all"; public const string Get = "get"; public const string List = "list"; public const string Delete = "delete"; diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SystemData.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SystemData.cs new file mode 100644 index 0000000000000..abbfd61d28dd8 --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SystemData.cs @@ -0,0 +1,107 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KeyVault.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Metadata pertaining to creation and last modification of the key vault + /// resource. + /// + public partial class SystemData + { + /// + /// Initializes a new instance of the SystemData class. + /// + public SystemData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SystemData class. + /// + /// The identity that created the key vault + /// resource. + /// The type of identity that created the + /// key vault resource. Possible values include: 'User', 'Application', + /// 'ManagedIdentity', 'Key' + /// The timestamp of the key vault resource + /// creation (UTC). + /// The identity that last modified the + /// key vault resource. + /// The type of identity that last + /// modified the key vault resource. Possible values include: 'User', + /// 'Application', 'ManagedIdentity', 'Key' + /// The timestamp of the key vault + /// resource last modification (UTC). + public SystemData(string createdBy = default(string), string createdByType = default(string), System.DateTime? createdAt = default(System.DateTime?), string lastModifiedBy = default(string), string lastModifiedByType = default(string), System.DateTime? lastModifiedAt = default(System.DateTime?)) + { + CreatedBy = createdBy; + CreatedByType = createdByType; + CreatedAt = createdAt; + LastModifiedBy = lastModifiedBy; + LastModifiedByType = lastModifiedByType; + LastModifiedAt = lastModifiedAt; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the identity that created the key vault resource. + /// + [JsonProperty(PropertyName = "createdBy")] + public string CreatedBy { get; set; } + + /// + /// Gets or sets the type of identity that created the key vault + /// resource. Possible values include: 'User', 'Application', + /// 'ManagedIdentity', 'Key' + /// + [JsonProperty(PropertyName = "createdByType")] + public string CreatedByType { get; set; } + + /// + /// Gets or sets the timestamp of the key vault resource creation + /// (UTC). + /// + [JsonProperty(PropertyName = "createdAt")] + public System.DateTime? CreatedAt { get; set; } + + /// + /// Gets or sets the identity that last modified the key vault + /// resource. + /// + [JsonProperty(PropertyName = "lastModifiedBy")] + public string LastModifiedBy { get; set; } + + /// + /// Gets or sets the type of identity that last modified the key vault + /// resource. Possible values include: 'User', 'Application', + /// 'ManagedIdentity', 'Key' + /// + [JsonProperty(PropertyName = "lastModifiedByType")] + public string LastModifiedByType { get; set; } + + /// + /// Gets or sets the timestamp of the key vault resource last + /// modification (UTC). + /// + [JsonProperty(PropertyName = "lastModifiedAt")] + public System.DateTime? LastModifiedAt { get; set; } + + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/Vault.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/Vault.cs index 9cd7362df5be5..e49727912b934 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/Vault.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/Vault.cs @@ -42,13 +42,15 @@ public Vault() /// Azure location of the key vault /// resource. /// Tags assigned to the key vault resource. - public Vault(VaultProperties properties, string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary)) + /// System metadata for the key vault. + public Vault(VaultProperties properties, string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), SystemData systemData = default(SystemData)) { Id = id; Name = name; Type = type; Location = location; Tags = tags; + SystemData = systemData; Properties = properties; CustomInit(); } @@ -88,6 +90,12 @@ public Vault() [JsonProperty(PropertyName = "tags")] public IDictionary Tags { get; set; } + /// + /// Gets or sets system metadata for the key vault. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; set; } + /// /// Gets or sets properties of the vault /// diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/VaultProperties.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/VaultProperties.cs index 9f580d1ae2b6d..fa09d5412ff43 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/VaultProperties.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/VaultProperties.cs @@ -44,6 +44,8 @@ public VaultProperties() /// access policies are required. /// The URI of the vault for performing /// operations on keys and secrets. + /// The resource id of HSM + /// Pool. /// Property to specify whether /// Azure Virtual Machines are permitted to retrieve certificates /// stored as secrets from the key vault. @@ -82,14 +84,17 @@ public VaultProperties() /// - that is, the property does not accept false as its value. /// Rules governing the accessibility of the /// key vault from specific network locations. + /// Provisioning state of the vault. + /// Possible values include: 'Succeeded', 'RegisteringDns' /// List of private endpoint /// connections associated with the key vault. - public VaultProperties(System.Guid tenantId, Sku sku, IList accessPolicies = default(IList), string vaultUri = default(string), bool? enabledForDeployment = default(bool?), bool? enabledForDiskEncryption = default(bool?), bool? enabledForTemplateDeployment = default(bool?), bool? enableSoftDelete = default(bool?), int? softDeleteRetentionInDays = default(int?), bool? enableRbacAuthorization = default(bool?), CreateMode? createMode = default(CreateMode?), bool? enablePurgeProtection = default(bool?), NetworkRuleSet networkAcls = default(NetworkRuleSet), IList privateEndpointConnections = default(IList)) + public VaultProperties(System.Guid tenantId, Sku sku, IList accessPolicies = default(IList), string vaultUri = default(string), string hsmPoolResourceId = default(string), bool? enabledForDeployment = default(bool?), bool? enabledForDiskEncryption = default(bool?), bool? enabledForTemplateDeployment = default(bool?), bool? enableSoftDelete = default(bool?), int? softDeleteRetentionInDays = default(int?), bool? enableRbacAuthorization = default(bool?), CreateMode? createMode = default(CreateMode?), bool? enablePurgeProtection = default(bool?), NetworkRuleSet networkAcls = default(NetworkRuleSet), string provisioningState = default(string), IList privateEndpointConnections = default(IList)) { TenantId = tenantId; Sku = sku; AccessPolicies = accessPolicies; VaultUri = vaultUri; + HsmPoolResourceId = hsmPoolResourceId; EnabledForDeployment = enabledForDeployment; EnabledForDiskEncryption = enabledForDiskEncryption; EnabledForTemplateDeployment = enabledForTemplateDeployment; @@ -99,6 +104,7 @@ public VaultProperties() CreateMode = createMode; EnablePurgeProtection = enablePurgeProtection; NetworkAcls = networkAcls; + ProvisioningState = provisioningState; PrivateEndpointConnections = privateEndpointConnections; CustomInit(); } @@ -138,6 +144,12 @@ public VaultProperties() [JsonProperty(PropertyName = "vaultUri")] public string VaultUri { get; set; } + /// + /// Gets the resource id of HSM Pool. + /// + [JsonProperty(PropertyName = "hsmPoolResourceId")] + public string HsmPoolResourceId { get; private set; } + /// /// Gets or sets property to specify whether Azure Virtual Machines are /// permitted to retrieve certificates stored as secrets from the key @@ -217,6 +229,13 @@ public VaultProperties() [JsonProperty(PropertyName = "networkAcls")] public NetworkRuleSet NetworkAcls { get; set; } + /// + /// Gets or sets provisioning state of the vault. Possible values + /// include: 'Succeeded', 'RegisteringDns' + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; set; } + /// /// Gets list of private endpoint connections associated with the key /// vault. diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/VaultProvisioningState.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/VaultProvisioningState.cs new file mode 100644 index 0000000000000..8d9a83c57e88f --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/VaultProvisioningState.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KeyVault.Models +{ + + /// + /// Defines values for VaultProvisioningState. + /// + public static class VaultProvisioningState + { + public const string Succeeded = "Succeeded"; + public const string RegisteringDns = "RegisteringDns"; + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/VirtualNetworkRule.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/VirtualNetworkRule.cs index 618c3872a2b09..f4a23663be4c2 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/VirtualNetworkRule.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/VirtualNetworkRule.cs @@ -33,9 +33,13 @@ public VirtualNetworkRule() /// /// Full resource id of a vnet subnet, such as /// '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. - public VirtualNetworkRule(string id) + /// Property to specify + /// whether NRP will ignore the check if parent subnet has + /// serviceEndpoints configured. + public VirtualNetworkRule(string id, bool? ignoreMissingVnetServiceEndpoint = default(bool?)) { Id = id; + IgnoreMissingVnetServiceEndpoint = ignoreMissingVnetServiceEndpoint; CustomInit(); } @@ -51,6 +55,13 @@ public VirtualNetworkRule(string id) [JsonProperty(PropertyName = "id")] public string Id { get; set; } + /// + /// Gets or sets property to specify whether NRP will ignore the check + /// if parent subnet has serviceEndpoints configured. + /// + [JsonProperty(PropertyName = "ignoreMissingVnetServiceEndpoint")] + public bool? IgnoreMissingVnetServiceEndpoint { get; set; } + /// /// Validate the object. /// diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Operations.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Operations.cs index e6a9bb02727cf..c7f6e2a12097f 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Operations.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Operations.cs @@ -65,12 +65,21 @@ internal Operations(KeyVaultManagementClient client) /// /// Thrown when unable to deserialize the response /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// /// /// A response object containing the response body and response headers. /// public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - string apiVersion = "2019-09-01"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -78,7 +87,6 @@ internal Operations(KeyVaultManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } @@ -86,9 +94,9 @@ internal Operations(KeyVaultManagementClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.KeyVault/operations").ToString(); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/PrivateEndpointConnectionsOperations.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/PrivateEndpointConnectionsOperations.cs index 970a8e9528b01..9075e94573a42 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/PrivateEndpointConnectionsOperations.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/PrivateEndpointConnectionsOperations.cs @@ -109,7 +109,10 @@ internal PrivateEndpointConnectionsOperations(KeyVaultManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); } - string apiVersion = "2019-09-01"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -120,7 +123,6 @@ internal PrivateEndpointConnectionsOperations(KeyVaultManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("vaultName", vaultName); tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -132,9 +134,9 @@ internal PrivateEndpointConnectionsOperations(KeyVaultManagementClient client) _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName)); _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -194,7 +196,7 @@ internal PrivateEndpointConnectionsOperations(KeyVaultManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 204) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -323,11 +325,14 @@ internal PrivateEndpointConnectionsOperations(KeyVaultManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (properties == null) { throw new ValidationException(ValidationRules.CannotBeNull, "properties"); } - string apiVersion = "2019-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -338,7 +343,6 @@ internal PrivateEndpointConnectionsOperations(KeyVaultManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("vaultName", vaultName); tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("properties", properties); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Put", tracingParameters); @@ -351,9 +355,9 @@ internal PrivateEndpointConnectionsOperations(KeyVaultManagementClient client) _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName)); _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -525,6 +529,210 @@ internal PrivateEndpointConnectionsOperations(KeyVaultManagementClient client) return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } + /// + /// The List operation gets information about the private endpoint connections + /// associated with the vault. + /// + /// + /// Name of the resource group that contains the key vault. + /// + /// + /// The name of the key vault. + /// + /// + /// 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>> ListByResourceWithHttpMessagesAsync(string resourceGroupName, string vaultName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vaultName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vaultName"); + } + if (vaultName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(vaultName, "^[a-zA-Z0-9-]{3,24}$")) + { + throw new ValidationException(ValidationRules.Pattern, "vaultName", "^[a-zA-Z0-9-]{3,24}$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vaultName", vaultName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResource", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Deletes the specified private endpoint connection associated with the key /// vault. @@ -584,7 +792,10 @@ internal PrivateEndpointConnectionsOperations(KeyVaultManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); } - string apiVersion = "2019-09-01"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -595,7 +806,6 @@ internal PrivateEndpointConnectionsOperations(KeyVaultManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("vaultName", vaultName); tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } @@ -607,9 +817,9 @@ internal PrivateEndpointConnectionsOperations(KeyVaultManagementClient client) _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName)); _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -749,5 +959,179 @@ internal PrivateEndpointConnectionsOperations(KeyVaultManagementClient client) return _result; } + /// + /// The List operation gets information about the private endpoint connections + /// associated with the vault. + /// + /// + /// 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>> ListByResourceNextWithHttpMessagesAsync(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, "ListByResourceNext", 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + } } diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs index 1ecff7b253b58..072f0e725bb0b 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs @@ -171,6 +171,48 @@ public static PrivateEndpointConnection Delete(this IPrivateEndpointConnectionsO } } + /// + /// The List operation gets information about the private endpoint connections + /// associated with the vault. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the key vault. + /// + /// + /// The name of the key vault. + /// + public static IPage ListByResource(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string vaultName) + { + return operations.ListByResourceAsync(resourceGroupName, vaultName).GetAwaiter().GetResult(); + } + + /// + /// The List operation gets information about the private endpoint connections + /// associated with the vault. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the key vault. + /// + /// + /// The name of the key vault. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceWithHttpMessagesAsync(resourceGroupName, vaultName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Deletes the specified private endpoint connection associated with the key /// vault. @@ -219,5 +261,41 @@ public static PrivateEndpointConnection BeginDelete(this IPrivateEndpointConnect } } + /// + /// The List operation gets information about the private endpoint connections + /// associated with the vault. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceNext(this IPrivateEndpointConnectionsOperations operations, string nextPageLink) + { + return operations.ListByResourceNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// The List operation gets information about the private endpoint connections + /// associated with the vault. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceNextAsync(this IPrivateEndpointConnectionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } } diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/PrivateLinkResourcesOperations.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/PrivateLinkResourcesOperations.cs index fea7442aebbf9..b1bde0a13752d 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/PrivateLinkResourcesOperations.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/PrivateLinkResourcesOperations.cs @@ -101,7 +101,10 @@ internal PrivateLinkResourcesOperations(KeyVaultManagementClient client) throw new ValidationException(ValidationRules.Pattern, "vaultName", "^[a-zA-Z0-9-]{3,24}$"); } } - string apiVersion = "2019-09-01"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -111,7 +114,6 @@ internal PrivateLinkResourcesOperations(KeyVaultManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("vaultName", vaultName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByVault", tracingParameters); } @@ -122,9 +124,9 @@ internal PrivateLinkResourcesOperations(KeyVaultManagementClient client) _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/SdkInfo_KeyVaultManagementClient.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/SdkInfo_KeyVaultManagementClient.cs index e60bf0e9c7ee4..1daf44237b4b0 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/SdkInfo_KeyVaultManagementClient.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/SdkInfo_KeyVaultManagementClient.cs @@ -19,25 +19,16 @@ public static IEnumerable> ApiInfo_KeyVaultManagem { return new Tuple[] { - new Tuple("KeyVault", "ManagedHsms", "2020-04-01-preview"), - new Tuple("KeyVault", "Operations", "2019-09-01"), - new Tuple("KeyVault", "PrivateEndpointConnections", "2019-09-01"), - new Tuple("KeyVault", "PrivateLinkResources", "2019-09-01"), - new Tuple("KeyVault", "Vaults", "2019-09-01"), - new Tuple("KeyVaultManagementClient", "Vaults", "2019-09-01"), + new Tuple("KeyVault", "MHSMPrivateEndpointConnections", "2021-04-01-preview"), + new Tuple("KeyVault", "MHSMPrivateLinkResources", "2021-04-01-preview"), + new Tuple("KeyVault", "ManagedHsms", "2021-04-01-preview"), + new Tuple("KeyVault", "Operations", "2021-04-01-preview"), + new Tuple("KeyVault", "PrivateEndpointConnections", "2021-04-01-preview"), + new Tuple("KeyVault", "PrivateLinkResources", "2021-04-01-preview"), + new Tuple("KeyVault", "Vaults", "2021-04-01-preview"), + new Tuple("KeyVaultManagementClient", "Vaults", "2021-04-01-preview"), }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "v2"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4413"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/keyvault/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --tag=package-preview-2020-04 --csharp.output-folder=C:\\Users\\yeliu\\code\\azure-sdk-for-net\\sdk\\keyvault\\Microsoft.Azure.Management.KeyVault\\src\\Generated"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "ee92c0739efe6acd5b947a3f7829a349800b2426"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/VaultsOperations.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/VaultsOperations.cs index bdbf8d3071695..fd8c6265124ea 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/VaultsOperations.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/VaultsOperations.cs @@ -125,6 +125,10 @@ internal VaultsOperations(KeyVaultManagementClient client) throw new ValidationException(ValidationRules.Pattern, "vaultName", "^[a-zA-Z0-9-]{3,24}$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (parameters == null) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); @@ -133,7 +137,6 @@ internal VaultsOperations(KeyVaultManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -143,7 +146,6 @@ internal VaultsOperations(KeyVaultManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("vaultName", vaultName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); @@ -155,9 +157,9 @@ internal VaultsOperations(KeyVaultManagementClient client) _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -345,11 +347,14 @@ internal VaultsOperations(KeyVaultManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "vaultName"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -359,7 +364,6 @@ internal VaultsOperations(KeyVaultManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("vaultName", vaultName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -370,9 +374,9 @@ internal VaultsOperations(KeyVaultManagementClient client) _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -521,11 +525,14 @@ internal VaultsOperations(KeyVaultManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "vaultName"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -535,7 +542,6 @@ internal VaultsOperations(KeyVaultManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("vaultName", vaultName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -546,9 +552,9 @@ internal VaultsOperations(KeyVaultManagementClient client) _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -728,6 +734,10 @@ internal VaultsOperations(KeyVaultManagementClient client) throw new ValidationException(ValidationRules.Pattern, "vaultName", "^[a-zA-Z0-9-]{3,24}$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (parameters == null) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); @@ -740,7 +750,6 @@ internal VaultsOperations(KeyVaultManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -751,7 +760,6 @@ internal VaultsOperations(KeyVaultManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("vaultName", vaultName); tracingParameters.Add("operationKind", operationKind); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "UpdateAccessPolicy", tracingParameters); @@ -764,9 +772,9 @@ internal VaultsOperations(KeyVaultManagementClient client) _url = _url.Replace("{operationKind}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(operationKind, Client.SerializationSettings).Trim('"'))); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -832,7 +840,7 @@ internal VaultsOperations(KeyVaultManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 404) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -910,6 +918,24 @@ internal VaultsOperations(KeyVaultManagementClient client) throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } + // Deserialize Response + if ((int)_statusCode == 404) + { + _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); @@ -954,11 +980,14 @@ internal VaultsOperations(KeyVaultManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -968,7 +997,6 @@ internal VaultsOperations(KeyVaultManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("top", top); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); } @@ -982,9 +1010,9 @@ internal VaultsOperations(KeyVaultManagementClient client) { _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1141,11 +1169,14 @@ internal VaultsOperations(KeyVaultManagementClient client) /// public async Task>> ListBySubscriptionWithHttpMessagesAsync(int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1154,7 +1185,6 @@ internal VaultsOperations(KeyVaultManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("top", top); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); } @@ -1167,9 +1197,9 @@ internal VaultsOperations(KeyVaultManagementClient client) { _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1322,11 +1352,14 @@ internal VaultsOperations(KeyVaultManagementClient client) /// public async Task>> ListDeletedWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1334,7 +1367,6 @@ internal VaultsOperations(KeyVaultManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListDeleted", tracingParameters); } @@ -1343,9 +1375,9 @@ internal VaultsOperations(KeyVaultManagementClient client) var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1512,11 +1544,14 @@ internal VaultsOperations(KeyVaultManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "location"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1526,7 +1561,6 @@ internal VaultsOperations(KeyVaultManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("vaultName", vaultName); tracingParameters.Add("location", location); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetDeleted", tracingParameters); } @@ -1537,9 +1571,9 @@ internal VaultsOperations(KeyVaultManagementClient client) _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1917,11 +1951,14 @@ internal VaultsOperations(KeyVaultManagementClient client) { vaultName.Validate(); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1930,7 +1967,6 @@ internal VaultsOperations(KeyVaultManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("vaultName", vaultName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CheckNameAvailability", tracingParameters); } @@ -1939,9 +1975,9 @@ internal VaultsOperations(KeyVaultManagementClient client) var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -2124,6 +2160,10 @@ internal VaultsOperations(KeyVaultManagementClient client) throw new ValidationException(ValidationRules.Pattern, "vaultName", "^[a-zA-Z0-9-]{3,24}$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (parameters == null) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); @@ -2136,7 +2176,6 @@ internal VaultsOperations(KeyVaultManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2146,7 +2185,6 @@ internal VaultsOperations(KeyVaultManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("vaultName", vaultName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); @@ -2158,9 +2196,9 @@ internal VaultsOperations(KeyVaultManagementClient client) _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -2330,6 +2368,9 @@ internal VaultsOperations(KeyVaultManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -2349,11 +2390,14 @@ internal VaultsOperations(KeyVaultManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "location"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2363,7 +2407,6 @@ internal VaultsOperations(KeyVaultManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("vaultName", vaultName); tracingParameters.Add("location", location); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginPurgeDeleted", tracingParameters); } @@ -2374,9 +2417,9 @@ internal VaultsOperations(KeyVaultManagementClient client) _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -2436,7 +2479,7 @@ internal VaultsOperations(KeyVaultManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202) + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 404) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -2478,6 +2521,24 @@ internal VaultsOperations(KeyVaultManagementClient client) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } + // Deserialize Response + if ((int)_statusCode == 404) + { + _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);