From b33eeadc837c9347f8f41848e015f5e4a0a853e6 Mon Sep 17 00:00:00 2001
From: Minghao Chen <30464227+HarveyLink@users.noreply.github.com>
Date: Fri, 21 Jun 2024 15:58:40 +0800
Subject: [PATCH 1/8] Rough Regen
---
.../Sample_DeletedKeyVaultCollection.cs | 6 +-
.../Samples/Sample_DeletedKeyVaultResource.cs | 4 +-
.../Sample_DeletedManagedHsmCollection.cs | 6 +-
.../Sample_DeletedManagedHsmResource.cs | 4 +-
.../Samples/Sample_KeyVaultCollection.cs | 12 +-
...aultPrivateEndpointConnectionCollection.cs | 10 +-
...yVaultPrivateEndpointConnectionResource.cs | 6 +-
.../Samples/Sample_KeyVaultResource.cs | 14 +-
.../Sample_KeyVaultSecretCollection.cs | 10 +-
.../Samples/Sample_KeyVaultSecretResource.cs | 4 +-
.../Samples/Sample_ManagedHSMKeyCollection.cs | 204 +++++
.../Samples/Sample_ManagedHSMKeyResource.cs | 87 +++
.../Sample_ManagedHSMKeyVersionCollection.cs | 167 ++++
.../Sample_ManagedHSMKeyVersionResource.cs | 50 ++
.../Samples/Sample_ManagedHsmCollection.cs | 10 +-
...dHsmPrivateEndpointConnectionCollection.cs | 10 +-
...gedHsmPrivateEndpointConnectionResource.cs | 6 +-
.../Samples/Sample_ManagedHsmResource.cs | 14 +-
.../Sample_SubscriptionResourceExtensions.cs | 4 +-
.../Samples/Sample_VaultKeyCollection.cs | 204 +++++
.../Samples/Sample_VaultKeyResource.cs | 87 +++
.../Sample_VaultKeyVersionCollection.cs | 167 ++++
.../Samples/Sample_VaultKeyVersionResource.cs | 50 ++
.../src/Generated/ArmKeyVaultModelFactory.cs | 288 ++++++-
.../Generated/DeletedKeyVaultCollection.cs | 12 +-
.../src/Generated/DeletedKeyVaultResource.cs | 8 +-
.../Generated/DeletedManagedHsmCollection.cs | 12 +-
.../Generated/DeletedManagedHsmResource.cs | 8 +-
.../Extensions/KeyVaultExtensions.cs | 116 ++-
.../Extensions/MockableKeyVaultArmClient.cs | 48 ++
.../MockableKeyVaultResourceGroupResource.cs | 8 +-
.../MockableKeyVaultSubscriptionResource.cs | 32 +-
.../src/Generated/KeyData.Serialization.cs | 652 ++++++++++++++++
.../src/Generated/KeyData.cs | 128 +++
.../src/Generated/KeyVaultCollection.cs | 20 +-
...aultPrivateEndpointConnectionCollection.cs | 20 +-
...yVaultPrivateEndpointConnectionResource.cs | 12 +-
.../src/Generated/KeyVaultResource.cs | 109 ++-
.../src/Generated/KeyVaultSecretCollection.cs | 20 +-
.../src/Generated/KeyVaultSecretResource.cs | 8 +-
.../src/Generated/ManagedHSMKeyCollection.cs | 498 ++++++++++++
.../ManagedHSMKeyResource.Serialization.cs | 26 +
.../src/Generated/ManagedHSMKeyResource.cs | 696 +++++++++++++++++
.../ManagedHSMKeyVersionCollection.cs | 395 ++++++++++
...agedHSMKeyVersionResource.Serialization.cs | 26 +
.../Generated/ManagedHSMKeyVersionResource.cs | 172 +++++
.../src/Generated/ManagedHsmCollection.cs | 20 +-
.../Generated/ManagedHsmData.Serialization.cs | 33 +
.../src/Generated/ManagedHsmData.cs | 7 +-
.../ManagedHsmKeyData.Serialization.cs | 621 +++++++++++++++
.../src/Generated/ManagedHsmKeyData.cs | 123 +++
...dHsmPrivateEndpointConnectionCollection.cs | 20 +-
...ateEndpointConnectionData.Serialization.cs | 33 +
...ManagedHsmPrivateEndpointConnectionData.cs | 7 +-
...gedHsmPrivateEndpointConnectionResource.cs | 24 +-
.../src/Generated/ManagedHsmResource.cs | 105 ++-
.../Generated/Models/Action.Serialization.cs | 159 ++++
.../src/Generated/Models/Action.cs | 66 ++
.../Generated/Models/DeletionRecoveryLevel.cs | 57 ++
.../Generated/Models/JsonWebKeyCurveName.cs | 57 ++
.../Generated/Models/JsonWebKeyOperation.cs | 69 ++
.../src/Generated/Models/JsonWebKeyType.cs | 57 ++
.../Models/KeyAttributes.Serialization.cs | 349 +++++++++
.../src/Generated/Models/KeyAttributes.cs | 96 +++
.../Models/KeyListResult.Serialization.cs | 212 +++++
.../src/Generated/Models/KeyListResult.cs | 70 ++
.../Models/KeyProperties.Serialization.cs | 262 +++++++
.../src/Generated/Models/KeyProperties.cs | 107 +++
.../Models/KeyReleasePolicy.Serialization.cs | 193 +++++
.../src/Generated/Models/KeyReleasePolicy.cs | 71 ++
...yRotationPolicyActionType.Serialization.cs | 28 +
.../Models/KeyRotationPolicyActionType.cs | 18 +
...yRotationPolicyAttributes.Serialization.cs | 223 ++++++
.../Models/KeyRotationPolicyAttributes.cs | 76 ++
.../Models/LifetimeAction.Serialization.cs | 192 +++++
.../src/Generated/Models/LifetimeAction.cs | 82 ++
...MKeyCreateOrUpdateContent.Serialization.cs | 145 ++++
.../ManagedHSMKeyCreateOrUpdateContent.cs | 82 ++
.../Models/ManagedHsmAction.Serialization.cs | 159 ++++
.../src/Generated/Models/ManagedHsmAction.cs | 66 ++
.../ManagedHsmKeyAttributes.Serialization.cs | 349 +++++++++
.../Models/ManagedHsmKeyAttributes.cs | 96 +++
.../ManagedHsmKeyListResult.Serialization.cs | 212 +++++
.../Models/ManagedHsmKeyListResult.cs | 70 ++
.../ManagedHsmKeyProperties.Serialization.cs | 262 +++++++
.../Models/ManagedHsmKeyProperties.cs | 107 +++
...anagedHsmKeyReleasePolicy.Serialization.cs | 193 +++++
.../Models/ManagedHsmKeyReleasePolicy.cs | 71 ++
...yRotationPolicyAttributes.Serialization.cs | 223 ++++++
.../ManagedHsmKeyRotationPolicyAttributes.cs | 76 ++
.../ManagedHsmLifetimeAction.Serialization.cs | 192 +++++
.../Models/ManagedHsmLifetimeAction.cs | 82 ++
...smPrivateLinkResourceData.Serialization.cs | 33 +
.../ManagedHsmPrivateLinkResourceData.cs | 7 +-
.../ManagedHsmRotationPolicy.Serialization.cs | 208 +++++
.../Models/ManagedHsmRotationPolicy.cs | 72 ++
.../Models/ManagedHsmTrigger.Serialization.cs | 197 +++++
.../src/Generated/Models/ManagedHsmTrigger.cs | 71 ++
.../Models/RotationPolicy.Serialization.cs | 208 +++++
.../src/Generated/Models/RotationPolicy.cs | 72 ++
.../Generated/Models/Trigger.Serialization.cs | 197 +++++
.../src/Generated/Models/Trigger.cs | 71 ++
...tKeyCreateOrUpdateContent.Serialization.cs | 145 ++++
.../Models/VaultKeyCreateOrUpdateContent.cs | 82 ++
.../RestOperations/KeysRestOperations.cs | 731 ++++++++++++++++++
.../ManagedHsmKeysRestOperations.cs | 731 ++++++++++++++++++
.../ManagedHsmsRestOperations.cs | 2 +-
...rivateEndpointConnectionsRestOperations.cs | 2 +-
.../MhsmPrivateLinkResourcesRestOperations.cs | 2 +-
.../MhsmRegionsRestOperations.cs | 2 +-
...rivateEndpointConnectionsRestOperations.cs | 2 +-
.../PrivateLinkResourcesRestOperations.cs | 2 +-
.../RestOperations/SecretsRestOperations.cs | 2 +-
.../RestOperations/VaultsRestOperations.cs | 2 +-
.../src/Generated/VaultKeyCollection.cs | 498 ++++++++++++
.../VaultKeyResource.Serialization.cs | 26 +
.../src/Generated/VaultKeyResource.cs | 337 ++++++++
.../Generated/VaultKeyVersionCollection.cs | 395 ++++++++++
.../VaultKeyVersionResource.Serialization.cs | 26 +
.../src/Generated/VaultKeyVersionResource.cs | 172 +++++
.../src/autorest.md | 5 +-
121 files changed, 14327 insertions(+), 245 deletions(-)
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ManagedHSMKeyCollection.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ManagedHSMKeyResource.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ManagedHSMKeyVersionCollection.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ManagedHSMKeyVersionResource.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_VaultKeyCollection.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_VaultKeyResource.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_VaultKeyVersionCollection.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_VaultKeyVersionResource.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyData.Serialization.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyData.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHSMKeyCollection.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHSMKeyResource.Serialization.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHSMKeyResource.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHSMKeyVersionCollection.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHSMKeyVersionResource.Serialization.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHSMKeyVersionResource.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmKeyData.Serialization.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmKeyData.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/Action.Serialization.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/Action.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/DeletionRecoveryLevel.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/JsonWebKeyCurveName.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/JsonWebKeyOperation.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/JsonWebKeyType.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyAttributes.Serialization.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyAttributes.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyListResult.Serialization.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyListResult.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyProperties.Serialization.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyProperties.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyReleasePolicy.Serialization.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyReleasePolicy.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyRotationPolicyActionType.Serialization.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyRotationPolicyActionType.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyRotationPolicyAttributes.Serialization.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyRotationPolicyAttributes.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/LifetimeAction.Serialization.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/LifetimeAction.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHSMKeyCreateOrUpdateContent.Serialization.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHSMKeyCreateOrUpdateContent.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmAction.Serialization.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmAction.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmKeyAttributes.Serialization.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmKeyAttributes.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmKeyListResult.Serialization.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmKeyListResult.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmKeyProperties.Serialization.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmKeyProperties.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmKeyReleasePolicy.Serialization.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmKeyReleasePolicy.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmKeyRotationPolicyAttributes.Serialization.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmKeyRotationPolicyAttributes.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmLifetimeAction.Serialization.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmLifetimeAction.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmRotationPolicy.Serialization.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmRotationPolicy.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmTrigger.Serialization.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmTrigger.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/RotationPolicy.Serialization.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/RotationPolicy.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/Trigger.Serialization.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/Trigger.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/VaultKeyCreateOrUpdateContent.Serialization.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/VaultKeyCreateOrUpdateContent.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/KeysRestOperations.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/ManagedHsmKeysRestOperations.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/VaultKeyCollection.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/VaultKeyResource.Serialization.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/VaultKeyResource.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/VaultKeyVersionCollection.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/VaultKeyVersionResource.Serialization.cs
create mode 100644 sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/VaultKeyVersionResource.cs
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_DeletedKeyVaultCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_DeletedKeyVaultCollection.cs
index 80909fcfda99a..47d78329805b1 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_DeletedKeyVaultCollection.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_DeletedKeyVaultCollection.cs
@@ -20,7 +20,7 @@ public partial class Sample_DeletedKeyVaultCollection
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task Get_RetrieveADeletedVault()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/getDeletedVault.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/getDeletedVault.json
// this example is just showing the usage of "Vaults_GetDeleted" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -54,7 +54,7 @@ public async Task Get_RetrieveADeletedVault()
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task Exists_RetrieveADeletedVault()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/getDeletedVault.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/getDeletedVault.json
// this example is just showing the usage of "Vaults_GetDeleted" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -84,7 +84,7 @@ public async Task Exists_RetrieveADeletedVault()
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task GetIfExists_RetrieveADeletedVault()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/getDeletedVault.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/getDeletedVault.json
// this example is just showing the usage of "Vaults_GetDeleted" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_DeletedKeyVaultResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_DeletedKeyVaultResource.cs
index 40b38eb7bd017..adeb0bdf97253 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_DeletedKeyVaultResource.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_DeletedKeyVaultResource.cs
@@ -19,7 +19,7 @@ public partial class Sample_DeletedKeyVaultResource
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task Get_RetrieveADeletedVault()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/getDeletedVault.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/getDeletedVault.json
// this example is just showing the usage of "Vaults_GetDeleted" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -50,7 +50,7 @@ public async Task Get_RetrieveADeletedVault()
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task PurgeDeleted_PurgeADeletedVault()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/purgeDeletedVault.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/purgeDeletedVault.json
// this example is just showing the usage of "Vaults_PurgeDeleted" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_DeletedManagedHsmCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_DeletedManagedHsmCollection.cs
index f8a8b655eb4ae..34a9048662d1b 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_DeletedManagedHsmCollection.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_DeletedManagedHsmCollection.cs
@@ -20,7 +20,7 @@ public partial class Sample_DeletedManagedHsmCollection
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task Get_RetrieveADeletedManagedHSM()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/DeletedManagedHsm_Get.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/DeletedManagedHsm_Get.json
// this example is just showing the usage of "ManagedHsms_GetDeleted" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -54,7 +54,7 @@ public async Task Get_RetrieveADeletedManagedHSM()
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task Exists_RetrieveADeletedManagedHSM()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/DeletedManagedHsm_Get.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/DeletedManagedHsm_Get.json
// this example is just showing the usage of "ManagedHsms_GetDeleted" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -84,7 +84,7 @@ public async Task Exists_RetrieveADeletedManagedHSM()
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task GetIfExists_RetrieveADeletedManagedHSM()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/DeletedManagedHsm_Get.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/DeletedManagedHsm_Get.json
// this example is just showing the usage of "ManagedHsms_GetDeleted" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_DeletedManagedHsmResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_DeletedManagedHsmResource.cs
index a25ea6027324a..b3cb2944a109c 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_DeletedManagedHsmResource.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_DeletedManagedHsmResource.cs
@@ -19,7 +19,7 @@ public partial class Sample_DeletedManagedHsmResource
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task Get_RetrieveADeletedManagedHSM()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/DeletedManagedHsm_Get.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/DeletedManagedHsm_Get.json
// this example is just showing the usage of "ManagedHsms_GetDeleted" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -50,7 +50,7 @@ public async Task Get_RetrieveADeletedManagedHSM()
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task PurgeDeleted_PurgeAManagedHSMPool()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/DeletedManagedHsm_Purge.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/DeletedManagedHsm_Purge.json
// this example is just showing the usage of "ManagedHsms_PurgeDeleted" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultCollection.cs
index 56b3b03957bc6..60864d7f2a859 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultCollection.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultCollection.cs
@@ -21,7 +21,7 @@ public partial class Sample_KeyVaultCollection
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task CreateOrUpdate_CreateANewVaultOrUpdateAnExistingVault()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/createVault.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/createVault.json
// this example is just showing the usage of "Vaults_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -81,7 +81,7 @@ public async Task CreateOrUpdate_CreateANewVaultOrUpdateAnExistingVault()
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task CreateOrUpdate_CreateOrUpdateAVaultWithNetworkAcls()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/createVaultWithNetworkAcls.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/createVaultWithNetworkAcls.json
// this example is just showing the usage of "Vaults_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -135,7 +135,7 @@ public async Task CreateOrUpdate_CreateOrUpdateAVaultWithNetworkAcls()
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task Get_RetrieveAVault()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/getVault.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/getVault.json
// this example is just showing the usage of "Vaults_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -169,7 +169,7 @@ public async Task Get_RetrieveAVault()
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task Exists_RetrieveAVault()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/getVault.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/getVault.json
// this example is just showing the usage of "Vaults_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -199,7 +199,7 @@ public async Task Exists_RetrieveAVault()
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task GetIfExists_RetrieveAVault()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/getVault.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/getVault.json
// this example is just showing the usage of "Vaults_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -241,7 +241,7 @@ public async Task GetIfExists_RetrieveAVault()
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task GetAll_ListVaultsInTheSpecifiedResourceGroup()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/listVaultByResourceGroup.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/listVaultByResourceGroup.json
// this example is just showing the usage of "Vaults_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultPrivateEndpointConnectionCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultPrivateEndpointConnectionCollection.cs
index d46e54fdc0d4c..503fab6a922c7 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultPrivateEndpointConnectionCollection.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultPrivateEndpointConnectionCollection.cs
@@ -20,7 +20,7 @@ public partial class Sample_KeyVaultPrivateEndpointConnectionCollection
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task Get_KeyVaultGetPrivateEndpointConnection()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/getPrivateEndpointConnection.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/getPrivateEndpointConnection.json
// this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -55,7 +55,7 @@ public async Task Get_KeyVaultGetPrivateEndpointConnection()
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task Exists_KeyVaultGetPrivateEndpointConnection()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/getPrivateEndpointConnection.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/getPrivateEndpointConnection.json
// this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -86,7 +86,7 @@ public async Task Exists_KeyVaultGetPrivateEndpointConnection()
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task GetIfExists_KeyVaultGetPrivateEndpointConnection()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/getPrivateEndpointConnection.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/getPrivateEndpointConnection.json
// this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -129,7 +129,7 @@ public async Task GetIfExists_KeyVaultGetPrivateEndpointConnection()
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task CreateOrUpdate_KeyVaultPutPrivateEndpointConnection()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/putPrivateEndpointConnection.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/putPrivateEndpointConnection.json
// this example is just showing the usage of "PrivateEndpointConnections_Put" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -174,7 +174,7 @@ public async Task CreateOrUpdate_KeyVaultPutPrivateEndpointConnection()
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task GetAll_KeyVaultListPrivateEndpointConnection()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/listPrivateEndpointConnection.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/listPrivateEndpointConnection.json
// this example is just showing the usage of "PrivateEndpointConnections_ListByResource" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultPrivateEndpointConnectionResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultPrivateEndpointConnectionResource.cs
index aebe9a7d8c6af..8b4387e65090e 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultPrivateEndpointConnectionResource.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultPrivateEndpointConnectionResource.cs
@@ -20,7 +20,7 @@ public partial class Sample_KeyVaultPrivateEndpointConnectionResource
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task Get_KeyVaultGetPrivateEndpointConnection()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/getPrivateEndpointConnection.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/getPrivateEndpointConnection.json
// this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -52,7 +52,7 @@ public async Task Get_KeyVaultGetPrivateEndpointConnection()
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task Update_KeyVaultPutPrivateEndpointConnection()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/putPrivateEndpointConnection.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/putPrivateEndpointConnection.json
// this example is just showing the usage of "PrivateEndpointConnections_Put" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -94,7 +94,7 @@ public async Task Update_KeyVaultPutPrivateEndpointConnection()
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task Delete_KeyVaultDeletePrivateEndpointConnection()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/deletePrivateEndpointConnection.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/deletePrivateEndpointConnection.json
// this example is just showing the usage of "PrivateEndpointConnections_Delete" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultResource.cs
index e90a5570d0c39..8bd62c0e408a0 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultResource.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultResource.cs
@@ -21,7 +21,7 @@ public partial class Sample_KeyVaultResource
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task Update_UpdateAnExistingVault()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/updateVault.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/updateVault.json
// this example is just showing the usage of "Vaults_Update" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -82,7 +82,7 @@ public async Task Update_UpdateAnExistingVault()
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task Delete_DeleteAVault()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/deleteVault.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/deleteVault.json
// this example is just showing the usage of "Vaults_Delete" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -109,7 +109,7 @@ public async Task Delete_DeleteAVault()
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task Get_RetrieveAVault()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/getVault.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/getVault.json
// this example is just showing the usage of "Vaults_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -140,7 +140,7 @@ public async Task Get_RetrieveAVault()
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task UpdateAccessPolicy_AddAnAccessPolicyOrUpdateAnAccessPolicyWithNewPermissions()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/updateAccessPoliciesAdd.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/updateAccessPoliciesAdd.json
// this example is just showing the usage of "Vaults_UpdateAccessPolicy" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -186,7 +186,7 @@ public async Task UpdateAccessPolicy_AddAnAccessPolicyOrUpdateAnAccessPolicyWith
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task GetKeyVaults_ListVaultsInTheSpecifiedSubscription()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/listVaultBySubscription.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/listVaultBySubscription.json
// this example is just showing the usage of "Vaults_ListBySubscription" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -219,7 +219,7 @@ public async Task GetKeyVaults_ListVaultsInTheSpecifiedSubscription()
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task CheckKeyVaultNameAvailability_ValidateAVaultName()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/checkVaultNameAvailability.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/checkVaultNameAvailability.json
// this example is just showing the usage of "Vaults_CheckNameAvailability" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -245,7 +245,7 @@ public async Task CheckKeyVaultNameAvailability_ValidateAVaultName()
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task GetPrivateLinkResources_KeyVaultListPrivateLinkResources()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/listPrivateLinkResources.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/listPrivateLinkResources.json
// this example is just showing the usage of "PrivateLinkResources_ListByVault" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultSecretCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultSecretCollection.cs
index d8425f768e42a..21803f35c95b2 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultSecretCollection.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultSecretCollection.cs
@@ -20,7 +20,7 @@ public partial class Sample_KeyVaultSecretCollection
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task CreateOrUpdate_CreateASecret()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/createSecret.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/createSecret.json
// this example is just showing the usage of "Secrets_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -60,7 +60,7 @@ public async Task CreateOrUpdate_CreateASecret()
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task Get_GetASecret()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/getSecret.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/getSecret.json
// this example is just showing the usage of "Secrets_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -95,7 +95,7 @@ public async Task Get_GetASecret()
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task Exists_GetASecret()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/getSecret.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/getSecret.json
// this example is just showing the usage of "Secrets_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -126,7 +126,7 @@ public async Task Exists_GetASecret()
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task GetIfExists_GetASecret()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/getSecret.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/getSecret.json
// this example is just showing the usage of "Secrets_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -169,7 +169,7 @@ public async Task GetIfExists_GetASecret()
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task GetAll_ListSecretsInTheVault()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/listSecrets.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/listSecrets.json
// this example is just showing the usage of "Secrets_List" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultSecretResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultSecretResource.cs
index b94a17f90e3bc..7c0bf11383e31 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultSecretResource.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultSecretResource.cs
@@ -20,7 +20,7 @@ public partial class Sample_KeyVaultSecretResource
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task Update_UpdateASecret()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/updateSecret.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/updateSecret.json
// this example is just showing the usage of "Secrets_Update" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -59,7 +59,7 @@ public async Task Update_UpdateASecret()
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task Get_GetASecret()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/getSecret.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/getSecret.json
// this example is just showing the usage of "Secrets_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ManagedHSMKeyCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ManagedHSMKeyCollection.cs
new file mode 100644
index 0000000000000..45f00152a2635
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ManagedHSMKeyCollection.cs
@@ -0,0 +1,204 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading.Tasks;
+using Azure.Core;
+using Azure.Identity;
+using Azure.ResourceManager.KeyVault.Models;
+
+namespace Azure.ResourceManager.KeyVault.Samples
+{
+ public partial class Sample_ManagedHSMKeyCollection
+ {
+ // Create a key
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task CreateOrUpdate_CreateAKey()
+ {
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/managedHsmCreateKey.json
+ // this example is just showing the usage of "ManagedHsmKeys_CreateIfNotExist" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this ManagedHsmResource created on azure
+ // for more information of creating ManagedHsmResource, please refer to the document of ManagedHsmResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "sample-group";
+ string name = "sample-managedhsm-name";
+ ResourceIdentifier managedHsmResourceId = ManagedHsmResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name);
+ ManagedHsmResource managedHsm = client.GetManagedHsmResource(managedHsmResourceId);
+
+ // get the collection of this ManagedHSMKeyResource
+ ManagedHSMKeyCollection collection = managedHsm.GetManagedHSMKeys();
+
+ // invoke the operation
+ string keyName = "sample-key-name";
+ ManagedHSMKeyCreateOrUpdateContent content = new ManagedHSMKeyCreateOrUpdateContent(new ManagedHsmKeyProperties()
+ {
+ Kty = JsonWebKeyType.RSA,
+ });
+ ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, keyName, content);
+ ManagedHSMKeyResource result = lro.Value;
+
+ // the variable result is a resource, you could call other operations on this instance as well
+ // but just for demo, we get its data from this resource instance
+ ManagedHsmKeyData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // Get a key
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_GetAKey()
+ {
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/managedHsmGetKey.json
+ // this example is just showing the usage of "ManagedHsmKeys_Get" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this ManagedHsmResource created on azure
+ // for more information of creating ManagedHsmResource, please refer to the document of ManagedHsmResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "sample-group";
+ string name = "sample-managedhsm-name";
+ ResourceIdentifier managedHsmResourceId = ManagedHsmResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name);
+ ManagedHsmResource managedHsm = client.GetManagedHsmResource(managedHsmResourceId);
+
+ // get the collection of this ManagedHSMKeyResource
+ ManagedHSMKeyCollection collection = managedHsm.GetManagedHSMKeys();
+
+ // invoke the operation
+ string keyName = "sample-key-name";
+ ManagedHSMKeyResource result = await collection.GetAsync(keyName);
+
+ // the variable result is a resource, you could call other operations on this instance as well
+ // but just for demo, we get its data from this resource instance
+ ManagedHsmKeyData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // Get a key
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Exists_GetAKey()
+ {
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/managedHsmGetKey.json
+ // this example is just showing the usage of "ManagedHsmKeys_Get" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this ManagedHsmResource created on azure
+ // for more information of creating ManagedHsmResource, please refer to the document of ManagedHsmResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "sample-group";
+ string name = "sample-managedhsm-name";
+ ResourceIdentifier managedHsmResourceId = ManagedHsmResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name);
+ ManagedHsmResource managedHsm = client.GetManagedHsmResource(managedHsmResourceId);
+
+ // get the collection of this ManagedHSMKeyResource
+ ManagedHSMKeyCollection collection = managedHsm.GetManagedHSMKeys();
+
+ // invoke the operation
+ string keyName = "sample-key-name";
+ bool result = await collection.ExistsAsync(keyName);
+
+ Console.WriteLine($"Succeeded: {result}");
+ }
+
+ // Get a key
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task GetIfExists_GetAKey()
+ {
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/managedHsmGetKey.json
+ // this example is just showing the usage of "ManagedHsmKeys_Get" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this ManagedHsmResource created on azure
+ // for more information of creating ManagedHsmResource, please refer to the document of ManagedHsmResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "sample-group";
+ string name = "sample-managedhsm-name";
+ ResourceIdentifier managedHsmResourceId = ManagedHsmResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name);
+ ManagedHsmResource managedHsm = client.GetManagedHsmResource(managedHsmResourceId);
+
+ // get the collection of this ManagedHSMKeyResource
+ ManagedHSMKeyCollection collection = managedHsm.GetManagedHSMKeys();
+
+ // invoke the operation
+ string keyName = "sample-key-name";
+ NullableResponse response = await collection.GetIfExistsAsync(keyName);
+ ManagedHSMKeyResource result = response.HasValue ? response.Value : null;
+
+ if (result == null)
+ {
+ Console.WriteLine($"Succeeded with null as result");
+ }
+ else
+ {
+ // the variable result is a resource, you could call other operations on this instance as well
+ // but just for demo, we get its data from this resource instance
+ ManagedHsmKeyData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+ }
+
+ // List keys in the managed HSM
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task GetAll_ListKeysInTheManagedHSM()
+ {
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/managedHsmListKeys.json
+ // this example is just showing the usage of "ManagedHsmKeys_List" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this ManagedHsmResource created on azure
+ // for more information of creating ManagedHsmResource, please refer to the document of ManagedHsmResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "sample-group";
+ string name = "sample-managedhsm-name";
+ ResourceIdentifier managedHsmResourceId = ManagedHsmResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name);
+ ManagedHsmResource managedHsm = client.GetManagedHsmResource(managedHsmResourceId);
+
+ // get the collection of this ManagedHSMKeyResource
+ ManagedHSMKeyCollection collection = managedHsm.GetManagedHSMKeys();
+
+ // invoke the operation and iterate over the result
+ await foreach (ManagedHSMKeyResource item in collection.GetAllAsync())
+ {
+ // the variable item is a resource, you could call other operations on this instance as well
+ // but just for demo, we get its data from this resource instance
+ ManagedHsmKeyData resourceData = item.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ Console.WriteLine($"Succeeded");
+ }
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ManagedHSMKeyResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ManagedHSMKeyResource.cs
new file mode 100644
index 0000000000000..4be0549e3c5ef
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ManagedHSMKeyResource.cs
@@ -0,0 +1,87 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading.Tasks;
+using Azure.Core;
+using Azure.Identity;
+using Azure.ResourceManager.KeyVault.Models;
+
+namespace Azure.ResourceManager.KeyVault.Samples
+{
+ public partial class Sample_ManagedHSMKeyResource
+ {
+ // Create a key
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Update_CreateAKey()
+ {
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/managedHsmCreateKey.json
+ // this example is just showing the usage of "ManagedHsmKeys_CreateIfNotExist" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this ManagedHSMKeyResource created on azure
+ // for more information of creating ManagedHSMKeyResource, please refer to the document of ManagedHSMKeyResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "sample-group";
+ string name = "sample-managedhsm-name";
+ string keyName = "sample-key-name";
+ ResourceIdentifier managedHSMKeyResourceId = ManagedHSMKeyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, keyName);
+ ManagedHSMKeyResource managedHSMKey = client.GetManagedHSMKeyResource(managedHSMKeyResourceId);
+
+ // invoke the operation
+ ManagedHSMKeyCreateOrUpdateContent content = new ManagedHSMKeyCreateOrUpdateContent(new ManagedHsmKeyProperties()
+ {
+ Kty = JsonWebKeyType.RSA,
+ });
+ ArmOperation lro = await managedHSMKey.UpdateAsync(WaitUntil.Completed, content);
+ ManagedHSMKeyResource result = lro.Value;
+
+ // the variable result is a resource, you could call other operations on this instance as well
+ // but just for demo, we get its data from this resource instance
+ ManagedHsmKeyData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // Get a key
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_GetAKey()
+ {
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/managedHsmGetKey.json
+ // this example is just showing the usage of "ManagedHsmKeys_Get" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this ManagedHSMKeyResource created on azure
+ // for more information of creating ManagedHSMKeyResource, please refer to the document of ManagedHSMKeyResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "sample-group";
+ string name = "sample-managedhsm-name";
+ string keyName = "sample-key-name";
+ ResourceIdentifier managedHSMKeyResourceId = ManagedHSMKeyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, keyName);
+ ManagedHSMKeyResource managedHSMKey = client.GetManagedHSMKeyResource(managedHSMKeyResourceId);
+
+ // invoke the operation
+ ManagedHSMKeyResource result = await managedHSMKey.GetAsync();
+
+ // the variable result is a resource, you could call other operations on this instance as well
+ // but just for demo, we get its data from this resource instance
+ ManagedHsmKeyData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ManagedHSMKeyVersionCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ManagedHSMKeyVersionCollection.cs
new file mode 100644
index 0000000000000..0670642abbb1a
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ManagedHSMKeyVersionCollection.cs
@@ -0,0 +1,167 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading.Tasks;
+using Azure.Core;
+using Azure.Identity;
+
+namespace Azure.ResourceManager.KeyVault.Samples
+{
+ public partial class Sample_ManagedHSMKeyVersionCollection
+ {
+ // Get a key version
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_GetAKeyVersion()
+ {
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/managedHsmGetKeyVersion.json
+ // this example is just showing the usage of "ManagedHsmKeys_GetVersion" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this ManagedHSMKeyResource created on azure
+ // for more information of creating ManagedHSMKeyResource, please refer to the document of ManagedHSMKeyResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "sample-group";
+ string name = "sample-managedhsm-name";
+ string keyName = "sample-key-name";
+ ResourceIdentifier managedHSMKeyResourceId = ManagedHSMKeyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, keyName);
+ ManagedHSMKeyResource managedHSMKey = client.GetManagedHSMKeyResource(managedHSMKeyResourceId);
+
+ // get the collection of this ManagedHSMKeyVersionResource
+ ManagedHSMKeyVersionCollection collection = managedHSMKey.GetManagedHSMKeyVersions();
+
+ // invoke the operation
+ string keyVersion = "fd618d9519b74f9aae94ade66b876acc";
+ ManagedHSMKeyVersionResource result = await collection.GetAsync(keyVersion);
+
+ // the variable result is a resource, you could call other operations on this instance as well
+ // but just for demo, we get its data from this resource instance
+ ManagedHsmKeyData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // Get a key version
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Exists_GetAKeyVersion()
+ {
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/managedHsmGetKeyVersion.json
+ // this example is just showing the usage of "ManagedHsmKeys_GetVersion" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this ManagedHSMKeyResource created on azure
+ // for more information of creating ManagedHSMKeyResource, please refer to the document of ManagedHSMKeyResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "sample-group";
+ string name = "sample-managedhsm-name";
+ string keyName = "sample-key-name";
+ ResourceIdentifier managedHSMKeyResourceId = ManagedHSMKeyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, keyName);
+ ManagedHSMKeyResource managedHSMKey = client.GetManagedHSMKeyResource(managedHSMKeyResourceId);
+
+ // get the collection of this ManagedHSMKeyVersionResource
+ ManagedHSMKeyVersionCollection collection = managedHSMKey.GetManagedHSMKeyVersions();
+
+ // invoke the operation
+ string keyVersion = "fd618d9519b74f9aae94ade66b876acc";
+ bool result = await collection.ExistsAsync(keyVersion);
+
+ Console.WriteLine($"Succeeded: {result}");
+ }
+
+ // Get a key version
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task GetIfExists_GetAKeyVersion()
+ {
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/managedHsmGetKeyVersion.json
+ // this example is just showing the usage of "ManagedHsmKeys_GetVersion" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this ManagedHSMKeyResource created on azure
+ // for more information of creating ManagedHSMKeyResource, please refer to the document of ManagedHSMKeyResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "sample-group";
+ string name = "sample-managedhsm-name";
+ string keyName = "sample-key-name";
+ ResourceIdentifier managedHSMKeyResourceId = ManagedHSMKeyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, keyName);
+ ManagedHSMKeyResource managedHSMKey = client.GetManagedHSMKeyResource(managedHSMKeyResourceId);
+
+ // get the collection of this ManagedHSMKeyVersionResource
+ ManagedHSMKeyVersionCollection collection = managedHSMKey.GetManagedHSMKeyVersions();
+
+ // invoke the operation
+ string keyVersion = "fd618d9519b74f9aae94ade66b876acc";
+ NullableResponse response = await collection.GetIfExistsAsync(keyVersion);
+ ManagedHSMKeyVersionResource result = response.HasValue ? response.Value : null;
+
+ if (result == null)
+ {
+ Console.WriteLine($"Succeeded with null as result");
+ }
+ else
+ {
+ // the variable result is a resource, you could call other operations on this instance as well
+ // but just for demo, we get its data from this resource instance
+ ManagedHsmKeyData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+ }
+
+ // List key versions in the managed HSM
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task GetAll_ListKeyVersionsInTheManagedHSM()
+ {
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/managedHsmListKeyVersions.json
+ // this example is just showing the usage of "ManagedHsmKeys_ListVersions" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this ManagedHSMKeyResource created on azure
+ // for more information of creating ManagedHSMKeyResource, please refer to the document of ManagedHSMKeyResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "sample-group";
+ string name = "sample-managedhsm-name";
+ string keyName = "sample-key-name";
+ ResourceIdentifier managedHSMKeyResourceId = ManagedHSMKeyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, keyName);
+ ManagedHSMKeyResource managedHSMKey = client.GetManagedHSMKeyResource(managedHSMKeyResourceId);
+
+ // get the collection of this ManagedHSMKeyVersionResource
+ ManagedHSMKeyVersionCollection collection = managedHSMKey.GetManagedHSMKeyVersions();
+
+ // invoke the operation and iterate over the result
+ await foreach (ManagedHSMKeyVersionResource item in collection.GetAllAsync())
+ {
+ // the variable item is a resource, you could call other operations on this instance as well
+ // but just for demo, we get its data from this resource instance
+ ManagedHsmKeyData resourceData = item.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ Console.WriteLine($"Succeeded");
+ }
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ManagedHSMKeyVersionResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ManagedHSMKeyVersionResource.cs
new file mode 100644
index 0000000000000..e3263f9e22ae9
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ManagedHSMKeyVersionResource.cs
@@ -0,0 +1,50 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading.Tasks;
+using Azure.Core;
+using Azure.Identity;
+
+namespace Azure.ResourceManager.KeyVault.Samples
+{
+ public partial class Sample_ManagedHSMKeyVersionResource
+ {
+ // Get a key version
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_GetAKeyVersion()
+ {
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/managedHsmGetKeyVersion.json
+ // this example is just showing the usage of "ManagedHsmKeys_GetVersion" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this ManagedHSMKeyVersionResource created on azure
+ // for more information of creating ManagedHSMKeyVersionResource, please refer to the document of ManagedHSMKeyVersionResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "sample-group";
+ string name = "sample-managedhsm-name";
+ string keyName = "sample-key-name";
+ string keyVersion = "fd618d9519b74f9aae94ade66b876acc";
+ ResourceIdentifier managedHSMKeyVersionResourceId = ManagedHSMKeyVersionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, keyName, keyVersion);
+ ManagedHSMKeyVersionResource managedHSMKeyVersion = client.GetManagedHSMKeyVersionResource(managedHSMKeyVersionResourceId);
+
+ // invoke the operation
+ ManagedHSMKeyVersionResource result = await managedHSMKeyVersion.GetAsync();
+
+ // the variable result is a resource, you could call other operations on this instance as well
+ // but just for demo, we get its data from this resource instance
+ ManagedHsmKeyData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ManagedHsmCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ManagedHsmCollection.cs
index 717b927dca85d..c93002c50c556 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ManagedHsmCollection.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ManagedHsmCollection.cs
@@ -21,7 +21,7 @@ public partial class Sample_ManagedHsmCollection
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task CreateOrUpdate_CreateANewManagedHSMPoolOrUpdateAnExistingManagedHSMPool()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/ManagedHsm_CreateOrUpdate.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/ManagedHsm_CreateOrUpdate.json
// this example is just showing the usage of "ManagedHsms_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -76,7 +76,7 @@ public async Task CreateOrUpdate_CreateANewManagedHSMPoolOrUpdateAnExistingManag
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task Get_RetrieveAManagedHSMPool()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/ManagedHsm_Get.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/ManagedHsm_Get.json
// this example is just showing the usage of "ManagedHsms_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -110,7 +110,7 @@ public async Task Get_RetrieveAManagedHSMPool()
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task Exists_RetrieveAManagedHSMPool()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/ManagedHsm_Get.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/ManagedHsm_Get.json
// this example is just showing the usage of "ManagedHsms_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -140,7 +140,7 @@ public async Task Exists_RetrieveAManagedHSMPool()
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task GetIfExists_RetrieveAManagedHSMPool()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/ManagedHsm_Get.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/ManagedHsm_Get.json
// this example is just showing the usage of "ManagedHsms_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -182,7 +182,7 @@ public async Task GetIfExists_RetrieveAManagedHSMPool()
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task GetAll_ListManagedHSMPoolsInAResourceGroup()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/ManagedHsm_ListByResourceGroup.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/ManagedHsm_ListByResourceGroup.json
// this example is just showing the usage of "ManagedHsms_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ManagedHsmPrivateEndpointConnectionCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ManagedHsmPrivateEndpointConnectionCollection.cs
index 73ea7f30ba698..e6164c9ed374f 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ManagedHsmPrivateEndpointConnectionCollection.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ManagedHsmPrivateEndpointConnectionCollection.cs
@@ -20,7 +20,7 @@ public partial class Sample_ManagedHsmPrivateEndpointConnectionCollection
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task GetAll_ListManagedHSMPoolsInASubscription()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/ManagedHsm_ListPrivateEndpointConnectionsByResource.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/ManagedHsm_ListPrivateEndpointConnectionsByResource.json
// this example is just showing the usage of "MHSMPrivateEndpointConnections_ListByResource" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -57,7 +57,7 @@ public async Task GetAll_ListManagedHSMPoolsInASubscription()
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task Get_ManagedHsmGetPrivateEndpointConnection()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/ManagedHsm_getPrivateEndpointConnection.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/ManagedHsm_getPrivateEndpointConnection.json
// this example is just showing the usage of "MHSMPrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -92,7 +92,7 @@ public async Task Get_ManagedHsmGetPrivateEndpointConnection()
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task Exists_ManagedHsmGetPrivateEndpointConnection()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/ManagedHsm_getPrivateEndpointConnection.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/ManagedHsm_getPrivateEndpointConnection.json
// this example is just showing the usage of "MHSMPrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -123,7 +123,7 @@ public async Task Exists_ManagedHsmGetPrivateEndpointConnection()
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task GetIfExists_ManagedHsmGetPrivateEndpointConnection()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/ManagedHsm_getPrivateEndpointConnection.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/ManagedHsm_getPrivateEndpointConnection.json
// this example is just showing the usage of "MHSMPrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -166,7 +166,7 @@ public async Task GetIfExists_ManagedHsmGetPrivateEndpointConnection()
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task CreateOrUpdate_ManagedHsmPutPrivateEndpointConnection()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/ManagedHsm_putPrivateEndpointConnection.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/ManagedHsm_putPrivateEndpointConnection.json
// this example is just showing the usage of "MHSMPrivateEndpointConnections_Put" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ManagedHsmPrivateEndpointConnectionResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ManagedHsmPrivateEndpointConnectionResource.cs
index 318f38995beed..43edf63714033 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ManagedHsmPrivateEndpointConnectionResource.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ManagedHsmPrivateEndpointConnectionResource.cs
@@ -20,7 +20,7 @@ public partial class Sample_ManagedHsmPrivateEndpointConnectionResource
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task Get_ManagedHsmGetPrivateEndpointConnection()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/ManagedHsm_getPrivateEndpointConnection.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/ManagedHsm_getPrivateEndpointConnection.json
// this example is just showing the usage of "MHSMPrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -52,7 +52,7 @@ public async Task Get_ManagedHsmGetPrivateEndpointConnection()
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task Update_ManagedHsmPutPrivateEndpointConnection()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/ManagedHsm_putPrivateEndpointConnection.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/ManagedHsm_putPrivateEndpointConnection.json
// this example is just showing the usage of "MHSMPrivateEndpointConnections_Put" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -93,7 +93,7 @@ public async Task Update_ManagedHsmPutPrivateEndpointConnection()
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task Delete_ManagedHsmDeletePrivateEndpointConnection()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/ManagedHsm_deletePrivateEndpointConnection.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/ManagedHsm_deletePrivateEndpointConnection.json
// this example is just showing the usage of "MHSMPrivateEndpointConnections_Delete" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ManagedHsmResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ManagedHsmResource.cs
index 1f315579c789b..0a294376790d0 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ManagedHsmResource.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ManagedHsmResource.cs
@@ -21,7 +21,7 @@ public partial class Sample_ManagedHsmResource
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task Update_UpdateAnExistingManagedHSMPool()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/ManagedHsm_Update.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/ManagedHsm_Update.json
// this example is just showing the usage of "ManagedHsms_Update" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -62,7 +62,7 @@ public async Task Update_UpdateAnExistingManagedHSMPool()
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task Delete_DeleteAManagedHSMPool()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/ManagedHsm_Delete.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/ManagedHsm_Delete.json
// this example is just showing the usage of "ManagedHsms_Delete" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -89,7 +89,7 @@ public async Task Delete_DeleteAManagedHSMPool()
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task Get_RetrieveAManagedHSMPool()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/ManagedHsm_Get.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/ManagedHsm_Get.json
// this example is just showing the usage of "ManagedHsms_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -120,7 +120,7 @@ public async Task Get_RetrieveAManagedHSMPool()
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task GetManagedHsms_ListManagedHSMPoolsInASubscription()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/ManagedHsm_ListBySubscription.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/ManagedHsm_ListBySubscription.json
// this example is just showing the usage of "ManagedHsms_ListBySubscription" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -152,7 +152,7 @@ public async Task GetManagedHsms_ListManagedHSMPoolsInASubscription()
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task CheckManagedHsmNameAvailability_ValidateAManagedHsmName()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/ManagedHsm_checkMhsmNameAvailability.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/ManagedHsm_checkMhsmNameAvailability.json
// this example is just showing the usage of "ManagedHsms_CheckManagedHsmNameAvailability" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -178,7 +178,7 @@ public async Task CheckManagedHsmNameAvailability_ValidateAManagedHsmName()
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task GetMHSMPrivateLinkResourcesByManagedHsmResource_KeyVaultListPrivateLinkResources()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/ManagedHsm_listPrivateLinkResources.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/ManagedHsm_listPrivateLinkResources.json
// this example is just showing the usage of "MHSMPrivateLinkResources_ListByManagedHsmResource" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -208,7 +208,7 @@ public async Task GetMHSMPrivateLinkResourcesByManagedHsmResource_KeyVaultListPr
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task GetMHSMRegionsByResource_ListManagedHSMPoolsInASubscription()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/ManagedHsm_ListRegionsByResource.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/ManagedHsm_ListRegionsByResource.json
// this example is just showing the usage of "MHSMRegions_ListByResource" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs
index 6eee45c18d418..435f81d3e9795 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs
@@ -20,7 +20,7 @@ public partial class Sample_SubscriptionResourceExtensions
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task GetDeletedKeyVaults_ListDeletedVaultsInTheSpecifiedSubscription()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/listDeletedVaults.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/listDeletedVaults.json
// this example is just showing the usage of "Vaults_ListDeleted" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
@@ -52,7 +52,7 @@ public async Task GetDeletedKeyVaults_ListDeletedVaultsInTheSpecifiedSubscriptio
[NUnit.Framework.Ignore("Only verifying that the sample builds")]
public async Task GetDeletedManagedHsms_ListDeletedManagedHSMsInTheSpecifiedSubscription()
{
- // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-02-01/examples/DeletedManagedHsm_List.json
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/DeletedManagedHsm_List.json
// this example is just showing the usage of "ManagedHsms_ListDeleted" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_VaultKeyCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_VaultKeyCollection.cs
new file mode 100644
index 0000000000000..ec4e8a88be62c
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_VaultKeyCollection.cs
@@ -0,0 +1,204 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading.Tasks;
+using Azure.Core;
+using Azure.Identity;
+using Azure.ResourceManager.KeyVault.Models;
+
+namespace Azure.ResourceManager.KeyVault.Samples
+{
+ public partial class Sample_VaultKeyCollection
+ {
+ // Create a key
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task CreateOrUpdate_CreateAKey()
+ {
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/createKey.json
+ // this example is just showing the usage of "Keys_CreateIfNotExist" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this KeyVaultResource created on azure
+ // for more information of creating KeyVaultResource, please refer to the document of KeyVaultResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "sample-group";
+ string vaultName = "sample-vault-name";
+ ResourceIdentifier keyVaultResourceId = KeyVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName);
+ KeyVaultResource keyVault = client.GetKeyVaultResource(keyVaultResourceId);
+
+ // get the collection of this VaultKeyResource
+ VaultKeyCollection collection = keyVault.GetVaultKeys();
+
+ // invoke the operation
+ string keyName = "sample-key-name";
+ VaultKeyCreateOrUpdateContent content = new VaultKeyCreateOrUpdateContent(new KeyProperties()
+ {
+ Kty = JsonWebKeyType.RSA,
+ });
+ ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, keyName, content);
+ VaultKeyResource result = lro.Value;
+
+ // the variable result is a resource, you could call other operations on this instance as well
+ // but just for demo, we get its data from this resource instance
+ KeyData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // Get a key
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_GetAKey()
+ {
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/getKey.json
+ // this example is just showing the usage of "Keys_Get" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this KeyVaultResource created on azure
+ // for more information of creating KeyVaultResource, please refer to the document of KeyVaultResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "sample-group";
+ string vaultName = "sample-vault-name";
+ ResourceIdentifier keyVaultResourceId = KeyVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName);
+ KeyVaultResource keyVault = client.GetKeyVaultResource(keyVaultResourceId);
+
+ // get the collection of this VaultKeyResource
+ VaultKeyCollection collection = keyVault.GetVaultKeys();
+
+ // invoke the operation
+ string keyName = "sample-key-name";
+ VaultKeyResource result = await collection.GetAsync(keyName);
+
+ // the variable result is a resource, you could call other operations on this instance as well
+ // but just for demo, we get its data from this resource instance
+ KeyData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // Get a key
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Exists_GetAKey()
+ {
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/getKey.json
+ // this example is just showing the usage of "Keys_Get" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this KeyVaultResource created on azure
+ // for more information of creating KeyVaultResource, please refer to the document of KeyVaultResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "sample-group";
+ string vaultName = "sample-vault-name";
+ ResourceIdentifier keyVaultResourceId = KeyVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName);
+ KeyVaultResource keyVault = client.GetKeyVaultResource(keyVaultResourceId);
+
+ // get the collection of this VaultKeyResource
+ VaultKeyCollection collection = keyVault.GetVaultKeys();
+
+ // invoke the operation
+ string keyName = "sample-key-name";
+ bool result = await collection.ExistsAsync(keyName);
+
+ Console.WriteLine($"Succeeded: {result}");
+ }
+
+ // Get a key
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task GetIfExists_GetAKey()
+ {
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/getKey.json
+ // this example is just showing the usage of "Keys_Get" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this KeyVaultResource created on azure
+ // for more information of creating KeyVaultResource, please refer to the document of KeyVaultResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "sample-group";
+ string vaultName = "sample-vault-name";
+ ResourceIdentifier keyVaultResourceId = KeyVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName);
+ KeyVaultResource keyVault = client.GetKeyVaultResource(keyVaultResourceId);
+
+ // get the collection of this VaultKeyResource
+ VaultKeyCollection collection = keyVault.GetVaultKeys();
+
+ // invoke the operation
+ string keyName = "sample-key-name";
+ NullableResponse response = await collection.GetIfExistsAsync(keyName);
+ VaultKeyResource result = response.HasValue ? response.Value : null;
+
+ if (result == null)
+ {
+ Console.WriteLine($"Succeeded with null as result");
+ }
+ else
+ {
+ // the variable result is a resource, you could call other operations on this instance as well
+ // but just for demo, we get its data from this resource instance
+ KeyData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+ }
+
+ // List keys in the vault
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task GetAll_ListKeysInTheVault()
+ {
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/listKeys.json
+ // this example is just showing the usage of "Keys_List" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this KeyVaultResource created on azure
+ // for more information of creating KeyVaultResource, please refer to the document of KeyVaultResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "sample-group";
+ string vaultName = "sample-vault-name";
+ ResourceIdentifier keyVaultResourceId = KeyVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName);
+ KeyVaultResource keyVault = client.GetKeyVaultResource(keyVaultResourceId);
+
+ // get the collection of this VaultKeyResource
+ VaultKeyCollection collection = keyVault.GetVaultKeys();
+
+ // invoke the operation and iterate over the result
+ await foreach (VaultKeyResource item in collection.GetAllAsync())
+ {
+ // the variable item is a resource, you could call other operations on this instance as well
+ // but just for demo, we get its data from this resource instance
+ KeyData resourceData = item.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ Console.WriteLine($"Succeeded");
+ }
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_VaultKeyResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_VaultKeyResource.cs
new file mode 100644
index 0000000000000..088244b70235e
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_VaultKeyResource.cs
@@ -0,0 +1,87 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading.Tasks;
+using Azure.Core;
+using Azure.Identity;
+using Azure.ResourceManager.KeyVault.Models;
+
+namespace Azure.ResourceManager.KeyVault.Samples
+{
+ public partial class Sample_VaultKeyResource
+ {
+ // Create a key
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Update_CreateAKey()
+ {
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/createKey.json
+ // this example is just showing the usage of "Keys_CreateIfNotExist" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this VaultKeyResource created on azure
+ // for more information of creating VaultKeyResource, please refer to the document of VaultKeyResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "sample-group";
+ string vaultName = "sample-vault-name";
+ string keyName = "sample-key-name";
+ ResourceIdentifier vaultKeyResourceId = VaultKeyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName, keyName);
+ VaultKeyResource vaultKey = client.GetVaultKeyResource(vaultKeyResourceId);
+
+ // invoke the operation
+ VaultKeyCreateOrUpdateContent content = new VaultKeyCreateOrUpdateContent(new KeyProperties()
+ {
+ Kty = JsonWebKeyType.RSA,
+ });
+ ArmOperation lro = await vaultKey.UpdateAsync(WaitUntil.Completed, content);
+ VaultKeyResource result = lro.Value;
+
+ // the variable result is a resource, you could call other operations on this instance as well
+ // but just for demo, we get its data from this resource instance
+ KeyData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // Get a key
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_GetAKey()
+ {
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/getKey.json
+ // this example is just showing the usage of "Keys_Get" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this VaultKeyResource created on azure
+ // for more information of creating VaultKeyResource, please refer to the document of VaultKeyResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "sample-group";
+ string vaultName = "sample-vault-name";
+ string keyName = "sample-key-name";
+ ResourceIdentifier vaultKeyResourceId = VaultKeyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName, keyName);
+ VaultKeyResource vaultKey = client.GetVaultKeyResource(vaultKeyResourceId);
+
+ // invoke the operation
+ VaultKeyResource result = await vaultKey.GetAsync();
+
+ // the variable result is a resource, you could call other operations on this instance as well
+ // but just for demo, we get its data from this resource instance
+ KeyData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_VaultKeyVersionCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_VaultKeyVersionCollection.cs
new file mode 100644
index 0000000000000..e2755edb1fbde
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_VaultKeyVersionCollection.cs
@@ -0,0 +1,167 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading.Tasks;
+using Azure.Core;
+using Azure.Identity;
+
+namespace Azure.ResourceManager.KeyVault.Samples
+{
+ public partial class Sample_VaultKeyVersionCollection
+ {
+ // Get a key version
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_GetAKeyVersion()
+ {
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/getKeyVersion.json
+ // this example is just showing the usage of "Keys_GetVersion" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this VaultKeyResource created on azure
+ // for more information of creating VaultKeyResource, please refer to the document of VaultKeyResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "sample-group";
+ string vaultName = "sample-vault-name";
+ string keyName = "sample-key-name";
+ ResourceIdentifier vaultKeyResourceId = VaultKeyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName, keyName);
+ VaultKeyResource vaultKey = client.GetVaultKeyResource(vaultKeyResourceId);
+
+ // get the collection of this VaultKeyVersionResource
+ VaultKeyVersionCollection collection = vaultKey.GetVaultKeyVersions();
+
+ // invoke the operation
+ string keyVersion = "fd618d9519b74f9aae94ade66b876acc";
+ VaultKeyVersionResource result = await collection.GetAsync(keyVersion);
+
+ // the variable result is a resource, you could call other operations on this instance as well
+ // but just for demo, we get its data from this resource instance
+ KeyData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // Get a key version
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Exists_GetAKeyVersion()
+ {
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/getKeyVersion.json
+ // this example is just showing the usage of "Keys_GetVersion" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this VaultKeyResource created on azure
+ // for more information of creating VaultKeyResource, please refer to the document of VaultKeyResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "sample-group";
+ string vaultName = "sample-vault-name";
+ string keyName = "sample-key-name";
+ ResourceIdentifier vaultKeyResourceId = VaultKeyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName, keyName);
+ VaultKeyResource vaultKey = client.GetVaultKeyResource(vaultKeyResourceId);
+
+ // get the collection of this VaultKeyVersionResource
+ VaultKeyVersionCollection collection = vaultKey.GetVaultKeyVersions();
+
+ // invoke the operation
+ string keyVersion = "fd618d9519b74f9aae94ade66b876acc";
+ bool result = await collection.ExistsAsync(keyVersion);
+
+ Console.WriteLine($"Succeeded: {result}");
+ }
+
+ // Get a key version
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task GetIfExists_GetAKeyVersion()
+ {
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/getKeyVersion.json
+ // this example is just showing the usage of "Keys_GetVersion" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this VaultKeyResource created on azure
+ // for more information of creating VaultKeyResource, please refer to the document of VaultKeyResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "sample-group";
+ string vaultName = "sample-vault-name";
+ string keyName = "sample-key-name";
+ ResourceIdentifier vaultKeyResourceId = VaultKeyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName, keyName);
+ VaultKeyResource vaultKey = client.GetVaultKeyResource(vaultKeyResourceId);
+
+ // get the collection of this VaultKeyVersionResource
+ VaultKeyVersionCollection collection = vaultKey.GetVaultKeyVersions();
+
+ // invoke the operation
+ string keyVersion = "fd618d9519b74f9aae94ade66b876acc";
+ NullableResponse response = await collection.GetIfExistsAsync(keyVersion);
+ VaultKeyVersionResource result = response.HasValue ? response.Value : null;
+
+ if (result == null)
+ {
+ Console.WriteLine($"Succeeded with null as result");
+ }
+ else
+ {
+ // the variable result is a resource, you could call other operations on this instance as well
+ // but just for demo, we get its data from this resource instance
+ KeyData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+ }
+
+ // List key versions in the vault
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task GetAll_ListKeyVersionsInTheVault()
+ {
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/listKeyVersions.json
+ // this example is just showing the usage of "Keys_ListVersions" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this VaultKeyResource created on azure
+ // for more information of creating VaultKeyResource, please refer to the document of VaultKeyResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "sample-group";
+ string vaultName = "sample-vault-name";
+ string keyName = "sample-key-name";
+ ResourceIdentifier vaultKeyResourceId = VaultKeyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName, keyName);
+ VaultKeyResource vaultKey = client.GetVaultKeyResource(vaultKeyResourceId);
+
+ // get the collection of this VaultKeyVersionResource
+ VaultKeyVersionCollection collection = vaultKey.GetVaultKeyVersions();
+
+ // invoke the operation and iterate over the result
+ await foreach (VaultKeyVersionResource item in collection.GetAllAsync())
+ {
+ // the variable item is a resource, you could call other operations on this instance as well
+ // but just for demo, we get its data from this resource instance
+ KeyData resourceData = item.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ Console.WriteLine($"Succeeded");
+ }
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_VaultKeyVersionResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_VaultKeyVersionResource.cs
new file mode 100644
index 0000000000000..51ffb78dceb2e
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_VaultKeyVersionResource.cs
@@ -0,0 +1,50 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading.Tasks;
+using Azure.Core;
+using Azure.Identity;
+
+namespace Azure.ResourceManager.KeyVault.Samples
+{
+ public partial class Sample_VaultKeyVersionResource
+ {
+ // Get a key version
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_GetAKeyVersion()
+ {
+ // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/getKeyVersion.json
+ // this example is just showing the usage of "Keys_GetVersion" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this VaultKeyVersionResource created on azure
+ // for more information of creating VaultKeyVersionResource, please refer to the document of VaultKeyVersionResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "sample-group";
+ string vaultName = "sample-vault-name";
+ string keyName = "sample-key-name";
+ string keyVersion = "fd618d9519b74f9aae94ade66b876acc";
+ ResourceIdentifier vaultKeyVersionResourceId = VaultKeyVersionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName, keyName, keyVersion);
+ VaultKeyVersionResource vaultKeyVersion = client.GetVaultKeyVersionResource(vaultKeyVersionResourceId);
+
+ // invoke the operation
+ VaultKeyVersionResource result = await vaultKeyVersion.GetAsync();
+
+ // the variable result is a resource, you could call other operations on this instance as well
+ // but just for demo, we get its data from this resource instance
+ KeyData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ArmKeyVaultModelFactory.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ArmKeyVaultModelFactory.cs
index c078290f6dcca..cd5db8df693e3 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ArmKeyVaultModelFactory.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ArmKeyVaultModelFactory.cs
@@ -7,6 +7,7 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel;
using System.Linq;
using Azure.Core;
using Azure.ResourceManager.Models;
@@ -16,6 +17,228 @@ namespace Azure.ResourceManager.KeyVault.Models
/// Model factory for models.
public static partial class ArmKeyVaultModelFactory
{
+ /// Initializes a new instance of .
+ /// The tags that will be assigned to the key.
+ /// The properties of the key to be created.
+ /// A new instance for mocking.
+ public static VaultKeyCreateOrUpdateContent VaultKeyCreateOrUpdateContent(IDictionary tags = null, KeyProperties properties = null)
+ {
+ tags ??= new Dictionary();
+
+ return new VaultKeyCreateOrUpdateContent(tags, properties, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The attributes of the key.
+ /// The type of the key. For valid values, see JsonWebKeyType.
+ ///
+ /// The key size in bits. For example: 2048, 3072, or 4096 for RSA.
+ /// The elliptic curve name. For valid values, see JsonWebKeyCurveName.
+ /// The URI to retrieve the current version of the key.
+ /// The URI to retrieve the specific version of the key.
+ /// Key rotation policy in response. It will be used for both output and input. Omitted if empty.
+ /// Key release policy in response. It will be used for both output and input. Omitted if empty.
+ /// A new instance for mocking.
+ public static KeyProperties KeyProperties(KeyAttributes attributes = null, JsonWebKeyType? kty = null, IEnumerable keyOps = null, int? keySize = null, JsonWebKeyCurveName? curveName = null, Uri keyUri = null, string keyUriWithVersion = null, RotationPolicy rotationPolicy = null, KeyReleasePolicy releasePolicy = null)
+ {
+ keyOps ??= new List();
+
+ return new KeyProperties(
+ attributes,
+ kty,
+ keyOps?.ToList(),
+ keySize,
+ curveName,
+ keyUri,
+ keyUriWithVersion,
+ rotationPolicy,
+ releasePolicy,
+ serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// Determines whether or not the object is enabled.
+ /// Not before date in seconds since 1970-01-01T00:00:00Z.
+ /// Expiry date in seconds since 1970-01-01T00:00:00Z.
+ /// Creation time in seconds since 1970-01-01T00:00:00Z.
+ /// Last updated time in seconds since 1970-01-01T00:00:00Z.
+ /// The deletion recovery level currently in effect for the object. If it contains 'Purgeable', then the object can be permanently deleted by a privileged user; otherwise, only the system can purge the object at the end of the retention interval.
+ /// Indicates if the private key can be exported.
+ /// A new instance for mocking.
+ public static KeyAttributes KeyAttributes(bool? enabled = null, long? notBefore = null, long? expires = null, long? created = null, long? updated = null, DeletionRecoveryLevel? recoveryLevel = null, bool? exportable = null)
+ {
+ return new KeyAttributes(
+ enabled,
+ notBefore,
+ expires,
+ created,
+ updated,
+ recoveryLevel,
+ exportable,
+ serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// Creation time in seconds since 1970-01-01T00:00:00Z.
+ /// Last updated time in seconds since 1970-01-01T00:00:00Z.
+ /// The expiration time for the new key version. It should be in ISO8601 format. Eg: 'P90D', 'P1Y'.
+ /// A new instance for mocking.
+ public static KeyRotationPolicyAttributes KeyRotationPolicyAttributes(long? created = null, long? updated = null, string expiryTime = null)
+ {
+ return new KeyRotationPolicyAttributes(created, updated, expiryTime, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The id.
+ /// The name.
+ /// The resourceType.
+ /// The systemData.
+ /// The attributes of the key.
+ /// The type of the key. For valid values, see JsonWebKeyType.
+ ///
+ /// The key size in bits. For example: 2048, 3072, or 4096 for RSA.
+ /// The elliptic curve name. For valid values, see JsonWebKeyCurveName.
+ /// The URI to retrieve the current version of the key.
+ /// The URI to retrieve the specific version of the key.
+ /// Key rotation policy in response. It will be used for both output and input. Omitted if empty.
+ /// Key release policy in response. It will be used for both output and input. Omitted if empty.
+ /// Azure location of the key vault resource.
+ /// Tags assigned to the key vault resource.
+ /// A new instance for mocking.
+ public static KeyData KeyData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, KeyAttributes attributes = null, JsonWebKeyType? kty = null, IEnumerable keyOps = null, int? keySize = null, JsonWebKeyCurveName? curveName = null, Uri keyUri = null, string keyUriWithVersion = null, RotationPolicy rotationPolicy = null, KeyReleasePolicy releasePolicy = null, AzureLocation? location = null, IReadOnlyDictionary tags = null)
+ {
+ keyOps ??= new List();
+ tags ??= new Dictionary();
+
+ return new KeyData(
+ id,
+ name,
+ resourceType,
+ systemData,
+ attributes,
+ kty,
+ keyOps?.ToList(),
+ keySize,
+ curveName,
+ keyUri,
+ keyUriWithVersion,
+ rotationPolicy,
+ releasePolicy,
+ location,
+ tags,
+ serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The tags that will be assigned to the key.
+ /// The properties of the key to be created.
+ /// A new instance for mocking.
+ public static ManagedHSMKeyCreateOrUpdateContent ManagedHSMKeyCreateOrUpdateContent(IDictionary tags = null, ManagedHsmKeyProperties properties = null)
+ {
+ tags ??= new Dictionary();
+
+ return new ManagedHSMKeyCreateOrUpdateContent(tags, properties, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The attributes of the key.
+ /// The type of the key. For valid values, see JsonWebKeyType.
+ ///
+ /// The key size in bits. For example: 2048, 3072, or 4096 for RSA.
+ /// The elliptic curve name. For valid values, see JsonWebKeyCurveName.
+ /// The URI to retrieve the current version of the key.
+ /// The URI to retrieve the specific version of the key.
+ /// Key rotation policy in response. It will be used for both output and input. Omitted if empty.
+ /// Key release policy in response. It will be used for both output and input. Omitted if empty.
+ /// A new instance for mocking.
+ public static ManagedHsmKeyProperties ManagedHsmKeyProperties(ManagedHsmKeyAttributes attributes = null, JsonWebKeyType? kty = null, IEnumerable keyOps = null, int? keySize = null, JsonWebKeyCurveName? curveName = null, Uri keyUri = null, string keyUriWithVersion = null, ManagedHsmRotationPolicy rotationPolicy = null, ManagedHsmKeyReleasePolicy releasePolicy = null)
+ {
+ keyOps ??= new List();
+
+ return new ManagedHsmKeyProperties(
+ attributes,
+ kty,
+ keyOps?.ToList(),
+ keySize,
+ curveName,
+ keyUri,
+ keyUriWithVersion,
+ rotationPolicy,
+ releasePolicy,
+ serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// Determines whether or not the object is enabled.
+ /// Not before date in seconds since 1970-01-01T00:00:00Z.
+ /// Expiry date in seconds since 1970-01-01T00:00:00Z.
+ /// Creation time in seconds since 1970-01-01T00:00:00Z.
+ /// Last updated time in seconds since 1970-01-01T00:00:00Z.
+ /// The deletion recovery level currently in effect for the object. If it contains 'Purgeable', then the object can be permanently deleted by a privileged user; otherwise, only the system can purge the object at the end of the retention interval.
+ /// Indicates if the private key can be exported.
+ /// A new instance for mocking.
+ public static ManagedHsmKeyAttributes ManagedHsmKeyAttributes(bool? enabled = null, long? notBefore = null, long? expires = null, long? created = null, long? updated = null, DeletionRecoveryLevel? recoveryLevel = null, bool? exportable = null)
+ {
+ return new ManagedHsmKeyAttributes(
+ enabled,
+ notBefore,
+ expires,
+ created,
+ updated,
+ recoveryLevel,
+ exportable,
+ serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// Creation time in seconds since 1970-01-01T00:00:00Z.
+ /// Last updated time in seconds since 1970-01-01T00:00:00Z.
+ /// The expiration time for the new key version. It should be in ISO8601 format. Eg: 'P90D', 'P1Y'.
+ /// A new instance for mocking.
+ public static ManagedHsmKeyRotationPolicyAttributes ManagedHsmKeyRotationPolicyAttributes(long? created = null, long? updated = null, string expiryTime = null)
+ {
+ return new ManagedHsmKeyRotationPolicyAttributes(created, updated, expiryTime, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The id.
+ /// The name.
+ /// The resourceType.
+ /// The systemData.
+ /// The attributes of the key.
+ /// The type of the key. For valid values, see JsonWebKeyType.
+ ///
+ /// The key size in bits. For example: 2048, 3072, or 4096 for RSA.
+ /// The elliptic curve name. For valid values, see JsonWebKeyCurveName.
+ /// The URI to retrieve the current version of the key.
+ /// The URI to retrieve the specific version of the key.
+ /// Key rotation policy in response. It will be used for both output and input. Omitted if empty.
+ /// Key release policy in response. It will be used for both output and input. Omitted if empty.
+ /// Resource tags.
+ /// A new instance for mocking.
+ public static ManagedHsmKeyData ManagedHsmKeyData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ManagedHsmKeyAttributes attributes = null, JsonWebKeyType? kty = null, IEnumerable keyOps = null, int? keySize = null, JsonWebKeyCurveName? curveName = null, Uri keyUri = null, string keyUriWithVersion = null, ManagedHsmRotationPolicy rotationPolicy = null, ManagedHsmKeyReleasePolicy releasePolicy = null, IReadOnlyDictionary tags = null)
+ {
+ keyOps ??= new List();
+ tags ??= new Dictionary();
+
+ return new ManagedHsmKeyData(
+ id,
+ name,
+ resourceType,
+ systemData,
+ attributes,
+ kty,
+ keyOps?.ToList(),
+ keySize,
+ curveName,
+ keyUri,
+ keyUriWithVersion,
+ rotationPolicy,
+ releasePolicy,
+ tags,
+ serializedAdditionalRawData: null);
+ }
+
/// Initializes a new instance of .
/// The supported Azure location where the key vault should be created.
/// The tags that will be assigned to the key vault.
@@ -265,8 +488,9 @@ public static KeyVaultPrivateLinkResourceData KeyVaultPrivateLinkResourceData(Re
/// The location.
/// Properties of the managed HSM.
/// SKU details.
+ /// Managed service identity (system assigned and/or user assigned identities).
/// A new instance for mocking.
- public static ManagedHsmData ManagedHsmData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ManagedHsmProperties properties = null, ManagedHsmSku sku = null)
+ public static ManagedHsmData ManagedHsmData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ManagedHsmProperties properties = null, ManagedHsmSku sku = null, ManagedServiceIdentity identity = null)
{
tags ??= new Dictionary();
@@ -279,6 +503,7 @@ public static ManagedHsmData ManagedHsmData(ResourceIdentifier id = null, string
location,
properties,
sku,
+ identity,
serializedAdditionalRawData: null);
}
@@ -373,8 +598,9 @@ public static ManagedHSMSecurityDomainProperties ManagedHSMSecurityDomainPropert
/// Approval state of the private link connection.
/// Provisioning state of the private endpoint connection.
/// SKU details.
+ /// Managed service identity (system assigned and/or user assigned identities).
/// A new instance for mocking.
- public static ManagedHsmPrivateEndpointConnectionData ManagedHsmPrivateEndpointConnectionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ETag? etag = null, ResourceIdentifier privateEndpointId = null, ManagedHsmPrivateLinkServiceConnectionState privateLinkServiceConnectionState = null, ManagedHsmPrivateEndpointConnectionProvisioningState? provisioningState = null, ManagedHsmSku sku = null)
+ public static ManagedHsmPrivateEndpointConnectionData ManagedHsmPrivateEndpointConnectionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ETag? etag = null, ResourceIdentifier privateEndpointId = null, ManagedHsmPrivateLinkServiceConnectionState privateLinkServiceConnectionState = null, ManagedHsmPrivateEndpointConnectionProvisioningState? provisioningState = null, ManagedHsmSku sku = null, ManagedServiceIdentity identity = null)
{
tags ??= new Dictionary();
@@ -390,6 +616,7 @@ public static ManagedHsmPrivateEndpointConnectionData ManagedHsmPrivateEndpointC
privateLinkServiceConnectionState,
provisioningState,
sku,
+ identity,
serializedAdditionalRawData: null);
}
@@ -444,8 +671,9 @@ public static DeletedManagedHsmProperties DeletedManagedHsmProperties(ResourceId
/// Required member names of private link resource.
/// Required DNS zone names of the the private link resource.
/// SKU details.
+ /// Managed service identity (system assigned and/or user assigned identities).
/// A new instance for mocking.
- public static ManagedHsmPrivateLinkResourceData ManagedHsmPrivateLinkResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, string groupId = null, IEnumerable requiredMembers = null, IEnumerable requiredZoneNames = null, ManagedHsmSku sku = null)
+ public static ManagedHsmPrivateLinkResourceData ManagedHsmPrivateLinkResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, string groupId = null, IEnumerable requiredMembers = null, IEnumerable requiredZoneNames = null, ManagedHsmSku sku = null, ManagedServiceIdentity identity = null)
{
tags ??= new Dictionary();
requiredMembers ??= new List();
@@ -462,6 +690,7 @@ public static ManagedHsmPrivateLinkResourceData ManagedHsmPrivateLinkResourceDat
requiredMembers?.ToList(),
requiredZoneNames?.ToList(),
sku,
+ identity,
serializedAdditionalRawData: null);
}
@@ -563,5 +792,58 @@ public static KeyVaultSecretData KeyVaultSecretData(ResourceIdentifier id = null
tags,
serializedAdditionalRawData: null);
}
+
+ /// Initializes a new instance of .
+ /// The id.
+ /// The name.
+ /// The resourceType.
+ /// The systemData.
+ /// The tags.
+ /// The location.
+ /// Properties of the managed HSM.
+ /// SKU details.
+ /// A new instance for mocking.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static ManagedHsmData ManagedHsmData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedHsmProperties properties, ManagedHsmSku sku)
+ {
+ return ManagedHsmData(id: id, name: name, resourceType: resourceType, systemData: systemData, tags: tags, location: location, properties: properties, sku: sku, identity: default);
+ }
+
+ /// Initializes a new instance of .
+ /// The id.
+ /// The name.
+ /// The resourceType.
+ /// The systemData.
+ /// The tags.
+ /// The location.
+ /// Modified whenever there is a change in the state of private endpoint connection.
+ /// Properties of the private endpoint object.
+ /// Approval state of the private link connection.
+ /// Provisioning state of the private endpoint connection.
+ /// SKU details.
+ /// A new instance for mocking.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static ManagedHsmPrivateEndpointConnectionData ManagedHsmPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, ResourceIdentifier privateEndpointId, ManagedHsmPrivateLinkServiceConnectionState privateLinkServiceConnectionState, ManagedHsmPrivateEndpointConnectionProvisioningState? provisioningState, ManagedHsmSku sku)
+ {
+ return ManagedHsmPrivateEndpointConnectionData(id: id, name: name, resourceType: resourceType, systemData: systemData, tags: tags, location: location, etag: etag, privateEndpointId: privateEndpointId, privateLinkServiceConnectionState: privateLinkServiceConnectionState, provisioningState: provisioningState, sku: sku, identity: default);
+ }
+
+ /// Initializes a new instance of .
+ /// The id.
+ /// The name.
+ /// The resourceType.
+ /// The systemData.
+ /// The tags.
+ /// The location.
+ /// Group identifier of private link resource.
+ /// Required member names of private link resource.
+ /// Required DNS zone names of the the private link resource.
+ /// SKU details.
+ /// A new instance for mocking.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static ManagedHsmPrivateLinkResourceData ManagedHsmPrivateLinkResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string groupId, IEnumerable requiredMembers, IEnumerable requiredZoneNames, ManagedHsmSku sku)
+ {
+ return ManagedHsmPrivateLinkResourceData(id: id, name: name, resourceType: resourceType, systemData: systemData, tags: tags, location: location, groupId: groupId, requiredMembers: requiredMembers, requiredZoneNames: requiredZoneNames, sku: sku, identity: default);
+ }
}
}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedKeyVaultCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedKeyVaultCollection.cs
index f91e8817484d4..9fedaa2a1957a 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedKeyVaultCollection.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedKeyVaultCollection.cs
@@ -62,7 +62,7 @@ internal static void ValidateResourceId(ResourceIdentifier id)
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -108,7 +108,7 @@ public virtual async Task> GetAsync(AzureLocat
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -154,7 +154,7 @@ public virtual Response Get(AzureLocation location, str
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -198,7 +198,7 @@ public virtual async Task> ExistsAsync(AzureLocation location, st
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -242,7 +242,7 @@ public virtual Response Exists(AzureLocation location, string vaultName, C
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -288,7 +288,7 @@ public virtual async Task> GetIfExists
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedKeyVaultResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedKeyVaultResource.cs
index 5165ade3a0887..70a11589f76fb 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedKeyVaultResource.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedKeyVaultResource.cs
@@ -101,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id)
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -141,7 +141,7 @@ public virtual async Task> GetAsync(Cancellati
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -181,7 +181,7 @@ public virtual Response Get(CancellationToken cancellat
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -223,7 +223,7 @@ public virtual async Task PurgeDeletedAsync(WaitUntil waitUntil, C
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedManagedHsmCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedManagedHsmCollection.cs
index 02491e344f7cf..bc09ba33d5f5a 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedManagedHsmCollection.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedManagedHsmCollection.cs
@@ -62,7 +62,7 @@ internal static void ValidateResourceId(ResourceIdentifier id)
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -108,7 +108,7 @@ public virtual async Task> GetAsync(AzureLoc
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -154,7 +154,7 @@ public virtual Response Get(AzureLocation location, s
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -198,7 +198,7 @@ public virtual async Task> ExistsAsync(AzureLocation location, st
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -242,7 +242,7 @@ public virtual Response Exists(AzureLocation location, string name, Cancel
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -288,7 +288,7 @@ public virtual async Task> GetIfExis
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedManagedHsmResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedManagedHsmResource.cs
index 30aeed42b163d..10fccc7a35ee6 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedManagedHsmResource.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/DeletedManagedHsmResource.cs
@@ -101,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id)
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -141,7 +141,7 @@ public virtual async Task> GetAsync(Cancella
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -181,7 +181,7 @@ public virtual Response Get(CancellationToken cancell
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -223,7 +223,7 @@ public virtual async Task PurgeDeletedAsync(WaitUntil waitUntil, C
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/KeyVaultExtensions.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/KeyVaultExtensions.cs
index 117edbd2b3352..dc0c50c6340c6 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/KeyVaultExtensions.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/KeyVaultExtensions.cs
@@ -33,6 +33,82 @@ private static MockableKeyVaultSubscriptionResource GetMockableKeyVaultSubscript
return resource.GetCachedClient(client => new MockableKeyVaultSubscriptionResource(client, resource.Id));
}
+ ///
+ /// Gets an object representing a along with the instance operations that can be performed on it but with no data.
+ /// You can use to create a from its components.
+ ///
-
+ /// Mocking
+ /// To mock this method, please mock instead.
+ ///
+ ///
+ /// The instance the method will execute against.
+ /// The resource ID of the resource to get.
+ /// is null.
+ /// Returns a object.
+ public static VaultKeyResource GetVaultKeyResource(this ArmClient client, ResourceIdentifier id)
+ {
+ Argument.AssertNotNull(client, nameof(client));
+
+ return GetMockableKeyVaultArmClient(client).GetVaultKeyResource(id);
+ }
+
+ ///
+ /// Gets an object representing a along with the instance operations that can be performed on it but with no data.
+ /// You can use to create a from its components.
+ /// -
+ /// Mocking
+ /// To mock this method, please mock instead.
+ ///
+ ///
+ /// The instance the method will execute against.
+ /// The resource ID of the resource to get.
+ /// is null.
+ /// Returns a object.
+ public static VaultKeyVersionResource GetVaultKeyVersionResource(this ArmClient client, ResourceIdentifier id)
+ {
+ Argument.AssertNotNull(client, nameof(client));
+
+ return GetMockableKeyVaultArmClient(client).GetVaultKeyVersionResource(id);
+ }
+
+ ///
+ /// Gets an object representing a along with the instance operations that can be performed on it but with no data.
+ /// You can use to create a from its components.
+ /// -
+ /// Mocking
+ /// To mock this method, please mock instead.
+ ///
+ ///
+ /// The instance the method will execute against.
+ /// The resource ID of the resource to get.
+ /// is null.
+ /// Returns a object.
+ public static ManagedHSMKeyResource GetManagedHSMKeyResource(this ArmClient client, ResourceIdentifier id)
+ {
+ Argument.AssertNotNull(client, nameof(client));
+
+ return GetMockableKeyVaultArmClient(client).GetManagedHSMKeyResource(id);
+ }
+
+ ///
+ /// Gets an object representing a along with the instance operations that can be performed on it but with no data.
+ /// You can use to create a from its components.
+ /// -
+ /// Mocking
+ /// To mock this method, please mock instead.
+ ///
+ ///
+ /// The instance the method will execute against.
+ /// The resource ID of the resource to get.
+ /// is null.
+ /// Returns a object.
+ public static ManagedHSMKeyVersionResource GetManagedHSMKeyVersionResource(this ArmClient client, ResourceIdentifier id)
+ {
+ Argument.AssertNotNull(client, nameof(client));
+
+ return GetMockableKeyVaultArmClient(client).GetManagedHSMKeyVersionResource(id);
+ }
+
///
/// Gets an object representing a along with the instance operations that can be performed on it but with no data.
/// You can use to create a from its components.
@@ -196,7 +272,7 @@ public static KeyVaultCollection GetKeyVaults(this ResourceGroupResource resourc
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -234,7 +310,7 @@ public static async Task> GetKeyVaultAsync(this Resou
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -289,7 +365,7 @@ public static ManagedHsmCollection GetManagedHsms(this ResourceGroupResource res
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -327,7 +403,7 @@ public static async Task> GetManagedHsmAsync(this R
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -382,7 +458,7 @@ public static DeletedKeyVaultCollection GetDeletedKeyVaults(this SubscriptionRes
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -421,7 +497,7 @@ public static async Task> GetDeletedKeyVaultAs
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -477,7 +553,7 @@ public static DeletedManagedHsmCollection GetDeletedManagedHsms(this Subscriptio
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -516,7 +592,7 @@ public static async Task> GetDeletedManagedH
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -555,7 +631,7 @@ public static Response GetDeletedManagedHsm(this Subs
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -592,7 +668,7 @@ public static AsyncPageable GetKeyVaultsAsync(this Subscriptio
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -629,7 +705,7 @@ public static Pageable GetKeyVaults(this SubscriptionResource
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
///
/// -
@@ -661,7 +737,7 @@ public static AsyncPageable GetDeletedKeyVaultsAsync(th
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
///
/// -
@@ -693,7 +769,7 @@ public static Pageable GetDeletedKeyVaults(this Subscri
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -729,7 +805,7 @@ public static async Task> CheckKeyVault
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -765,7 +841,7 @@ public static Response CheckKeyVaultNameAvailabi
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -802,7 +878,7 @@ public static AsyncPageable GetManagedHsmsAsync(this Subscri
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -839,7 +915,7 @@ public static Pageable GetManagedHsms(this SubscriptionResou
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
///
/// -
@@ -871,7 +947,7 @@ public static AsyncPageable GetDeletedManagedHsmsAsyn
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
///
/// -
@@ -903,7 +979,7 @@ public static Pageable GetDeletedManagedHsms(this Sub
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -939,7 +1015,7 @@ public static async Task> CheckManage
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultArmClient.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultArmClient.cs
index 7e34193bd5fad..b2b1c4b68f926 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultArmClient.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultArmClient.cs
@@ -34,6 +34,54 @@ private string GetApiVersionOrNull(ResourceType resourceType)
return apiVersion;
}
+ ///
+ /// Gets an object representing a along with the instance operations that can be performed on it but with no data.
+ /// You can use to create a from its components.
+ ///
+ /// The resource ID of the resource to get.
+ /// Returns a object.
+ public virtual VaultKeyResource GetVaultKeyResource(ResourceIdentifier id)
+ {
+ VaultKeyResource.ValidateResourceId(id);
+ return new VaultKeyResource(Client, id);
+ }
+
+ ///
+ /// Gets an object representing a along with the instance operations that can be performed on it but with no data.
+ /// You can use to create a from its components.
+ ///
+ /// The resource ID of the resource to get.
+ /// Returns a object.
+ public virtual VaultKeyVersionResource GetVaultKeyVersionResource(ResourceIdentifier id)
+ {
+ VaultKeyVersionResource.ValidateResourceId(id);
+ return new VaultKeyVersionResource(Client, id);
+ }
+
+ ///
+ /// Gets an object representing a along with the instance operations that can be performed on it but with no data.
+ /// You can use to create a from its components.
+ ///
+ /// The resource ID of the resource to get.
+ /// Returns a object.
+ public virtual ManagedHSMKeyResource GetManagedHSMKeyResource(ResourceIdentifier id)
+ {
+ ManagedHSMKeyResource.ValidateResourceId(id);
+ return new ManagedHSMKeyResource(Client, id);
+ }
+
+ ///
+ /// Gets an object representing a along with the instance operations that can be performed on it but with no data.
+ /// You can use to create a from its components.
+ ///
+ /// The resource ID of the resource to get.
+ /// Returns a object.
+ public virtual ManagedHSMKeyVersionResource GetManagedHSMKeyVersionResource(ResourceIdentifier id)
+ {
+ ManagedHSMKeyVersionResource.ValidateResourceId(id);
+ return new ManagedHSMKeyVersionResource(Client, id);
+ }
+
///
/// Gets an object representing a along with the instance operations that can be performed on it but with no data.
/// You can use to create a from its components.
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultResourceGroupResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultResourceGroupResource.cs
index b3a04a42126c1..cddb41101444c 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultResourceGroupResource.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultResourceGroupResource.cs
@@ -53,7 +53,7 @@ public virtual KeyVaultCollection GetKeyVaults()
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -84,7 +84,7 @@ public virtual async Task> GetKeyVaultAsync(string va
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -122,7 +122,7 @@ public virtual ManagedHsmCollection GetManagedHsms()
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -153,7 +153,7 @@ public virtual async Task> GetManagedHsmAsync(strin
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultSubscriptionResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultSubscriptionResource.cs
index 8a96019efc24b..09d7573c8c386 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultSubscriptionResource.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultSubscriptionResource.cs
@@ -74,7 +74,7 @@ public virtual DeletedKeyVaultCollection GetDeletedKeyVaults()
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -106,7 +106,7 @@ public virtual async Task> GetDeletedKeyVaultA
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -145,7 +145,7 @@ public virtual DeletedManagedHsmCollection GetDeletedManagedHsms()
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -177,7 +177,7 @@ public virtual async Task> GetDeletedManaged
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -209,7 +209,7 @@ public virtual Response GetDeletedManagedHsm(AzureLoc
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -240,7 +240,7 @@ public virtual AsyncPageable GetKeyVaultsAsync(int? top = null
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -271,7 +271,7 @@ public virtual Pageable GetKeyVaults(int? top = null, Cancella
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
///
///
@@ -297,7 +297,7 @@ public virtual AsyncPageable GetDeletedKeyVaultsAsync(C
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
///
///
@@ -323,7 +323,7 @@ public virtual Pageable GetDeletedKeyVaults(Cancellatio
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -365,7 +365,7 @@ public virtual async Task> CheckKeyVaul
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -407,7 +407,7 @@ public virtual Response CheckKeyVaultNameAvailab
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -438,7 +438,7 @@ public virtual AsyncPageable GetManagedHsmsAsync(int? top =
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -469,7 +469,7 @@ public virtual Pageable GetManagedHsms(int? top = null, Canc
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
///
///
@@ -495,7 +495,7 @@ public virtual AsyncPageable GetDeletedManagedHsmsAsy
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
///
///
@@ -521,7 +521,7 @@ public virtual Pageable GetDeletedManagedHsms(Cancell
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -563,7 +563,7 @@ public virtual async Task> CheckManag
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyData.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyData.Serialization.cs
new file mode 100644
index 0000000000000..064256eb74172
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyData.Serialization.cs
@@ -0,0 +1,652 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.Json;
+using Azure.Core;
+using Azure.ResourceManager.KeyVault.Models;
+using Azure.ResourceManager.Models;
+
+namespace Azure.ResourceManager.KeyVault
+{
+ public partial class KeyData : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(KeyData)} does not support writing '{format}' format.");
+ }
+
+ writer.WriteStartObject();
+ if (options.Format != "W" && Optional.IsDefined(Location))
+ {
+ writer.WritePropertyName("location"u8);
+ writer.WriteStringValue(Location.Value);
+ }
+ if (options.Format != "W" && Optional.IsCollectionDefined(Tags))
+ {
+ writer.WritePropertyName("tags"u8);
+ writer.WriteStartObject();
+ foreach (var item in Tags)
+ {
+ writer.WritePropertyName(item.Key);
+ writer.WriteStringValue(item.Value);
+ }
+ writer.WriteEndObject();
+ }
+ if (options.Format != "W")
+ {
+ writer.WritePropertyName("id"u8);
+ writer.WriteStringValue(Id);
+ }
+ if (options.Format != "W")
+ {
+ writer.WritePropertyName("name"u8);
+ writer.WriteStringValue(Name);
+ }
+ if (options.Format != "W")
+ {
+ writer.WritePropertyName("type"u8);
+ writer.WriteStringValue(ResourceType);
+ }
+ if (options.Format != "W" && Optional.IsDefined(SystemData))
+ {
+ writer.WritePropertyName("systemData"u8);
+ JsonSerializer.Serialize(writer, SystemData);
+ }
+ writer.WritePropertyName("properties"u8);
+ writer.WriteStartObject();
+ if (Optional.IsDefined(Attributes))
+ {
+ writer.WritePropertyName("attributes"u8);
+ writer.WriteObjectValue(Attributes, options);
+ }
+ if (Optional.IsDefined(Kty))
+ {
+ writer.WritePropertyName("kty"u8);
+ writer.WriteStringValue(Kty.Value.ToString());
+ }
+ if (Optional.IsCollectionDefined(KeyOps))
+ {
+ writer.WritePropertyName("keyOps"u8);
+ writer.WriteStartArray();
+ foreach (var item in KeyOps)
+ {
+ writer.WriteStringValue(item.ToString());
+ }
+ writer.WriteEndArray();
+ }
+ if (Optional.IsDefined(KeySize))
+ {
+ writer.WritePropertyName("keySize"u8);
+ writer.WriteNumberValue(KeySize.Value);
+ }
+ if (Optional.IsDefined(CurveName))
+ {
+ writer.WritePropertyName("curveName"u8);
+ writer.WriteStringValue(CurveName.Value.ToString());
+ }
+ if (options.Format != "W" && Optional.IsDefined(KeyUri))
+ {
+ writer.WritePropertyName("keyUri"u8);
+ writer.WriteStringValue(KeyUri.AbsoluteUri);
+ }
+ if (options.Format != "W" && Optional.IsDefined(KeyUriWithVersion))
+ {
+ writer.WritePropertyName("keyUriWithVersion"u8);
+ writer.WriteStringValue(KeyUriWithVersion);
+ }
+ if (Optional.IsDefined(RotationPolicy))
+ {
+ writer.WritePropertyName("rotationPolicy"u8);
+ writer.WriteObjectValue(RotationPolicy, options);
+ }
+ if (Optional.IsDefined(ReleasePolicy))
+ {
+ writer.WritePropertyName("release_policy"u8);
+ writer.WriteObjectValue(ReleasePolicy, options);
+ }
+ writer.WriteEndObject();
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ writer.WriteEndObject();
+ }
+
+ KeyData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(KeyData)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeKeyData(document.RootElement, options);
+ }
+
+ internal static KeyData DeserializeKeyData(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ AzureLocation? location = default;
+ IReadOnlyDictionary tags = default;
+ ResourceIdentifier id = default;
+ string name = default;
+ ResourceType type = default;
+ SystemData systemData = default;
+ KeyAttributes attributes = default;
+ JsonWebKeyType? kty = default;
+ IList keyOps = default;
+ int? keySize = default;
+ JsonWebKeyCurveName? curveName = default;
+ Uri keyUri = default;
+ string keyUriWithVersion = default;
+ RotationPolicy rotationPolicy = default;
+ KeyReleasePolicy releasePolicy = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("location"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ location = new AzureLocation(property.Value.GetString());
+ continue;
+ }
+ if (property.NameEquals("tags"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ Dictionary dictionary = new Dictionary();
+ foreach (var property0 in property.Value.EnumerateObject())
+ {
+ dictionary.Add(property0.Name, property0.Value.GetString());
+ }
+ tags = dictionary;
+ continue;
+ }
+ if (property.NameEquals("id"u8))
+ {
+ id = new ResourceIdentifier(property.Value.GetString());
+ continue;
+ }
+ if (property.NameEquals("name"u8))
+ {
+ name = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("type"u8))
+ {
+ type = new ResourceType(property.Value.GetString());
+ continue;
+ }
+ if (property.NameEquals("systemData"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ systemData = JsonSerializer.Deserialize(property.Value.GetRawText());
+ continue;
+ }
+ if (property.NameEquals("properties"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ property.ThrowNonNullablePropertyIsNull();
+ continue;
+ }
+ foreach (var property0 in property.Value.EnumerateObject())
+ {
+ if (property0.NameEquals("attributes"u8))
+ {
+ if (property0.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ attributes = KeyAttributes.DeserializeKeyAttributes(property0.Value, options);
+ continue;
+ }
+ if (property0.NameEquals("kty"u8))
+ {
+ if (property0.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ kty = new JsonWebKeyType(property0.Value.GetString());
+ continue;
+ }
+ if (property0.NameEquals("keyOps"u8))
+ {
+ if (property0.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ List array = new List();
+ foreach (var item in property0.Value.EnumerateArray())
+ {
+ array.Add(new JsonWebKeyOperation(item.GetString()));
+ }
+ keyOps = array;
+ continue;
+ }
+ if (property0.NameEquals("keySize"u8))
+ {
+ if (property0.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ keySize = property0.Value.GetInt32();
+ continue;
+ }
+ if (property0.NameEquals("curveName"u8))
+ {
+ if (property0.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ curveName = new JsonWebKeyCurveName(property0.Value.GetString());
+ continue;
+ }
+ if (property0.NameEquals("keyUri"u8))
+ {
+ if (property0.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ keyUri = new Uri(property0.Value.GetString());
+ continue;
+ }
+ if (property0.NameEquals("keyUriWithVersion"u8))
+ {
+ keyUriWithVersion = property0.Value.GetString();
+ continue;
+ }
+ if (property0.NameEquals("rotationPolicy"u8))
+ {
+ if (property0.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ rotationPolicy = RotationPolicy.DeserializeRotationPolicy(property0.Value, options);
+ continue;
+ }
+ if (property0.NameEquals("release_policy"u8))
+ {
+ if (property0.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ releasePolicy = KeyReleasePolicy.DeserializeKeyReleasePolicy(property0.Value, options);
+ continue;
+ }
+ }
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new KeyData(
+ id,
+ name,
+ type,
+ systemData,
+ attributes,
+ kty,
+ keyOps ?? new ChangeTrackingList(),
+ keySize,
+ curveName,
+ keyUri,
+ keyUriWithVersion,
+ rotationPolicy,
+ releasePolicy,
+ location,
+ tags ?? new ChangeTrackingDictionary(),
+ serializedAdditionalRawData);
+ }
+
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" name: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(Name))
+ {
+ builder.Append(" name: ");
+ if (Name.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{Name}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{Name}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Location), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" location: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(Location))
+ {
+ builder.Append(" location: ");
+ builder.AppendLine($"'{Location.Value.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Tags), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" tags: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsCollectionDefined(Tags))
+ {
+ if (Tags.Any())
+ {
+ builder.Append(" tags: ");
+ builder.AppendLine("{");
+ foreach (var item in Tags)
+ {
+ builder.Append($" '{item.Key}': ");
+ if (item.Value == null)
+ {
+ builder.Append("null");
+ continue;
+ }
+ if (item.Value.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{item.Value}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{item.Value}'");
+ }
+ }
+ builder.AppendLine(" }");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" id: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(Id))
+ {
+ builder.Append(" id: ");
+ builder.AppendLine($"'{Id.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" systemData: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(SystemData))
+ {
+ builder.Append(" systemData: ");
+ builder.AppendLine($"'{SystemData.ToString()}'");
+ }
+ }
+
+ builder.Append(" properties:");
+ builder.AppendLine(" {");
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Attributes), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" attributes: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(Attributes))
+ {
+ builder.Append(" attributes: ");
+ BicepSerializationHelpers.AppendChildObject(builder, Attributes, options, 4, false, " attributes: ");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Kty), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" kty: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(Kty))
+ {
+ builder.Append(" kty: ");
+ builder.AppendLine($"'{Kty.Value.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(KeyOps), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" keyOps: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsCollectionDefined(KeyOps))
+ {
+ if (KeyOps.Any())
+ {
+ builder.Append(" keyOps: ");
+ builder.AppendLine("[");
+ foreach (var item in KeyOps)
+ {
+ builder.AppendLine($" '{item.ToString()}'");
+ }
+ builder.AppendLine(" ]");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(KeySize), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" keySize: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(KeySize))
+ {
+ builder.Append(" keySize: ");
+ builder.AppendLine($"{KeySize.Value}");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CurveName), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" curveName: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(CurveName))
+ {
+ builder.Append(" curveName: ");
+ builder.AppendLine($"'{CurveName.Value.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(KeyUri), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" keyUri: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(KeyUri))
+ {
+ builder.Append(" keyUri: ");
+ builder.AppendLine($"'{KeyUri.AbsoluteUri}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(KeyUriWithVersion), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" keyUriWithVersion: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(KeyUriWithVersion))
+ {
+ builder.Append(" keyUriWithVersion: ");
+ if (KeyUriWithVersion.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{KeyUriWithVersion}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{KeyUriWithVersion}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RotationPolicy), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" rotationPolicy: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(RotationPolicy))
+ {
+ builder.Append(" rotationPolicy: ");
+ BicepSerializationHelpers.AppendChildObject(builder, RotationPolicy, options, 4, false, " rotationPolicy: ");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ReleasePolicy), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" release_policy: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(ReleasePolicy))
+ {
+ builder.Append(" release_policy: ");
+ BicepSerializationHelpers.AppendChildObject(builder, ReleasePolicy, options, 4, false, " release_policy: ");
+ }
+ }
+
+ builder.AppendLine(" }");
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
+ default:
+ throw new FormatException($"The model {nameof(KeyData)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ KeyData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data);
+ return DeserializeKeyData(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(KeyData)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyData.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyData.cs
new file mode 100644
index 0000000000000..9d2c370211aad
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyData.cs
@@ -0,0 +1,128 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using Azure.Core;
+using Azure.ResourceManager.KeyVault.Models;
+using Azure.ResourceManager.Models;
+
+namespace Azure.ResourceManager.KeyVault
+{
+ ///
+ /// A class representing the Key data model.
+ /// The key resource.
+ ///
+ public partial class KeyData : ResourceData
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ public KeyData()
+ {
+ KeyOps = new ChangeTrackingList();
+ Tags = new ChangeTrackingDictionary();
+ }
+
+ /// Initializes a new instance of .
+ /// The id.
+ /// The name.
+ /// The resourceType.
+ /// The systemData.
+ /// The attributes of the key.
+ /// The type of the key. For valid values, see JsonWebKeyType.
+ ///
+ /// The key size in bits. For example: 2048, 3072, or 4096 for RSA.
+ /// The elliptic curve name. For valid values, see JsonWebKeyCurveName.
+ /// The URI to retrieve the current version of the key.
+ /// The URI to retrieve the specific version of the key.
+ /// Key rotation policy in response. It will be used for both output and input. Omitted if empty.
+ /// Key release policy in response. It will be used for both output and input. Omitted if empty.
+ /// Azure location of the key vault resource.
+ /// Tags assigned to the key vault resource.
+ /// Keeps track of any properties unknown to the library.
+ internal KeyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, KeyAttributes attributes, JsonWebKeyType? kty, IList keyOps, int? keySize, JsonWebKeyCurveName? curveName, Uri keyUri, string keyUriWithVersion, RotationPolicy rotationPolicy, KeyReleasePolicy releasePolicy, AzureLocation? location, IReadOnlyDictionary tags, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData)
+ {
+ Attributes = attributes;
+ Kty = kty;
+ KeyOps = keyOps;
+ KeySize = keySize;
+ CurveName = curveName;
+ KeyUri = keyUri;
+ KeyUriWithVersion = keyUriWithVersion;
+ RotationPolicy = rotationPolicy;
+ ReleasePolicy = releasePolicy;
+ Location = location;
+ Tags = tags;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// The attributes of the key.
+ [WirePath("properties.attributes")]
+ public KeyAttributes Attributes { get; set; }
+ /// The type of the key. For valid values, see JsonWebKeyType.
+ [WirePath("properties.kty")]
+ public JsonWebKeyType? Kty { get; set; }
+ /// Gets the key ops.
+ [WirePath("properties.keyOps")]
+ public IList KeyOps { get; }
+ /// The key size in bits. For example: 2048, 3072, or 4096 for RSA.
+ [WirePath("properties.keySize")]
+ public int? KeySize { get; set; }
+ /// The elliptic curve name. For valid values, see JsonWebKeyCurveName.
+ [WirePath("properties.curveName")]
+ public JsonWebKeyCurveName? CurveName { get; set; }
+ /// The URI to retrieve the current version of the key.
+ [WirePath("properties.keyUri")]
+ public Uri KeyUri { get; }
+ /// The URI to retrieve the specific version of the key.
+ [WirePath("properties.keyUriWithVersion")]
+ public string KeyUriWithVersion { get; }
+ /// Key rotation policy in response. It will be used for both output and input. Omitted if empty.
+ [WirePath("properties.rotationPolicy")]
+ public RotationPolicy RotationPolicy { get; set; }
+ /// Key release policy in response. It will be used for both output and input. Omitted if empty.
+ [WirePath("properties.release_policy")]
+ public KeyReleasePolicy ReleasePolicy { get; set; }
+ /// Azure location of the key vault resource.
+ [WirePath("location")]
+ public AzureLocation? Location { get; }
+ /// Tags assigned to the key vault resource.
+ [WirePath("tags")]
+ public IReadOnlyDictionary Tags { get; }
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultCollection.cs
index 420811bf3ea62..efd240b0a5659 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultCollection.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultCollection.cs
@@ -66,7 +66,7 @@ internal static void ValidateResourceId(ResourceIdentifier id)
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -115,7 +115,7 @@ public virtual async Task> CreateOrUpdateAsync(Wa
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -164,7 +164,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -209,7 +209,7 @@ public virtual async Task> GetAsync(string vaultName,
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -254,7 +254,7 @@ public virtual Response Get(string vaultName, CancellationToke
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -285,7 +285,7 @@ public virtual AsyncPageable GetAllAsync(int? top = null, Canc
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -316,7 +316,7 @@ public virtual Pageable GetAll(int? top = null, CancellationTo
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -359,7 +359,7 @@ public virtual async Task> ExistsAsync(string vaultName, Cancella
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -402,7 +402,7 @@ public virtual Response Exists(string vaultName, CancellationToken cancell
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -447,7 +447,7 @@ public virtual async Task> GetIfExistsAsync(s
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionCollection.cs
index 6f09aa285a470..cbab25128bd13 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionCollection.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionCollection.cs
@@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id)
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -115,7 +115,7 @@ public virtual async Task
///
-
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -166,7 +166,7 @@ public virtual ArmOperation CreateOrU
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -211,7 +211,7 @@ public virtual async Task> G
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -256,7 +256,7 @@ public virtual Response Get(string pr
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -286,7 +286,7 @@ public virtual AsyncPageable GetAllAs
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -316,7 +316,7 @@ public virtual Pageable GetAll(Cancel
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -359,7 +359,7 @@ public virtual async Task> ExistsAsync(string privateEndpointConn
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -402,7 +402,7 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -447,7 +447,7 @@ public virtual async Task
///
-
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionResource.cs
index 4d07c1b80db44..03cf5de486c0e 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionResource.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionResource.cs
@@ -101,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id)
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -141,7 +141,7 @@ public virtual async Task> G
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -181,7 +181,7 @@ public virtual Response Get(Cancellat
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -223,7 +223,7 @@ public virtual async Task
///
-
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -265,7 +265,7 @@ public virtual ArmOperation Delete(Wa
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -313,7 +313,7 @@ public virtual async Task
///
-
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultResource.cs
index e87bd39d8d610..329feabb5bc41 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultResource.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultResource.cs
@@ -95,6 +95,75 @@ internal static void ValidateResourceId(ResourceIdentifier id)
throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id));
}
+ /// Gets a collection of VaultKeyResources in the KeyVault.
+ /// An object representing collection of VaultKeyResources and their operations over a VaultKeyResource.
+ public virtual VaultKeyCollection GetVaultKeys()
+ {
+ return GetCachedClient(client => new VaultKeyCollection(client, Id));
+ }
+
+ ///
+ /// Gets the current version of the specified key from the specified key vault.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}
+ ///
+ /// -
+ /// Operation Id
+ /// Keys_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2023-07-01
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The name of the key to be retrieved.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ [ForwardsClientCalls]
+ public virtual async Task> GetVaultKeyAsync(string keyName, CancellationToken cancellationToken = default)
+ {
+ return await GetVaultKeys().GetAsync(keyName, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// Gets the current version of the specified key from the specified key vault.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}
+ ///
+ /// -
+ /// Operation Id
+ /// Keys_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2023-07-01
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The name of the key to be retrieved.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ [ForwardsClientCalls]
+ public virtual Response GetVaultKey(string keyName, CancellationToken cancellationToken = default)
+ {
+ return GetVaultKeys().Get(keyName, cancellationToken);
+ }
+
/// Gets a collection of KeyVaultPrivateEndpointConnectionResources in the KeyVault.
/// An object representing collection of KeyVaultPrivateEndpointConnectionResources and their operations over a KeyVaultPrivateEndpointConnectionResource.
public virtual KeyVaultPrivateEndpointConnectionCollection GetKeyVaultPrivateEndpointConnections()
@@ -115,7 +184,7 @@ public virtual KeyVaultPrivateEndpointConnectionCollection GetKeyVaultPrivateEnd
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -146,7 +215,7 @@ public virtual async Task> G
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -184,7 +253,7 @@ public virtual KeyVaultSecretCollection GetKeyVaultSecrets()
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -215,7 +284,7 @@ public virtual async Task> GetKeyVaultSecretAsy
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -246,7 +315,7 @@ public virtual Response GetKeyVaultSecret(string secretN
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -286,7 +355,7 @@ public virtual async Task> GetAsync(CancellationToken
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -326,7 +395,7 @@ public virtual Response Get(CancellationToken cancellationToke
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -370,7 +439,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -414,7 +483,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -456,7 +525,7 @@ public virtual async Task> UpdateAsync(KeyVaultPatch
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -498,7 +567,7 @@ public virtual Response Update(KeyVaultPatch patch, Cancellati
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
///
///
@@ -537,7 +606,7 @@ public virtual async Task> UpdateAccess
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
///
///
@@ -576,7 +645,7 @@ public virtual Response UpdateAccessPolicy(Acces
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
///
///
@@ -601,7 +670,7 @@ public virtual AsyncPageable GetPrivateLinkReso
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
///
///
@@ -626,7 +695,7 @@ public virtual Pageable GetPrivateLinkResources
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -688,7 +757,7 @@ public virtual async Task> AddTagAsync(string key, st
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -750,7 +819,7 @@ public virtual Response AddTag(string key, string value, Cance
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -807,7 +876,7 @@ public virtual async Task> SetTagsAsync(IDictionary
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -864,7 +933,7 @@ public virtual Response SetTags(IDictionary ta
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -924,7 +993,7 @@ public virtual async Task> RemoveTagAsync(string key,
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretCollection.cs
index 92b282356f335..c70fc0fe01563 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretCollection.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretCollection.cs
@@ -65,7 +65,7 @@ internal static void ValidateResourceId(ResourceIdentifier id)
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -116,7 +116,7 @@ public virtual async Task> CreateOrUpdateAs
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -167,7 +167,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil wai
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -212,7 +212,7 @@ public virtual async Task> GetAsync(string secr
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -257,7 +257,7 @@ public virtual Response Get(string secretName, Cancellat
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -288,7 +288,7 @@ public virtual AsyncPageable GetAllAsync(int? top = null
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -319,7 +319,7 @@ public virtual Pageable GetAll(int? top = null, Cancella
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -362,7 +362,7 @@ public virtual async Task> ExistsAsync(string secretName, Cancell
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -405,7 +405,7 @@ public virtual Response Exists(string secretName, CancellationToken cancel
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -450,7 +450,7 @@ public virtual async Task> GetIfExistsA
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretResource.cs
index f10347663969e..f5f7f3916b4f1 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretResource.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretResource.cs
@@ -102,7 +102,7 @@ internal static void ValidateResourceId(ResourceIdentifier id)
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -142,7 +142,7 @@ public virtual async Task> GetAsync(Cancellatio
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -182,7 +182,7 @@ public virtual Response Get(CancellationToken cancellati
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -224,7 +224,7 @@ public virtual async Task> UpdateAsync(KeyVault
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHSMKeyCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHSMKeyCollection.cs
new file mode 100644
index 0000000000000..516ae88e0e833
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHSMKeyCollection.cs
@@ -0,0 +1,498 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Threading;
+using System.Threading.Tasks;
+using Autorest.CSharp.Core;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.KeyVault.Models;
+
+namespace Azure.ResourceManager.KeyVault
+{
+ ///
+ /// A class representing a collection of and their operations.
+ /// Each in the collection will belong to the same instance of .
+ /// To get a instance call the GetManagedHSMKeys method from an instance of .
+ ///
+ public partial class ManagedHSMKeyCollection : ArmCollection, IEnumerable, IAsyncEnumerable
+ {
+ private readonly ClientDiagnostics _managedHSMKeyManagedHsmKeysClientDiagnostics;
+ private readonly ManagedHsmKeysRestOperations _managedHSMKeyManagedHsmKeysRestClient;
+
+ /// Initializes a new instance of the class for mocking.
+ protected ManagedHSMKeyCollection()
+ {
+ }
+
+ /// Initializes a new instance of the class.
+ /// The client parameters to use in these operations.
+ /// The identifier of the parent resource that is the target of operations.
+ internal ManagedHSMKeyCollection(ArmClient client, ResourceIdentifier id) : base(client, id)
+ {
+ _managedHSMKeyManagedHsmKeysClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.KeyVault", ManagedHSMKeyResource.ResourceType.Namespace, Diagnostics);
+ TryGetApiVersion(ManagedHSMKeyResource.ResourceType, out string managedHSMKeyManagedHsmKeysApiVersion);
+ _managedHSMKeyManagedHsmKeysRestClient = new ManagedHsmKeysRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, managedHSMKeyManagedHsmKeysApiVersion);
+#if DEBUG
+ ValidateResourceId(Id);
+#endif
+ }
+
+ internal static void ValidateResourceId(ResourceIdentifier id)
+ {
+ if (id.ResourceType != ManagedHsmResource.ResourceType)
+ throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ManagedHsmResource.ResourceType), nameof(id));
+ }
+
+ ///
+ /// Creates the first version of a new key if it does not exist. If it already exists, then the existing key is returned without any write operations being performed. This API does not create subsequent versions, and does not update existing keys.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}
+ ///
+ /// -
+ /// Operation Id
+ /// ManagedHsmKeys_CreateIfNotExist
+ ///
+ /// -
+ /// Default Api Version
+ /// 2023-07-01
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.
+ /// The name of the key to be created. The value you provide may be copied globally for the purpose of running the service. The value provided should not include personally identifiable or sensitive information.
+ /// The parameters used to create the specified key.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// or is null.
+ public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string keyName, ManagedHSMKeyCreateOrUpdateContent content, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(keyName, nameof(keyName));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = _managedHSMKeyManagedHsmKeysClientDiagnostics.CreateScope("ManagedHSMKeyCollection.CreateOrUpdate");
+ scope.Start();
+ try
+ {
+ var response = await _managedHSMKeyManagedHsmKeysRestClient.CreateIfNotExistAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, keyName, content, cancellationToken).ConfigureAwait(false);
+ var uri = _managedHSMKeyManagedHsmKeysRestClient.CreateCreateIfNotExistRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, keyName, content);
+ var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString());
+ var operation = new KeyVaultArmOperation(Response.FromValue(new ManagedHSMKeyResource(Client, response), response.GetRawResponse()), rehydrationToken);
+ if (waitUntil == WaitUntil.Completed)
+ await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
+ return operation;
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Creates the first version of a new key if it does not exist. If it already exists, then the existing key is returned without any write operations being performed. This API does not create subsequent versions, and does not update existing keys.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}
+ ///
+ /// -
+ /// Operation Id
+ /// ManagedHsmKeys_CreateIfNotExist
+ ///
+ /// -
+ /// Default Api Version
+ /// 2023-07-01
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.
+ /// The name of the key to be created. The value you provide may be copied globally for the purpose of running the service. The value provided should not include personally identifiable or sensitive information.
+ /// The parameters used to create the specified key.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// or is null.
+ public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string keyName, ManagedHSMKeyCreateOrUpdateContent content, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(keyName, nameof(keyName));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = _managedHSMKeyManagedHsmKeysClientDiagnostics.CreateScope("ManagedHSMKeyCollection.CreateOrUpdate");
+ scope.Start();
+ try
+ {
+ var response = _managedHSMKeyManagedHsmKeysRestClient.CreateIfNotExist(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, keyName, content, cancellationToken);
+ var uri = _managedHSMKeyManagedHsmKeysRestClient.CreateCreateIfNotExistRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, keyName, content);
+ var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString());
+ var operation = new KeyVaultArmOperation(Response.FromValue(new ManagedHSMKeyResource(Client, response), response.GetRawResponse()), rehydrationToken);
+ if (waitUntil == WaitUntil.Completed)
+ operation.WaitForCompletion(cancellationToken);
+ return operation;
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Gets the current version of the specified key from the specified managed HSM.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}
+ ///
+ /// -
+ /// Operation Id
+ /// ManagedHsmKeys_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2023-07-01
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The name of the key to be created. The value you provide may be copied globally for the purpose of running the service. The value provided should not include personally identifiable or sensitive information.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ public virtual async Task> GetAsync(string keyName, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(keyName, nameof(keyName));
+
+ using var scope = _managedHSMKeyManagedHsmKeysClientDiagnostics.CreateScope("ManagedHSMKeyCollection.Get");
+ scope.Start();
+ try
+ {
+ var response = await _managedHSMKeyManagedHsmKeysRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, keyName, cancellationToken).ConfigureAwait(false);
+ if (response.Value == null)
+ throw new RequestFailedException(response.GetRawResponse());
+ return Response.FromValue(new ManagedHSMKeyResource(Client, response.Value), response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Gets the current version of the specified key from the specified managed HSM.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}
+ ///
+ /// -
+ /// Operation Id
+ /// ManagedHsmKeys_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2023-07-01
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The name of the key to be created. The value you provide may be copied globally for the purpose of running the service. The value provided should not include personally identifiable or sensitive information.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ public virtual Response Get(string keyName, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(keyName, nameof(keyName));
+
+ using var scope = _managedHSMKeyManagedHsmKeysClientDiagnostics.CreateScope("ManagedHSMKeyCollection.Get");
+ scope.Start();
+ try
+ {
+ var response = _managedHSMKeyManagedHsmKeysRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, keyName, cancellationToken);
+ if (response.Value == null)
+ throw new RequestFailedException(response.GetRawResponse());
+ return Response.FromValue(new ManagedHSMKeyResource(Client, response.Value), response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Lists the keys in the specified managed HSM.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys
+ ///
+ /// -
+ /// Operation Id
+ /// ManagedHsmKeys_List
+ ///
+ /// -
+ /// Default Api Version
+ /// 2023-07-01
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The cancellation token to use.
+ /// An async collection of that may take multiple service requests to iterate over.
+ public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default)
+ {
+ HttpMessage FirstPageRequest(int? pageSizeHint) => _managedHSMKeyManagedHsmKeysRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _managedHSMKeyManagedHsmKeysRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name);
+ return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ManagedHSMKeyResource(Client, ManagedHsmKeyData.DeserializeManagedHsmKeyData(e)), _managedHSMKeyManagedHsmKeysClientDiagnostics, Pipeline, "ManagedHSMKeyCollection.GetAll", "value", "nextLink", cancellationToken);
+ }
+
+ ///
+ /// Lists the keys in the specified managed HSM.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys
+ ///
+ /// -
+ /// Operation Id
+ /// ManagedHsmKeys_List
+ ///
+ /// -
+ /// Default Api Version
+ /// 2023-07-01
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The cancellation token to use.
+ /// A collection of that may take multiple service requests to iterate over.
+ public virtual Pageable GetAll(CancellationToken cancellationToken = default)
+ {
+ HttpMessage FirstPageRequest(int? pageSizeHint) => _managedHSMKeyManagedHsmKeysRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _managedHSMKeyManagedHsmKeysRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name);
+ return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ManagedHSMKeyResource(Client, ManagedHsmKeyData.DeserializeManagedHsmKeyData(e)), _managedHSMKeyManagedHsmKeysClientDiagnostics, Pipeline, "ManagedHSMKeyCollection.GetAll", "value", "nextLink", cancellationToken);
+ }
+
+ ///
+ /// Checks to see if the resource exists in azure.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}
+ ///
+ /// -
+ /// Operation Id
+ /// ManagedHsmKeys_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2023-07-01
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The name of the key to be created. The value you provide may be copied globally for the purpose of running the service. The value provided should not include personally identifiable or sensitive information.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ public virtual async Task> ExistsAsync(string keyName, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(keyName, nameof(keyName));
+
+ using var scope = _managedHSMKeyManagedHsmKeysClientDiagnostics.CreateScope("ManagedHSMKeyCollection.Exists");
+ scope.Start();
+ try
+ {
+ var response = await _managedHSMKeyManagedHsmKeysRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, keyName, cancellationToken: cancellationToken).ConfigureAwait(false);
+ return Response.FromValue(response.Value != null, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Checks to see if the resource exists in azure.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}
+ ///
+ /// -
+ /// Operation Id
+ /// ManagedHsmKeys_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2023-07-01
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The name of the key to be created. The value you provide may be copied globally for the purpose of running the service. The value provided should not include personally identifiable or sensitive information.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ public virtual Response Exists(string keyName, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(keyName, nameof(keyName));
+
+ using var scope = _managedHSMKeyManagedHsmKeysClientDiagnostics.CreateScope("ManagedHSMKeyCollection.Exists");
+ scope.Start();
+ try
+ {
+ var response = _managedHSMKeyManagedHsmKeysRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, keyName, cancellationToken: cancellationToken);
+ return Response.FromValue(response.Value != null, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Tries to get details for this resource from the service.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}
+ ///
+ /// -
+ /// Operation Id
+ /// ManagedHsmKeys_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2023-07-01
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The name of the key to be created. The value you provide may be copied globally for the purpose of running the service. The value provided should not include personally identifiable or sensitive information.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ public virtual async Task> GetIfExistsAsync(string keyName, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(keyName, nameof(keyName));
+
+ using var scope = _managedHSMKeyManagedHsmKeysClientDiagnostics.CreateScope("ManagedHSMKeyCollection.GetIfExists");
+ scope.Start();
+ try
+ {
+ var response = await _managedHSMKeyManagedHsmKeysRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, keyName, cancellationToken: cancellationToken).ConfigureAwait(false);
+ if (response.Value == null)
+ return new NoValueResponse(response.GetRawResponse());
+ return Response.FromValue(new ManagedHSMKeyResource(Client, response.Value), response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Tries to get details for this resource from the service.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}
+ ///
+ /// -
+ /// Operation Id
+ /// ManagedHsmKeys_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2023-07-01
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The name of the key to be created. The value you provide may be copied globally for the purpose of running the service. The value provided should not include personally identifiable or sensitive information.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ public virtual NullableResponse GetIfExists(string keyName, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(keyName, nameof(keyName));
+
+ using var scope = _managedHSMKeyManagedHsmKeysClientDiagnostics.CreateScope("ManagedHSMKeyCollection.GetIfExists");
+ scope.Start();
+ try
+ {
+ var response = _managedHSMKeyManagedHsmKeysRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, keyName, cancellationToken: cancellationToken);
+ if (response.Value == null)
+ return new NoValueResponse(response.GetRawResponse());
+ return Response.FromValue(new ManagedHSMKeyResource(Client, response.Value), response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return GetAll().GetEnumerator();
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return GetAll().GetEnumerator();
+ }
+
+ IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken)
+ {
+ return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken);
+ }
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHSMKeyResource.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHSMKeyResource.Serialization.cs
new file mode 100644
index 0000000000000..7ba0bbc02f664
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHSMKeyResource.Serialization.cs
@@ -0,0 +1,26 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Text.Json;
+
+namespace Azure.ResourceManager.KeyVault
+{
+ public partial class ManagedHSMKeyResource : IJsonModel
+ {
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options);
+
+ ManagedHsmKeyData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options);
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options);
+
+ ManagedHsmKeyData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options);
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options);
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHSMKeyResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHSMKeyResource.cs
new file mode 100644
index 0000000000000..334f85ceef200
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHSMKeyResource.cs
@@ -0,0 +1,696 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.KeyVault.Models;
+
+namespace Azure.ResourceManager.KeyVault
+{
+ ///
+ /// A Class representing a ManagedHSMKey along with the instance operations that can be performed on it.
+ /// If you have a you can construct a
+ /// from an instance of using the GetManagedHSMKeyResource method.
+ /// Otherwise you can get one from its parent resource using the GetManagedHSMKey method.
+ ///
+ public partial class ManagedHSMKeyResource : ArmResource
+ {
+ /// Generate the resource identifier of a instance.
+ /// The subscriptionId.
+ /// The resourceGroupName.
+ /// The name.
+ /// The keyName.
+ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string keyName)
+ {
+ var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}";
+ return new ResourceIdentifier(resourceId);
+ }
+
+ private readonly ClientDiagnostics _managedHSMKeyManagedHsmKeysClientDiagnostics;
+ private readonly ManagedHsmKeysRestOperations _managedHSMKeyManagedHsmKeysRestClient;
+ private readonly ManagedHsmKeyData _data;
+
+ /// Gets the resource type for the operations.
+ public static readonly ResourceType ResourceType = "Microsoft.KeyVault/managedHSMs/keys";
+
+ /// Initializes a new instance of the class for mocking.
+ protected ManagedHSMKeyResource()
+ {
+ }
+
+ /// Initializes a new instance of the class.
+ /// The client parameters to use in these operations.
+ /// The resource that is the target of operations.
+ internal ManagedHSMKeyResource(ArmClient client, ManagedHsmKeyData data) : this(client, data.Id)
+ {
+ HasData = true;
+ _data = data;
+ }
+
+ /// Initializes a new instance of the class.
+ /// The client parameters to use in these operations.
+ /// The identifier of the resource that is the target of operations.
+ internal ManagedHSMKeyResource(ArmClient client, ResourceIdentifier id) : base(client, id)
+ {
+ _managedHSMKeyManagedHsmKeysClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.KeyVault", ResourceType.Namespace, Diagnostics);
+ TryGetApiVersion(ResourceType, out string managedHSMKeyManagedHsmKeysApiVersion);
+ _managedHSMKeyManagedHsmKeysRestClient = new ManagedHsmKeysRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, managedHSMKeyManagedHsmKeysApiVersion);
+#if DEBUG
+ ValidateResourceId(Id);
+#endif
+ }
+
+ /// Gets whether or not the current instance has data.
+ public virtual bool HasData { get; }
+
+ /// Gets the data representing this Feature.
+ /// Throws if there is no data loaded in the current instance.
+ public virtual ManagedHsmKeyData Data
+ {
+ get
+ {
+ if (!HasData)
+ throw new InvalidOperationException("The current instance does not have data, you must call Get first.");
+ return _data;
+ }
+ }
+
+ internal static void ValidateResourceId(ResourceIdentifier id)
+ {
+ if (id.ResourceType != ResourceType)
+ throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id));
+ }
+
+ /// Gets a collection of ManagedHSMKeyVersionResources in the ManagedHSMKey.
+ /// An object representing collection of ManagedHSMKeyVersionResources and their operations over a ManagedHSMKeyVersionResource.
+ public virtual ManagedHSMKeyVersionCollection GetManagedHSMKeyVersions()
+ {
+ return GetCachedClient(client => new ManagedHSMKeyVersionCollection(client, Id));
+ }
+
+ ///
+ /// Gets the specified version of the specified key in the specified managed HSM.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}/versions/{keyVersion}
+ ///
+ /// -
+ /// Operation Id
+ /// ManagedHsmKeys_GetVersion
+ ///
+ /// -
+ /// Default Api Version
+ /// 2023-07-01
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The version of the key to be retrieved.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ [ForwardsClientCalls]
+ public virtual async Task> GetManagedHSMKeyVersionAsync(string keyVersion, CancellationToken cancellationToken = default)
+ {
+ return await GetManagedHSMKeyVersions().GetAsync(keyVersion, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// Gets the specified version of the specified key in the specified managed HSM.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}/versions/{keyVersion}
+ ///
+ /// -
+ /// Operation Id
+ /// ManagedHsmKeys_GetVersion
+ ///
+ /// -
+ /// Default Api Version
+ /// 2023-07-01
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The version of the key to be retrieved.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ [ForwardsClientCalls]
+ public virtual Response GetManagedHSMKeyVersion(string keyVersion, CancellationToken cancellationToken = default)
+ {
+ return GetManagedHSMKeyVersions().Get(keyVersion, cancellationToken);
+ }
+
+ ///
+ /// Gets the current version of the specified key from the specified managed HSM.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}
+ ///
+ /// -
+ /// Operation Id
+ /// ManagedHsmKeys_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2023-07-01
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The cancellation token to use.
+ public virtual async Task> GetAsync(CancellationToken cancellationToken = default)
+ {
+ using var scope = _managedHSMKeyManagedHsmKeysClientDiagnostics.CreateScope("ManagedHSMKeyResource.Get");
+ scope.Start();
+ try
+ {
+ var response = await _managedHSMKeyManagedHsmKeysRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false);
+ if (response.Value == null)
+ throw new RequestFailedException(response.GetRawResponse());
+ return Response.FromValue(new ManagedHSMKeyResource(Client, response.Value), response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Gets the current version of the specified key from the specified managed HSM.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}
+ ///
+ /// -
+ /// Operation Id
+ /// ManagedHsmKeys_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2023-07-01
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The cancellation token to use.
+ public virtual Response Get(CancellationToken cancellationToken = default)
+ {
+ using var scope = _managedHSMKeyManagedHsmKeysClientDiagnostics.CreateScope("ManagedHSMKeyResource.Get");
+ scope.Start();
+ try
+ {
+ var response = _managedHSMKeyManagedHsmKeysRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken);
+ if (response.Value == null)
+ throw new RequestFailedException(response.GetRawResponse());
+ return Response.FromValue(new ManagedHSMKeyResource(Client, response.Value), response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Creates the first version of a new key if it does not exist. If it already exists, then the existing key is returned without any write operations being performed. This API does not create subsequent versions, and does not update existing keys.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}
+ ///
+ /// -
+ /// Operation Id
+ /// ManagedHsmKeys_CreateIfNotExist
+ ///
+ /// -
+ /// Default Api Version
+ /// 2023-07-01
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.
+ /// The parameters used to create the specified key.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual async Task> UpdateAsync(WaitUntil waitUntil, ManagedHSMKeyCreateOrUpdateContent content, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = _managedHSMKeyManagedHsmKeysClientDiagnostics.CreateScope("ManagedHSMKeyResource.Update");
+ scope.Start();
+ try
+ {
+ var response = await _managedHSMKeyManagedHsmKeysRestClient.CreateIfNotExistAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content, cancellationToken).ConfigureAwait(false);
+ var uri = _managedHSMKeyManagedHsmKeysRestClient.CreateCreateIfNotExistRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content);
+ var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString());
+ var operation = new KeyVaultArmOperation(Response.FromValue(new ManagedHSMKeyResource(Client, response), response.GetRawResponse()), rehydrationToken);
+ if (waitUntil == WaitUntil.Completed)
+ await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
+ return operation;
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Creates the first version of a new key if it does not exist. If it already exists, then the existing key is returned without any write operations being performed. This API does not create subsequent versions, and does not update existing keys.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}
+ ///
+ /// -
+ /// Operation Id
+ /// ManagedHsmKeys_CreateIfNotExist
+ ///
+ /// -
+ /// Default Api Version
+ /// 2023-07-01
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.
+ /// The parameters used to create the specified key.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual ArmOperation Update(WaitUntil waitUntil, ManagedHSMKeyCreateOrUpdateContent content, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = _managedHSMKeyManagedHsmKeysClientDiagnostics.CreateScope("ManagedHSMKeyResource.Update");
+ scope.Start();
+ try
+ {
+ var response = _managedHSMKeyManagedHsmKeysRestClient.CreateIfNotExist(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content, cancellationToken);
+ var uri = _managedHSMKeyManagedHsmKeysRestClient.CreateCreateIfNotExistRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content);
+ var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString());
+ var operation = new KeyVaultArmOperation(Response.FromValue(new ManagedHSMKeyResource(Client, response), response.GetRawResponse()), rehydrationToken);
+ if (waitUntil == WaitUntil.Completed)
+ operation.WaitForCompletion(cancellationToken);
+ return operation;
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Add a tag to the current resource.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}
+ ///
+ /// -
+ /// Operation Id
+ /// ManagedHsmKeys_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2023-07-01
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The key for the tag.
+ /// The value for the tag.
+ /// The cancellation token to use.
+ /// or is null.
+ public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(key, nameof(key));
+ Argument.AssertNotNull(value, nameof(value));
+
+ using var scope = _managedHSMKeyManagedHsmKeysClientDiagnostics.CreateScope("ManagedHSMKeyResource.AddTag");
+ scope.Start();
+ try
+ {
+ if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false))
+ {
+ var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false);
+ originalTags.Value.Data.TagValues[key] = value;
+ await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false);
+ var originalResponse = await _managedHSMKeyManagedHsmKeysRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false);
+ return Response.FromValue(new ManagedHSMKeyResource(Client, originalResponse.Value), originalResponse.GetRawResponse());
+ }
+ else
+ {
+ var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data;
+ var patch = new ManagedHSMKeyCreateOrUpdateContent(current.Properties);
+ foreach (var tag in current.Tags)
+ {
+ patch.Tags.Add(tag);
+ }
+ patch.Tags[key] = value;
+ var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false);
+ return Response.FromValue(result.Value, result.GetRawResponse());
+ }
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Add a tag to the current resource.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}
+ ///
+ /// -
+ /// Operation Id
+ /// ManagedHsmKeys_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2023-07-01
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The key for the tag.
+ /// The value for the tag.
+ /// The cancellation token to use.
+ /// or is null.
+ public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(key, nameof(key));
+ Argument.AssertNotNull(value, nameof(value));
+
+ using var scope = _managedHSMKeyManagedHsmKeysClientDiagnostics.CreateScope("ManagedHSMKeyResource.AddTag");
+ scope.Start();
+ try
+ {
+ if (CanUseTagResource(cancellationToken: cancellationToken))
+ {
+ var originalTags = GetTagResource().Get(cancellationToken);
+ originalTags.Value.Data.TagValues[key] = value;
+ GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken);
+ var originalResponse = _managedHSMKeyManagedHsmKeysRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken);
+ return Response.FromValue(new ManagedHSMKeyResource(Client, originalResponse.Value), originalResponse.GetRawResponse());
+ }
+ else
+ {
+ var current = Get(cancellationToken: cancellationToken).Value.Data;
+ var patch = new ManagedHSMKeyCreateOrUpdateContent(current.Properties);
+ foreach (var tag in current.Tags)
+ {
+ patch.Tags.Add(tag);
+ }
+ patch.Tags[key] = value;
+ var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken);
+ return Response.FromValue(result.Value, result.GetRawResponse());
+ }
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Replace the tags on the resource with the given set.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}
+ ///
+ /// -
+ /// Operation Id
+ /// ManagedHsmKeys_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2023-07-01
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The set of tags to use as replacement.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(tags, nameof(tags));
+
+ using var scope = _managedHSMKeyManagedHsmKeysClientDiagnostics.CreateScope("ManagedHSMKeyResource.SetTags");
+ scope.Start();
+ try
+ {
+ if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false))
+ {
+ await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false);
+ var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false);
+ originalTags.Value.Data.TagValues.ReplaceWith(tags);
+ await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false);
+ var originalResponse = await _managedHSMKeyManagedHsmKeysRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false);
+ return Response.FromValue(new ManagedHSMKeyResource(Client, originalResponse.Value), originalResponse.GetRawResponse());
+ }
+ else
+ {
+ var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data;
+ var patch = new ManagedHSMKeyCreateOrUpdateContent(current.Properties);
+ patch.Tags.ReplaceWith(tags);
+ var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false);
+ return Response.FromValue(result.Value, result.GetRawResponse());
+ }
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Replace the tags on the resource with the given set.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}
+ ///
+ /// -
+ /// Operation Id
+ /// ManagedHsmKeys_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2023-07-01
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The set of tags to use as replacement.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(tags, nameof(tags));
+
+ using var scope = _managedHSMKeyManagedHsmKeysClientDiagnostics.CreateScope("ManagedHSMKeyResource.SetTags");
+ scope.Start();
+ try
+ {
+ if (CanUseTagResource(cancellationToken: cancellationToken))
+ {
+ GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken);
+ var originalTags = GetTagResource().Get(cancellationToken);
+ originalTags.Value.Data.TagValues.ReplaceWith(tags);
+ GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken);
+ var originalResponse = _managedHSMKeyManagedHsmKeysRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken);
+ return Response.FromValue(new ManagedHSMKeyResource(Client, originalResponse.Value), originalResponse.GetRawResponse());
+ }
+ else
+ {
+ var current = Get(cancellationToken: cancellationToken).Value.Data;
+ var patch = new ManagedHSMKeyCreateOrUpdateContent(current.Properties);
+ patch.Tags.ReplaceWith(tags);
+ var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken);
+ return Response.FromValue(result.Value, result.GetRawResponse());
+ }
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Removes a tag by key from the resource.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}
+ ///
+ /// -
+ /// Operation Id
+ /// ManagedHsmKeys_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2023-07-01
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The key for the tag.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(key, nameof(key));
+
+ using var scope = _managedHSMKeyManagedHsmKeysClientDiagnostics.CreateScope("ManagedHSMKeyResource.RemoveTag");
+ scope.Start();
+ try
+ {
+ if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false))
+ {
+ var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false);
+ originalTags.Value.Data.TagValues.Remove(key);
+ await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false);
+ var originalResponse = await _managedHSMKeyManagedHsmKeysRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false);
+ return Response.FromValue(new ManagedHSMKeyResource(Client, originalResponse.Value), originalResponse.GetRawResponse());
+ }
+ else
+ {
+ var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data;
+ var patch = new ManagedHSMKeyCreateOrUpdateContent(current.Properties);
+ foreach (var tag in current.Tags)
+ {
+ patch.Tags.Add(tag);
+ }
+ patch.Tags.Remove(key);
+ var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false);
+ return Response.FromValue(result.Value, result.GetRawResponse());
+ }
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Removes a tag by key from the resource.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}
+ ///
+ /// -
+ /// Operation Id
+ /// ManagedHsmKeys_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2023-07-01
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The key for the tag.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(key, nameof(key));
+
+ using var scope = _managedHSMKeyManagedHsmKeysClientDiagnostics.CreateScope("ManagedHSMKeyResource.RemoveTag");
+ scope.Start();
+ try
+ {
+ if (CanUseTagResource(cancellationToken: cancellationToken))
+ {
+ var originalTags = GetTagResource().Get(cancellationToken);
+ originalTags.Value.Data.TagValues.Remove(key);
+ GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken);
+ var originalResponse = _managedHSMKeyManagedHsmKeysRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken);
+ return Response.FromValue(new ManagedHSMKeyResource(Client, originalResponse.Value), originalResponse.GetRawResponse());
+ }
+ else
+ {
+ var current = Get(cancellationToken: cancellationToken).Value.Data;
+ var patch = new ManagedHSMKeyCreateOrUpdateContent(current.Properties);
+ foreach (var tag in current.Tags)
+ {
+ patch.Tags.Add(tag);
+ }
+ patch.Tags.Remove(key);
+ var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken);
+ return Response.FromValue(result.Value, result.GetRawResponse());
+ }
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHSMKeyVersionCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHSMKeyVersionCollection.cs
new file mode 100644
index 0000000000000..a80834affaf4c
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHSMKeyVersionCollection.cs
@@ -0,0 +1,395 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Threading;
+using System.Threading.Tasks;
+using Autorest.CSharp.Core;
+using Azure.Core;
+using Azure.Core.Pipeline;
+
+namespace Azure.ResourceManager.KeyVault
+{
+ ///
+ /// A class representing a collection of and their operations.
+ /// Each in the collection will belong to the same instance of .
+ /// To get a instance call the GetManagedHSMKeyVersions method from an instance of .
+ ///
+ public partial class ManagedHSMKeyVersionCollection : ArmCollection, IEnumerable, IAsyncEnumerable
+ {
+ private readonly ClientDiagnostics _managedHSMKeyVersionManagedHsmKeysClientDiagnostics;
+ private readonly ManagedHsmKeysRestOperations _managedHSMKeyVersionManagedHsmKeysRestClient;
+
+ /// Initializes a new instance of the class for mocking.
+ protected ManagedHSMKeyVersionCollection()
+ {
+ }
+
+ /// Initializes a new instance of the class.
+ /// The client parameters to use in these operations.
+ /// The identifier of the parent resource that is the target of operations.
+ internal ManagedHSMKeyVersionCollection(ArmClient client, ResourceIdentifier id) : base(client, id)
+ {
+ _managedHSMKeyVersionManagedHsmKeysClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.KeyVault", ManagedHSMKeyVersionResource.ResourceType.Namespace, Diagnostics);
+ TryGetApiVersion(ManagedHSMKeyVersionResource.ResourceType, out string managedHSMKeyVersionManagedHsmKeysApiVersion);
+ _managedHSMKeyVersionManagedHsmKeysRestClient = new ManagedHsmKeysRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, managedHSMKeyVersionManagedHsmKeysApiVersion);
+#if DEBUG
+ ValidateResourceId(Id);
+#endif
+ }
+
+ internal static void ValidateResourceId(ResourceIdentifier id)
+ {
+ if (id.ResourceType != ManagedHSMKeyResource.ResourceType)
+ throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ManagedHSMKeyResource.ResourceType), nameof(id));
+ }
+
+ ///
+ /// Gets the specified version of the specified key in the specified managed HSM.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}/versions/{keyVersion}
+ ///
+ /// -
+ /// Operation Id
+ /// ManagedHsmKeys_GetVersion
+ ///
+ /// -
+ /// Default Api Version
+ /// 2023-07-01
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The version of the key to be retrieved.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ public virtual async Task> GetAsync(string keyVersion, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(keyVersion, nameof(keyVersion));
+
+ using var scope = _managedHSMKeyVersionManagedHsmKeysClientDiagnostics.CreateScope("ManagedHSMKeyVersionCollection.Get");
+ scope.Start();
+ try
+ {
+ var response = await _managedHSMKeyVersionManagedHsmKeysRestClient.GetVersionAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, keyVersion, cancellationToken).ConfigureAwait(false);
+ if (response.Value == null)
+ throw new RequestFailedException(response.GetRawResponse());
+ return Response.FromValue(new ManagedHSMKeyVersionResource(Client, response.Value), response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Gets the specified version of the specified key in the specified managed HSM.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}/versions/{keyVersion}
+ ///
+ /// -
+ /// Operation Id
+ /// ManagedHsmKeys_GetVersion
+ ///
+ /// -
+ /// Default Api Version
+ /// 2023-07-01
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The version of the key to be retrieved.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ public virtual Response Get(string keyVersion, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(keyVersion, nameof(keyVersion));
+
+ using var scope = _managedHSMKeyVersionManagedHsmKeysClientDiagnostics.CreateScope("ManagedHSMKeyVersionCollection.Get");
+ scope.Start();
+ try
+ {
+ var response = _managedHSMKeyVersionManagedHsmKeysRestClient.GetVersion(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, keyVersion, cancellationToken);
+ if (response.Value == null)
+ throw new RequestFailedException(response.GetRawResponse());
+ return Response.FromValue(new ManagedHSMKeyVersionResource(Client, response.Value), response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Lists the versions of the specified key in the specified managed HSM.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}/versions
+ ///
+ /// -
+ /// Operation Id
+ /// ManagedHsmKeys_ListVersions
+ ///
+ /// -
+ /// Default Api Version
+ /// 2023-07-01
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The cancellation token to use.
+ /// An async collection of that may take multiple service requests to iterate over.
+ public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default)
+ {
+ HttpMessage FirstPageRequest(int? pageSizeHint) => _managedHSMKeyVersionManagedHsmKeysRestClient.CreateListVersionsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _managedHSMKeyVersionManagedHsmKeysRestClient.CreateListVersionsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name);
+ return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ManagedHSMKeyVersionResource(Client, ManagedHsmKeyData.DeserializeManagedHsmKeyData(e)), _managedHSMKeyVersionManagedHsmKeysClientDiagnostics, Pipeline, "ManagedHSMKeyVersionCollection.GetAll", "value", "nextLink", cancellationToken);
+ }
+
+ ///
+ /// Lists the versions of the specified key in the specified managed HSM.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}/versions
+ ///
+ /// -
+ /// Operation Id
+ /// ManagedHsmKeys_ListVersions
+ ///
+ /// -
+ /// Default Api Version
+ /// 2023-07-01
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The cancellation token to use.
+ /// A collection of that may take multiple service requests to iterate over.
+ public virtual Pageable GetAll(CancellationToken cancellationToken = default)
+ {
+ HttpMessage FirstPageRequest(int? pageSizeHint) => _managedHSMKeyVersionManagedHsmKeysRestClient.CreateListVersionsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _managedHSMKeyVersionManagedHsmKeysRestClient.CreateListVersionsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name);
+ return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ManagedHSMKeyVersionResource(Client, ManagedHsmKeyData.DeserializeManagedHsmKeyData(e)), _managedHSMKeyVersionManagedHsmKeysClientDiagnostics, Pipeline, "ManagedHSMKeyVersionCollection.GetAll", "value", "nextLink", cancellationToken);
+ }
+
+ ///
+ /// Checks to see if the resource exists in azure.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}/versions/{keyVersion}
+ ///
+ /// -
+ /// Operation Id
+ /// ManagedHsmKeys_GetVersion
+ ///
+ /// -
+ /// Default Api Version
+ /// 2023-07-01
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The version of the key to be retrieved.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ public virtual async Task> ExistsAsync(string keyVersion, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(keyVersion, nameof(keyVersion));
+
+ using var scope = _managedHSMKeyVersionManagedHsmKeysClientDiagnostics.CreateScope("ManagedHSMKeyVersionCollection.Exists");
+ scope.Start();
+ try
+ {
+ var response = await _managedHSMKeyVersionManagedHsmKeysRestClient.GetVersionAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, keyVersion, cancellationToken: cancellationToken).ConfigureAwait(false);
+ return Response.FromValue(response.Value != null, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Checks to see if the resource exists in azure.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}/versions/{keyVersion}
+ ///
+ /// -
+ /// Operation Id
+ /// ManagedHsmKeys_GetVersion
+ ///
+ /// -
+ /// Default Api Version
+ /// 2023-07-01
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The version of the key to be retrieved.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ public virtual Response Exists(string keyVersion, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(keyVersion, nameof(keyVersion));
+
+ using var scope = _managedHSMKeyVersionManagedHsmKeysClientDiagnostics.CreateScope("ManagedHSMKeyVersionCollection.Exists");
+ scope.Start();
+ try
+ {
+ var response = _managedHSMKeyVersionManagedHsmKeysRestClient.GetVersion(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, keyVersion, cancellationToken: cancellationToken);
+ return Response.FromValue(response.Value != null, response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Tries to get details for this resource from the service.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}/versions/{keyVersion}
+ ///
+ /// -
+ /// Operation Id
+ /// ManagedHsmKeys_GetVersion
+ ///
+ /// -
+ /// Default Api Version
+ /// 2023-07-01
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The version of the key to be retrieved.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ public virtual async Task> GetIfExistsAsync(string keyVersion, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(keyVersion, nameof(keyVersion));
+
+ using var scope = _managedHSMKeyVersionManagedHsmKeysClientDiagnostics.CreateScope("ManagedHSMKeyVersionCollection.GetIfExists");
+ scope.Start();
+ try
+ {
+ var response = await _managedHSMKeyVersionManagedHsmKeysRestClient.GetVersionAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, keyVersion, cancellationToken: cancellationToken).ConfigureAwait(false);
+ if (response.Value == null)
+ return new NoValueResponse(response.GetRawResponse());
+ return Response.FromValue(new ManagedHSMKeyVersionResource(Client, response.Value), response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Tries to get details for this resource from the service.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}/versions/{keyVersion}
+ ///
+ /// -
+ /// Operation Id
+ /// ManagedHsmKeys_GetVersion
+ ///
+ /// -
+ /// Default Api Version
+ /// 2023-07-01
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The version of the key to be retrieved.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ public virtual NullableResponse GetIfExists(string keyVersion, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(keyVersion, nameof(keyVersion));
+
+ using var scope = _managedHSMKeyVersionManagedHsmKeysClientDiagnostics.CreateScope("ManagedHSMKeyVersionCollection.GetIfExists");
+ scope.Start();
+ try
+ {
+ var response = _managedHSMKeyVersionManagedHsmKeysRestClient.GetVersion(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, keyVersion, cancellationToken: cancellationToken);
+ if (response.Value == null)
+ return new NoValueResponse(response.GetRawResponse());
+ return Response.FromValue(new ManagedHSMKeyVersionResource(Client, response.Value), response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return GetAll().GetEnumerator();
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return GetAll().GetEnumerator();
+ }
+
+ IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken)
+ {
+ return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken);
+ }
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHSMKeyVersionResource.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHSMKeyVersionResource.Serialization.cs
new file mode 100644
index 0000000000000..db9ef782ca1fe
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHSMKeyVersionResource.Serialization.cs
@@ -0,0 +1,26 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Text.Json;
+
+namespace Azure.ResourceManager.KeyVault
+{
+ public partial class ManagedHSMKeyVersionResource : IJsonModel
+ {
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options);
+
+ ManagedHsmKeyData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options);
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options);
+
+ ManagedHsmKeyData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options);
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options);
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHSMKeyVersionResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHSMKeyVersionResource.cs
new file mode 100644
index 0000000000000..1d50d506ee863
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHSMKeyVersionResource.cs
@@ -0,0 +1,172 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Globalization;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure.Core;
+using Azure.Core.Pipeline;
+
+namespace Azure.ResourceManager.KeyVault
+{
+ ///
+ /// A Class representing a ManagedHSMKeyVersion along with the instance operations that can be performed on it.
+ /// If you have a you can construct a
+ /// from an instance of using the GetManagedHSMKeyVersionResource method.
+ /// Otherwise you can get one from its parent resource using the GetManagedHSMKeyVersion method.
+ ///
+ public partial class ManagedHSMKeyVersionResource : ArmResource
+ {
+ /// Generate the resource identifier of a instance.
+ /// The subscriptionId.
+ /// The resourceGroupName.
+ /// The name.
+ /// The keyName.
+ /// The keyVersion.
+ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string keyName, string keyVersion)
+ {
+ var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}/versions/{keyVersion}";
+ return new ResourceIdentifier(resourceId);
+ }
+
+ private readonly ClientDiagnostics _managedHSMKeyVersionManagedHsmKeysClientDiagnostics;
+ private readonly ManagedHsmKeysRestOperations _managedHSMKeyVersionManagedHsmKeysRestClient;
+ private readonly ManagedHsmKeyData _data;
+
+ /// Gets the resource type for the operations.
+ public static readonly ResourceType ResourceType = "Microsoft.KeyVault/managedHSMs/keys/versions";
+
+ /// Initializes a new instance of the class for mocking.
+ protected ManagedHSMKeyVersionResource()
+ {
+ }
+
+ /// Initializes a new instance of the class.
+ /// The client parameters to use in these operations.
+ /// The resource that is the target of operations.
+ internal ManagedHSMKeyVersionResource(ArmClient client, ManagedHsmKeyData data) : this(client, data.Id)
+ {
+ HasData = true;
+ _data = data;
+ }
+
+ /// Initializes a new instance of the class.
+ /// The client parameters to use in these operations.
+ /// The identifier of the resource that is the target of operations.
+ internal ManagedHSMKeyVersionResource(ArmClient client, ResourceIdentifier id) : base(client, id)
+ {
+ _managedHSMKeyVersionManagedHsmKeysClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.KeyVault", ResourceType.Namespace, Diagnostics);
+ TryGetApiVersion(ResourceType, out string managedHSMKeyVersionManagedHsmKeysApiVersion);
+ _managedHSMKeyVersionManagedHsmKeysRestClient = new ManagedHsmKeysRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, managedHSMKeyVersionManagedHsmKeysApiVersion);
+#if DEBUG
+ ValidateResourceId(Id);
+#endif
+ }
+
+ /// Gets whether or not the current instance has data.
+ public virtual bool HasData { get; }
+
+ /// Gets the data representing this Feature.
+ /// Throws if there is no data loaded in the current instance.
+ public virtual ManagedHsmKeyData Data
+ {
+ get
+ {
+ if (!HasData)
+ throw new InvalidOperationException("The current instance does not have data, you must call Get first.");
+ return _data;
+ }
+ }
+
+ internal static void ValidateResourceId(ResourceIdentifier id)
+ {
+ if (id.ResourceType != ResourceType)
+ throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id));
+ }
+
+ ///
+ /// Gets the specified version of the specified key in the specified managed HSM.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}/versions/{keyVersion}
+ ///
+ /// -
+ /// Operation Id
+ /// ManagedHsmKeys_GetVersion
+ ///
+ /// -
+ /// Default Api Version
+ /// 2023-07-01
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The cancellation token to use.
+ public virtual async Task> GetAsync(CancellationToken cancellationToken = default)
+ {
+ using var scope = _managedHSMKeyVersionManagedHsmKeysClientDiagnostics.CreateScope("ManagedHSMKeyVersionResource.Get");
+ scope.Start();
+ try
+ {
+ var response = await _managedHSMKeyVersionManagedHsmKeysRestClient.GetVersionAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false);
+ if (response.Value == null)
+ throw new RequestFailedException(response.GetRawResponse());
+ return Response.FromValue(new ManagedHSMKeyVersionResource(Client, response.Value), response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Gets the specified version of the specified key in the specified managed HSM.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}/versions/{keyVersion}
+ ///
+ /// -
+ /// Operation Id
+ /// ManagedHsmKeys_GetVersion
+ ///
+ /// -
+ /// Default Api Version
+ /// 2023-07-01
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The cancellation token to use.
+ public virtual Response Get(CancellationToken cancellationToken = default)
+ {
+ using var scope = _managedHSMKeyVersionManagedHsmKeysClientDiagnostics.CreateScope("ManagedHSMKeyVersionResource.Get");
+ scope.Start();
+ try
+ {
+ var response = _managedHSMKeyVersionManagedHsmKeysRestClient.GetVersion(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken);
+ if (response.Value == null)
+ throw new RequestFailedException(response.GetRawResponse());
+ return Response.FromValue(new ManagedHSMKeyVersionResource(Client, response.Value), response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmCollection.cs
index 74e345e9c64e4..36eb798d4b1e0 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmCollection.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmCollection.cs
@@ -65,7 +65,7 @@ internal static void ValidateResourceId(ResourceIdentifier id)
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -114,7 +114,7 @@ public virtual async Task> CreateOrUpdateAsync(
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -163,7 +163,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil waitUnt
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -208,7 +208,7 @@ public virtual async Task> GetAsync(string name, Ca
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -253,7 +253,7 @@ public virtual Response Get(string name, CancellationToken c
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -284,7 +284,7 @@ public virtual AsyncPageable GetAllAsync(int? top = null, Ca
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -315,7 +315,7 @@ public virtual Pageable GetAll(int? top = null, Cancellation
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -358,7 +358,7 @@ public virtual async Task> ExistsAsync(string name, CancellationT
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -401,7 +401,7 @@ public virtual Response Exists(string name, CancellationToken cancellation
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -446,7 +446,7 @@ public virtual async Task> GetIfExistsAsync
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmData.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmData.Serialization.cs
index c6fa57ae14be0..9cc54e4052d1c 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmData.Serialization.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmData.Serialization.cs
@@ -40,6 +40,12 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOp
writer.WritePropertyName("sku"u8);
writer.WriteObjectValue(Sku, options);
}
+ if (Optional.IsDefined(Identity))
+ {
+ writer.WritePropertyName("identity"u8);
+ var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } };
+ JsonSerializer.Serialize(writer, Identity, serializeOptions);
+ }
if (Optional.IsCollectionDefined(Tags))
{
writer.WritePropertyName("tags"u8);
@@ -113,6 +119,7 @@ internal static ManagedHsmData DeserializeManagedHsmData(JsonElement element, Mo
}
ManagedHsmProperties properties = default;
ManagedHsmSku sku = default;
+ ManagedServiceIdentity identity = default;
IDictionary tags = default;
AzureLocation location = default;
ResourceIdentifier id = default;
@@ -141,6 +148,16 @@ internal static ManagedHsmData DeserializeManagedHsmData(JsonElement element, Mo
sku = ManagedHsmSku.DeserializeManagedHsmSku(property.Value, options);
continue;
}
+ if (property.NameEquals("identity"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } };
+ identity = JsonSerializer.Deserialize(property.Value.GetRawText(), serializeOptions);
+ continue;
+ }
if (property.NameEquals("tags"u8))
{
if (property.Value.ValueKind == JsonValueKind.Null)
@@ -199,6 +216,7 @@ internal static ManagedHsmData DeserializeManagedHsmData(JsonElement element, Mo
location,
properties,
sku,
+ identity,
serializedAdditionalRawData);
}
@@ -315,6 +333,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
}
}
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Identity), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" identity: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(Identity))
+ {
+ builder.Append(" identity: ");
+ BicepSerializationHelpers.AppendChildObject(builder, Identity, options, 2, false, " identity: ");
+ }
+ }
+
hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride);
if (hasPropertyOverride)
{
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmData.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmData.cs
index 0b649360401ef..f1a5cd0fe4d8a 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmData.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmData.cs
@@ -66,11 +66,13 @@ public ManagedHsmData(AzureLocation location) : base(location)
/// The location.
/// Properties of the managed HSM.
/// SKU details.
+ /// Managed service identity (system assigned and/or user assigned identities).
/// Keeps track of any properties unknown to the library.
- internal ManagedHsmData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedHsmProperties properties, ManagedHsmSku sku, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location)
+ internal ManagedHsmData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedHsmProperties properties, ManagedHsmSku sku, ManagedServiceIdentity identity, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location)
{
Properties = properties;
Sku = sku;
+ Identity = identity;
_serializedAdditionalRawData = serializedAdditionalRawData;
}
@@ -85,5 +87,8 @@ internal ManagedHsmData()
/// SKU details.
[WirePath("sku")]
public ManagedHsmSku Sku { get; set; }
+ /// Managed service identity (system assigned and/or user assigned identities).
+ [WirePath("identity")]
+ public ManagedServiceIdentity Identity { get; set; }
}
}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmKeyData.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmKeyData.Serialization.cs
new file mode 100644
index 0000000000000..932c49aac90ab
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmKeyData.Serialization.cs
@@ -0,0 +1,621 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.Json;
+using Azure.Core;
+using Azure.ResourceManager.KeyVault.Models;
+using Azure.ResourceManager.Models;
+
+namespace Azure.ResourceManager.KeyVault
+{
+ public partial class ManagedHsmKeyData : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(ManagedHsmKeyData)} does not support writing '{format}' format.");
+ }
+
+ writer.WriteStartObject();
+ if (Optional.IsCollectionDefined(Tags))
+ {
+ writer.WritePropertyName("tags"u8);
+ writer.WriteStartObject();
+ foreach (var item in Tags)
+ {
+ writer.WritePropertyName(item.Key);
+ writer.WriteStringValue(item.Value);
+ }
+ writer.WriteEndObject();
+ }
+ if (options.Format != "W")
+ {
+ writer.WritePropertyName("id"u8);
+ writer.WriteStringValue(Id);
+ }
+ if (options.Format != "W")
+ {
+ writer.WritePropertyName("name"u8);
+ writer.WriteStringValue(Name);
+ }
+ if (options.Format != "W")
+ {
+ writer.WritePropertyName("type"u8);
+ writer.WriteStringValue(ResourceType);
+ }
+ if (options.Format != "W" && Optional.IsDefined(SystemData))
+ {
+ writer.WritePropertyName("systemData"u8);
+ JsonSerializer.Serialize(writer, SystemData);
+ }
+ writer.WritePropertyName("properties"u8);
+ writer.WriteStartObject();
+ if (Optional.IsDefined(Attributes))
+ {
+ writer.WritePropertyName("attributes"u8);
+ writer.WriteObjectValue(Attributes, options);
+ }
+ if (Optional.IsDefined(Kty))
+ {
+ writer.WritePropertyName("kty"u8);
+ writer.WriteStringValue(Kty.Value.ToString());
+ }
+ if (Optional.IsCollectionDefined(KeyOps))
+ {
+ writer.WritePropertyName("keyOps"u8);
+ writer.WriteStartArray();
+ foreach (var item in KeyOps)
+ {
+ writer.WriteStringValue(item.ToString());
+ }
+ writer.WriteEndArray();
+ }
+ if (Optional.IsDefined(KeySize))
+ {
+ writer.WritePropertyName("keySize"u8);
+ writer.WriteNumberValue(KeySize.Value);
+ }
+ if (Optional.IsDefined(CurveName))
+ {
+ writer.WritePropertyName("curveName"u8);
+ writer.WriteStringValue(CurveName.Value.ToString());
+ }
+ if (options.Format != "W" && Optional.IsDefined(KeyUri))
+ {
+ writer.WritePropertyName("keyUri"u8);
+ writer.WriteStringValue(KeyUri.AbsoluteUri);
+ }
+ if (options.Format != "W" && Optional.IsDefined(KeyUriWithVersion))
+ {
+ writer.WritePropertyName("keyUriWithVersion"u8);
+ writer.WriteStringValue(KeyUriWithVersion);
+ }
+ if (Optional.IsDefined(RotationPolicy))
+ {
+ writer.WritePropertyName("rotationPolicy"u8);
+ writer.WriteObjectValue(RotationPolicy, options);
+ }
+ if (Optional.IsDefined(ReleasePolicy))
+ {
+ writer.WritePropertyName("release_policy"u8);
+ writer.WriteObjectValue(ReleasePolicy, options);
+ }
+ writer.WriteEndObject();
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ writer.WriteEndObject();
+ }
+
+ ManagedHsmKeyData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(ManagedHsmKeyData)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeManagedHsmKeyData(document.RootElement, options);
+ }
+
+ internal static ManagedHsmKeyData DeserializeManagedHsmKeyData(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ IReadOnlyDictionary tags = default;
+ ResourceIdentifier id = default;
+ string name = default;
+ ResourceType type = default;
+ SystemData systemData = default;
+ ManagedHsmKeyAttributes attributes = default;
+ JsonWebKeyType? kty = default;
+ IReadOnlyList keyOps = default;
+ int? keySize = default;
+ JsonWebKeyCurveName? curveName = default;
+ Uri keyUri = default;
+ string keyUriWithVersion = default;
+ ManagedHsmRotationPolicy rotationPolicy = default;
+ ManagedHsmKeyReleasePolicy releasePolicy = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("tags"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ Dictionary dictionary = new Dictionary();
+ foreach (var property0 in property.Value.EnumerateObject())
+ {
+ dictionary.Add(property0.Name, property0.Value.GetString());
+ }
+ tags = dictionary;
+ continue;
+ }
+ if (property.NameEquals("id"u8))
+ {
+ id = new ResourceIdentifier(property.Value.GetString());
+ continue;
+ }
+ if (property.NameEquals("name"u8))
+ {
+ name = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("type"u8))
+ {
+ type = new ResourceType(property.Value.GetString());
+ continue;
+ }
+ if (property.NameEquals("systemData"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ systemData = JsonSerializer.Deserialize(property.Value.GetRawText());
+ continue;
+ }
+ if (property.NameEquals("properties"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ property.ThrowNonNullablePropertyIsNull();
+ continue;
+ }
+ foreach (var property0 in property.Value.EnumerateObject())
+ {
+ if (property0.NameEquals("attributes"u8))
+ {
+ if (property0.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ attributes = ManagedHsmKeyAttributes.DeserializeManagedHsmKeyAttributes(property0.Value, options);
+ continue;
+ }
+ if (property0.NameEquals("kty"u8))
+ {
+ if (property0.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ kty = new JsonWebKeyType(property0.Value.GetString());
+ continue;
+ }
+ if (property0.NameEquals("keyOps"u8))
+ {
+ if (property0.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ List array = new List();
+ foreach (var item in property0.Value.EnumerateArray())
+ {
+ array.Add(new JsonWebKeyOperation(item.GetString()));
+ }
+ keyOps = array;
+ continue;
+ }
+ if (property0.NameEquals("keySize"u8))
+ {
+ if (property0.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ keySize = property0.Value.GetInt32();
+ continue;
+ }
+ if (property0.NameEquals("curveName"u8))
+ {
+ if (property0.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ curveName = new JsonWebKeyCurveName(property0.Value.GetString());
+ continue;
+ }
+ if (property0.NameEquals("keyUri"u8))
+ {
+ if (property0.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ keyUri = new Uri(property0.Value.GetString());
+ continue;
+ }
+ if (property0.NameEquals("keyUriWithVersion"u8))
+ {
+ keyUriWithVersion = property0.Value.GetString();
+ continue;
+ }
+ if (property0.NameEquals("rotationPolicy"u8))
+ {
+ if (property0.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ rotationPolicy = ManagedHsmRotationPolicy.DeserializeManagedHsmRotationPolicy(property0.Value, options);
+ continue;
+ }
+ if (property0.NameEquals("release_policy"u8))
+ {
+ if (property0.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ releasePolicy = ManagedHsmKeyReleasePolicy.DeserializeManagedHsmKeyReleasePolicy(property0.Value, options);
+ continue;
+ }
+ }
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new ManagedHsmKeyData(
+ id,
+ name,
+ type,
+ systemData,
+ attributes,
+ kty,
+ keyOps ?? new ChangeTrackingList(),
+ keySize,
+ curveName,
+ keyUri,
+ keyUriWithVersion,
+ rotationPolicy,
+ releasePolicy,
+ tags ?? new ChangeTrackingDictionary(),
+ serializedAdditionalRawData);
+ }
+
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" name: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(Name))
+ {
+ builder.Append(" name: ");
+ if (Name.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{Name}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{Name}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Tags), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" tags: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsCollectionDefined(Tags))
+ {
+ if (Tags.Any())
+ {
+ builder.Append(" tags: ");
+ builder.AppendLine("{");
+ foreach (var item in Tags)
+ {
+ builder.Append($" '{item.Key}': ");
+ if (item.Value == null)
+ {
+ builder.Append("null");
+ continue;
+ }
+ if (item.Value.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{item.Value}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{item.Value}'");
+ }
+ }
+ builder.AppendLine(" }");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" id: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(Id))
+ {
+ builder.Append(" id: ");
+ builder.AppendLine($"'{Id.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" systemData: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(SystemData))
+ {
+ builder.Append(" systemData: ");
+ builder.AppendLine($"'{SystemData.ToString()}'");
+ }
+ }
+
+ builder.Append(" properties:");
+ builder.AppendLine(" {");
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Attributes), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" attributes: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(Attributes))
+ {
+ builder.Append(" attributes: ");
+ BicepSerializationHelpers.AppendChildObject(builder, Attributes, options, 4, false, " attributes: ");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Kty), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" kty: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(Kty))
+ {
+ builder.Append(" kty: ");
+ builder.AppendLine($"'{Kty.Value.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(KeyOps), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" keyOps: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsCollectionDefined(KeyOps))
+ {
+ if (KeyOps.Any())
+ {
+ builder.Append(" keyOps: ");
+ builder.AppendLine("[");
+ foreach (var item in KeyOps)
+ {
+ builder.AppendLine($" '{item.ToString()}'");
+ }
+ builder.AppendLine(" ]");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(KeySize), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" keySize: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(KeySize))
+ {
+ builder.Append(" keySize: ");
+ builder.AppendLine($"{KeySize.Value}");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CurveName), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" curveName: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(CurveName))
+ {
+ builder.Append(" curveName: ");
+ builder.AppendLine($"'{CurveName.Value.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(KeyUri), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" keyUri: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(KeyUri))
+ {
+ builder.Append(" keyUri: ");
+ builder.AppendLine($"'{KeyUri.AbsoluteUri}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(KeyUriWithVersion), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" keyUriWithVersion: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(KeyUriWithVersion))
+ {
+ builder.Append(" keyUriWithVersion: ");
+ if (KeyUriWithVersion.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{KeyUriWithVersion}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{KeyUriWithVersion}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RotationPolicy), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" rotationPolicy: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(RotationPolicy))
+ {
+ builder.Append(" rotationPolicy: ");
+ BicepSerializationHelpers.AppendChildObject(builder, RotationPolicy, options, 4, false, " rotationPolicy: ");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ReleasePolicy), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" release_policy: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(ReleasePolicy))
+ {
+ builder.Append(" release_policy: ");
+ BicepSerializationHelpers.AppendChildObject(builder, ReleasePolicy, options, 4, false, " release_policy: ");
+ }
+ }
+
+ builder.AppendLine(" }");
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
+ default:
+ throw new FormatException($"The model {nameof(ManagedHsmKeyData)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ ManagedHsmKeyData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data);
+ return DeserializeManagedHsmKeyData(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(ManagedHsmKeyData)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmKeyData.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmKeyData.cs
new file mode 100644
index 0000000000000..5df91ed639f14
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmKeyData.cs
@@ -0,0 +1,123 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using Azure.Core;
+using Azure.ResourceManager.KeyVault.Models;
+using Azure.ResourceManager.Models;
+
+namespace Azure.ResourceManager.KeyVault
+{
+ ///
+ /// A class representing the ManagedHsmKey data model.
+ /// The key resource.
+ ///
+ public partial class ManagedHsmKeyData : ResourceData
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ internal ManagedHsmKeyData()
+ {
+ KeyOps = new ChangeTrackingList();
+ Tags = new ChangeTrackingDictionary();
+ }
+
+ /// Initializes a new instance of .
+ /// The id.
+ /// The name.
+ /// The resourceType.
+ /// The systemData.
+ /// The attributes of the key.
+ /// The type of the key. For valid values, see JsonWebKeyType.
+ ///
+ /// The key size in bits. For example: 2048, 3072, or 4096 for RSA.
+ /// The elliptic curve name. For valid values, see JsonWebKeyCurveName.
+ /// The URI to retrieve the current version of the key.
+ /// The URI to retrieve the specific version of the key.
+ /// Key rotation policy in response. It will be used for both output and input. Omitted if empty.
+ /// Key release policy in response. It will be used for both output and input. Omitted if empty.
+ /// Resource tags.
+ /// Keeps track of any properties unknown to the library.
+ internal ManagedHsmKeyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ManagedHsmKeyAttributes attributes, JsonWebKeyType? kty, IReadOnlyList keyOps, int? keySize, JsonWebKeyCurveName? curveName, Uri keyUri, string keyUriWithVersion, ManagedHsmRotationPolicy rotationPolicy, ManagedHsmKeyReleasePolicy releasePolicy, IReadOnlyDictionary tags, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData)
+ {
+ Attributes = attributes;
+ Kty = kty;
+ KeyOps = keyOps;
+ KeySize = keySize;
+ CurveName = curveName;
+ KeyUri = keyUri;
+ KeyUriWithVersion = keyUriWithVersion;
+ RotationPolicy = rotationPolicy;
+ ReleasePolicy = releasePolicy;
+ Tags = tags;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// The attributes of the key.
+ [WirePath("properties.attributes")]
+ public ManagedHsmKeyAttributes Attributes { get; }
+ /// The type of the key. For valid values, see JsonWebKeyType.
+ [WirePath("properties.kty")]
+ public JsonWebKeyType? Kty { get; }
+ /// Gets the key ops.
+ [WirePath("properties.keyOps")]
+ public IReadOnlyList KeyOps { get; }
+ /// The key size in bits. For example: 2048, 3072, or 4096 for RSA.
+ [WirePath("properties.keySize")]
+ public int? KeySize { get; }
+ /// The elliptic curve name. For valid values, see JsonWebKeyCurveName.
+ [WirePath("properties.curveName")]
+ public JsonWebKeyCurveName? CurveName { get; }
+ /// The URI to retrieve the current version of the key.
+ [WirePath("properties.keyUri")]
+ public Uri KeyUri { get; }
+ /// The URI to retrieve the specific version of the key.
+ [WirePath("properties.keyUriWithVersion")]
+ public string KeyUriWithVersion { get; }
+ /// Key rotation policy in response. It will be used for both output and input. Omitted if empty.
+ [WirePath("properties.rotationPolicy")]
+ public ManagedHsmRotationPolicy RotationPolicy { get; }
+ /// Key release policy in response. It will be used for both output and input. Omitted if empty.
+ [WirePath("properties.release_policy")]
+ public ManagedHsmKeyReleasePolicy ReleasePolicy { get; }
+ /// Resource tags.
+ [WirePath("tags")]
+ public IReadOnlyDictionary Tags { get; }
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionCollection.cs
index aac153dc143c1..7b08672fe9a0c 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionCollection.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionCollection.cs
@@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id)
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -115,7 +115,7 @@ public virtual async Task
///
-
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -166,7 +166,7 @@ public virtual ArmOperation CreateO
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -211,7 +211,7 @@ public virtual async Task>
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -256,7 +256,7 @@ public virtual Response Get(string
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -286,7 +286,7 @@ public virtual AsyncPageable GetAll
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -316,7 +316,7 @@ public virtual Pageable GetAll(Canc
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -359,7 +359,7 @@ public virtual async Task> ExistsAsync(string privateEndpointConn
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -402,7 +402,7 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -447,7 +447,7 @@ public virtual async Task
///
-
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionData.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionData.Serialization.cs
index 9b3d9931cb76e..fb0bd0836de87 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionData.Serialization.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionData.Serialization.cs
@@ -41,6 +41,12 @@ void IJsonModel.Write(Utf8JsonWriter wr
writer.WritePropertyName("sku"u8);
writer.WriteObjectValue(Sku, options);
}
+ if (Optional.IsDefined(Identity))
+ {
+ writer.WritePropertyName("identity"u8);
+ var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } };
+ JsonSerializer.Serialize(writer, Identity, serializeOptions);
+ }
if (Optional.IsCollectionDefined(Tags))
{
writer.WritePropertyName("tags"u8);
@@ -132,6 +138,7 @@ internal static ManagedHsmPrivateEndpointConnectionData DeserializeManagedHsmPri
}
ETag? etag = default;
ManagedHsmSku sku = default;
+ ManagedServiceIdentity identity = default;
IDictionary tags = default;
AzureLocation location = default;
ResourceIdentifier id = default;
@@ -163,6 +170,16 @@ internal static ManagedHsmPrivateEndpointConnectionData DeserializeManagedHsmPri
sku = ManagedHsmSku.DeserializeManagedHsmSku(property.Value, options);
continue;
}
+ if (property.NameEquals("identity"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } };
+ identity = JsonSerializer.Deserialize(property.Value.GetRawText(), serializeOptions);
+ continue;
+ }
if (property.NameEquals("tags"u8))
{
if (property.Value.ValueKind == JsonValueKind.Null)
@@ -263,6 +280,7 @@ internal static ManagedHsmPrivateEndpointConnectionData DeserializeManagedHsmPri
privateLinkServiceConnectionState,
provisioningState,
sku,
+ identity,
serializedAdditionalRawData);
}
@@ -379,6 +397,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
}
}
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Identity), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" identity: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(Identity))
+ {
+ builder.Append(" identity: ");
+ BicepSerializationHelpers.AppendChildObject(builder, Identity, options, 2, false, " identity: ");
+ }
+ }
+
hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride);
if (hasPropertyOverride)
{
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionData.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionData.cs
index 6c18975f19b59..1d0e205b73dc9 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionData.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionData.cs
@@ -70,14 +70,16 @@ public ManagedHsmPrivateEndpointConnectionData(AzureLocation location) : base(lo
/// Approval state of the private link connection.
/// Provisioning state of the private endpoint connection.
/// SKU details.
+ /// Managed service identity (system assigned and/or user assigned identities).
/// Keeps track of any properties unknown to the library.
- internal ManagedHsmPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, SubResource privateEndpoint, ManagedHsmPrivateLinkServiceConnectionState privateLinkServiceConnectionState, ManagedHsmPrivateEndpointConnectionProvisioningState? provisioningState, ManagedHsmSku sku, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location)
+ internal ManagedHsmPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, SubResource privateEndpoint, ManagedHsmPrivateLinkServiceConnectionState privateLinkServiceConnectionState, ManagedHsmPrivateEndpointConnectionProvisioningState? provisioningState, ManagedHsmSku sku, ManagedServiceIdentity identity, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location)
{
ETag = etag;
PrivateEndpoint = privateEndpoint;
PrivateLinkServiceConnectionState = privateLinkServiceConnectionState;
ProvisioningState = provisioningState;
Sku = sku;
+ Identity = identity;
_serializedAdditionalRawData = serializedAdditionalRawData;
}
@@ -107,5 +109,8 @@ public ResourceIdentifier PrivateEndpointId
/// SKU details.
[WirePath("sku")]
public ManagedHsmSku Sku { get; set; }
+ /// Managed service identity (system assigned and/or user assigned identities).
+ [WirePath("identity")]
+ public ManagedServiceIdentity Identity { get; set; }
}
}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionResource.cs
index 3cfbcc2e60b6d..33e51ea61b256 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionResource.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmPrivateEndpointConnectionResource.cs
@@ -102,7 +102,7 @@ internal static void ValidateResourceId(ResourceIdentifier id)
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -142,7 +142,7 @@ public virtual async Task>
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -182,7 +182,7 @@ public virtual Response Get(Cancell
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -224,7 +224,7 @@ public virtual async Task
///
-
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -266,7 +266,7 @@ public virtual ArmOperation Delete(
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -314,7 +314,7 @@ public virtual async Task
///
-
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -362,7 +362,7 @@ public virtual ArmOperation Update(
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -419,7 +419,7 @@ public virtual async Task>
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -476,7 +476,7 @@ public virtual Response AddTag(stri
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -532,7 +532,7 @@ public virtual async Task>
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -588,7 +588,7 @@ public virtual Response SetTags(IDi
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -643,7 +643,7 @@ public virtual async Task>
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmResource.cs
index 5efc606a706df..c9edaf601f30d 100644
--- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmResource.cs
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmResource.cs
@@ -99,6 +99,75 @@ internal static void ValidateResourceId(ResourceIdentifier id)
throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id));
}
+ /// Gets a collection of ManagedHSMKeyResources in the ManagedHsm.
+ /// An object representing collection of ManagedHSMKeyResources and their operations over a ManagedHSMKeyResource.
+ public virtual ManagedHSMKeyCollection GetManagedHSMKeys()
+ {
+ return GetCachedClient(client => new ManagedHSMKeyCollection(client, Id));
+ }
+
+ ///
+ /// Gets the current version of the specified key from the specified managed HSM.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}
+ ///
+ /// -
+ /// Operation Id
+ /// ManagedHsmKeys_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2023-07-01
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The name of the key to be created. The value you provide may be copied globally for the purpose of running the service. The value provided should not include personally identifiable or sensitive information.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ [ForwardsClientCalls]
+ public virtual async Task> GetManagedHSMKeyAsync(string keyName, CancellationToken cancellationToken = default)
+ {
+ return await GetManagedHSMKeys().GetAsync(keyName, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// Gets the current version of the specified key from the specified managed HSM.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}
+ ///
+ /// -
+ /// Operation Id
+ /// ManagedHsmKeys_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2023-07-01
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The name of the key to be created. The value you provide may be copied globally for the purpose of running the service. The value provided should not include personally identifiable or sensitive information.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ [ForwardsClientCalls]
+ public virtual Response GetManagedHSMKey(string keyName, CancellationToken cancellationToken = default)
+ {
+ return GetManagedHSMKeys().Get(keyName, cancellationToken);
+ }
+
/// Gets a collection of ManagedHsmPrivateEndpointConnectionResources in the ManagedHsm.
/// An object representing collection of ManagedHsmPrivateEndpointConnectionResources and their operations over a ManagedHsmPrivateEndpointConnectionResource.
public virtual ManagedHsmPrivateEndpointConnectionCollection GetManagedHsmPrivateEndpointConnections()
@@ -119,7 +188,7 @@ public virtual ManagedHsmPrivateEndpointConnectionCollection GetManagedHsmPrivat
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -150,7 +219,7 @@ public virtual async Task>
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -181,7 +250,7 @@ public virtual Response GetManagedH
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -221,7 +290,7 @@ public virtual async Task> GetAsync(CancellationTok
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -261,7 +330,7 @@ public virtual Response Get(CancellationToken cancellationTo
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -303,7 +372,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -345,7 +414,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -391,7 +460,7 @@ public virtual async Task> UpdateAsync(WaitUnti
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -437,7 +506,7 @@ public virtual ArmOperation Update(WaitUntil waitUntil, Mana
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
///
///
@@ -462,7 +531,7 @@ public virtual AsyncPageable GetMHSMPrivateLi
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
///
///
@@ -487,7 +556,7 @@ public virtual Pageable GetMHSMPrivateLinkRes
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
///
///
@@ -513,7 +582,7 @@ public virtual AsyncPageable GetMHSMRegionsByReso
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
///
///
@@ -539,7 +608,7 @@ public virtual Pageable GetMHSMRegionsByResource(
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -601,7 +670,7 @@ public virtual async Task> AddTagAsync(string key,
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -663,7 +732,7 @@ public virtual Response AddTag(string key, string value, Can
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -720,7 +789,7 @@ public virtual async Task> SetTagsAsync(IDictionary
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -777,7 +846,7 @@ public virtual Response SetTags(IDictionary
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
@@ -837,7 +906,7 @@ public virtual async Task> RemoveTagAsync(string ke
///
/// -
/// Default Api Version
- /// 2023-02-01
+ /// 2023-07-01
///
/// -
/// Resource
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/Action.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/Action.Serialization.cs
new file mode 100644
index 0000000000000..0830e8d9f6c21
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/Action.Serialization.cs
@@ -0,0 +1,159 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Text;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.ResourceManager.KeyVault.Models
+{
+ internal partial class Action : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(Action)} does not support writing '{format}' format.");
+ }
+
+ writer.WriteStartObject();
+ if (Optional.IsDefined(KeyRotationPolicyActionType))
+ {
+ writer.WritePropertyName("type"u8);
+ writer.WriteStringValue(KeyRotationPolicyActionType.Value.ToSerialString());
+ }
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ writer.WriteEndObject();
+ }
+
+ Action IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(Action)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeAction(document.RootElement, options);
+ }
+
+ internal static Action DeserializeAction(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ KeyRotationPolicyActionType? type = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("type"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ type = property.Value.GetString().ToKeyRotationPolicyActionType();
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new Action(type, serializedAdditionalRawData);
+ }
+
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(KeyRotationPolicyActionType), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" type: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(KeyRotationPolicyActionType))
+ {
+ builder.Append(" type: ");
+ builder.AppendLine($"'{KeyRotationPolicyActionType.Value.ToSerialString()}'");
+ }
+ }
+
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
+ default:
+ throw new FormatException($"The model {nameof(Action)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ Action IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data);
+ return DeserializeAction(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(Action)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/Action.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/Action.cs
new file mode 100644
index 0000000000000..033b56749c373
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/Action.cs
@@ -0,0 +1,66 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.ResourceManager.KeyVault.Models
+{
+ /// The Action.
+ internal partial class Action
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ public Action()
+ {
+ }
+
+ /// Initializes a new instance of .
+ /// The type of action.
+ /// Keeps track of any properties unknown to the library.
+ internal Action(KeyRotationPolicyActionType? keyRotationPolicyActionType, IDictionary serializedAdditionalRawData)
+ {
+ KeyRotationPolicyActionType = keyRotationPolicyActionType;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// The type of action.
+ [WirePath("type")]
+ public KeyRotationPolicyActionType? KeyRotationPolicyActionType { get; set; }
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/DeletionRecoveryLevel.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/DeletionRecoveryLevel.cs
new file mode 100644
index 0000000000000..b8633c7a1cba3
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/DeletionRecoveryLevel.cs
@@ -0,0 +1,57 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ComponentModel;
+
+namespace Azure.ResourceManager.KeyVault.Models
+{
+ /// The deletion recovery level currently in effect for the object. If it contains 'Purgeable', then the object can be permanently deleted by a privileged user; otherwise, only the system can purge the object at the end of the retention interval.
+ public readonly partial struct DeletionRecoveryLevel : IEquatable
+ {
+ private readonly string _value;
+
+ /// Initializes a new instance of .
+ /// is null.
+ public DeletionRecoveryLevel(string value)
+ {
+ _value = value ?? throw new ArgumentNullException(nameof(value));
+ }
+
+ private const string PurgeableValue = "Purgeable";
+ private const string RecoverablePurgeableValue = "Recoverable+Purgeable";
+ private const string RecoverableValue = "Recoverable";
+ private const string RecoverableProtectedSubscriptionValue = "Recoverable+ProtectedSubscription";
+
+ /// Purgeable.
+ public static DeletionRecoveryLevel Purgeable { get; } = new DeletionRecoveryLevel(PurgeableValue);
+ /// Recoverable+Purgeable.
+ public static DeletionRecoveryLevel RecoverablePurgeable { get; } = new DeletionRecoveryLevel(RecoverablePurgeableValue);
+ /// Recoverable.
+ public static DeletionRecoveryLevel Recoverable { get; } = new DeletionRecoveryLevel(RecoverableValue);
+ /// Recoverable+ProtectedSubscription.
+ public static DeletionRecoveryLevel RecoverableProtectedSubscription { get; } = new DeletionRecoveryLevel(RecoverableProtectedSubscriptionValue);
+ /// Determines if two values are the same.
+ public static bool operator ==(DeletionRecoveryLevel left, DeletionRecoveryLevel right) => left.Equals(right);
+ /// Determines if two values are not the same.
+ public static bool operator !=(DeletionRecoveryLevel left, DeletionRecoveryLevel right) => !left.Equals(right);
+ /// Converts a string to a .
+ public static implicit operator DeletionRecoveryLevel(string value) => new DeletionRecoveryLevel(value);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool Equals(object obj) => obj is DeletionRecoveryLevel other && Equals(other);
+ ///
+ public bool Equals(DeletionRecoveryLevel other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override int GetHashCode() => _value?.GetHashCode() ?? 0;
+ ///
+ public override string ToString() => _value;
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/JsonWebKeyCurveName.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/JsonWebKeyCurveName.cs
new file mode 100644
index 0000000000000..931c9aef9361f
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/JsonWebKeyCurveName.cs
@@ -0,0 +1,57 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ComponentModel;
+
+namespace Azure.ResourceManager.KeyVault.Models
+{
+ /// The elliptic curve name. For valid values, see JsonWebKeyCurveName.
+ public readonly partial struct JsonWebKeyCurveName : IEquatable
+ {
+ private readonly string _value;
+
+ /// Initializes a new instance of .
+ /// is null.
+ public JsonWebKeyCurveName(string value)
+ {
+ _value = value ?? throw new ArgumentNullException(nameof(value));
+ }
+
+ private const string P256Value = "P-256";
+ private const string P384Value = "P-384";
+ private const string P521Value = "P-521";
+ private const string P256KValue = "P-256K";
+
+ /// P-256.
+ public static JsonWebKeyCurveName P256 { get; } = new JsonWebKeyCurveName(P256Value);
+ /// P-384.
+ public static JsonWebKeyCurveName P384 { get; } = new JsonWebKeyCurveName(P384Value);
+ /// P-521.
+ public static JsonWebKeyCurveName P521 { get; } = new JsonWebKeyCurveName(P521Value);
+ /// P-256K.
+ public static JsonWebKeyCurveName P256K { get; } = new JsonWebKeyCurveName(P256KValue);
+ /// Determines if two values are the same.
+ public static bool operator ==(JsonWebKeyCurveName left, JsonWebKeyCurveName right) => left.Equals(right);
+ /// Determines if two values are not the same.
+ public static bool operator !=(JsonWebKeyCurveName left, JsonWebKeyCurveName right) => !left.Equals(right);
+ /// Converts a string to a .
+ public static implicit operator JsonWebKeyCurveName(string value) => new JsonWebKeyCurveName(value);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool Equals(object obj) => obj is JsonWebKeyCurveName other && Equals(other);
+ ///
+ public bool Equals(JsonWebKeyCurveName other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override int GetHashCode() => _value?.GetHashCode() ?? 0;
+ ///
+ public override string ToString() => _value;
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/JsonWebKeyOperation.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/JsonWebKeyOperation.cs
new file mode 100644
index 0000000000000..6ad565cdcc8fe
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/JsonWebKeyOperation.cs
@@ -0,0 +1,69 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ComponentModel;
+
+namespace Azure.ResourceManager.KeyVault.Models
+{
+ /// The permitted JSON web key operations of the key. For more information, see JsonWebKeyOperation.
+ public readonly partial struct JsonWebKeyOperation : IEquatable
+ {
+ private readonly string _value;
+
+ /// Initializes a new instance of .
+ /// is null.
+ public JsonWebKeyOperation(string value)
+ {
+ _value = value ?? throw new ArgumentNullException(nameof(value));
+ }
+
+ private const string EncryptValue = "encrypt";
+ private const string DecryptValue = "decrypt";
+ private const string SignValue = "sign";
+ private const string VerifyValue = "verify";
+ private const string WrapKeyValue = "wrapKey";
+ private const string UnwrapKeyValue = "unwrapKey";
+ private const string ImportValue = "import";
+ private const string ReleaseValue = "release";
+
+ /// encrypt.
+ public static JsonWebKeyOperation Encrypt { get; } = new JsonWebKeyOperation(EncryptValue);
+ /// decrypt.
+ public static JsonWebKeyOperation Decrypt { get; } = new JsonWebKeyOperation(DecryptValue);
+ /// sign.
+ public static JsonWebKeyOperation Sign { get; } = new JsonWebKeyOperation(SignValue);
+ /// verify.
+ public static JsonWebKeyOperation Verify { get; } = new JsonWebKeyOperation(VerifyValue);
+ /// wrapKey.
+ public static JsonWebKeyOperation WrapKey { get; } = new JsonWebKeyOperation(WrapKeyValue);
+ /// unwrapKey.
+ public static JsonWebKeyOperation UnwrapKey { get; } = new JsonWebKeyOperation(UnwrapKeyValue);
+ /// import.
+ public static JsonWebKeyOperation Import { get; } = new JsonWebKeyOperation(ImportValue);
+ /// release.
+ public static JsonWebKeyOperation Release { get; } = new JsonWebKeyOperation(ReleaseValue);
+ /// Determines if two values are the same.
+ public static bool operator ==(JsonWebKeyOperation left, JsonWebKeyOperation right) => left.Equals(right);
+ /// Determines if two values are not the same.
+ public static bool operator !=(JsonWebKeyOperation left, JsonWebKeyOperation right) => !left.Equals(right);
+ /// Converts a string to a .
+ public static implicit operator JsonWebKeyOperation(string value) => new JsonWebKeyOperation(value);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool Equals(object obj) => obj is JsonWebKeyOperation other && Equals(other);
+ ///
+ public bool Equals(JsonWebKeyOperation other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override int GetHashCode() => _value?.GetHashCode() ?? 0;
+ ///
+ public override string ToString() => _value;
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/JsonWebKeyType.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/JsonWebKeyType.cs
new file mode 100644
index 0000000000000..4a24c59b92ced
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/JsonWebKeyType.cs
@@ -0,0 +1,57 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ComponentModel;
+
+namespace Azure.ResourceManager.KeyVault.Models
+{
+ /// The type of the key. For valid values, see JsonWebKeyType.
+ public readonly partial struct JsonWebKeyType : IEquatable
+ {
+ private readonly string _value;
+
+ /// Initializes a new instance of .
+ /// is null.
+ public JsonWebKeyType(string value)
+ {
+ _value = value ?? throw new ArgumentNullException(nameof(value));
+ }
+
+ private const string ECValue = "EC";
+ private const string ECHSMValue = "EC-HSM";
+ private const string RSAValue = "RSA";
+ private const string RSAHSMValue = "RSA-HSM";
+
+ /// EC.
+ public static JsonWebKeyType EC { get; } = new JsonWebKeyType(ECValue);
+ /// EC-HSM.
+ public static JsonWebKeyType ECHSM { get; } = new JsonWebKeyType(ECHSMValue);
+ /// RSA.
+ public static JsonWebKeyType RSA { get; } = new JsonWebKeyType(RSAValue);
+ /// RSA-HSM.
+ public static JsonWebKeyType RSAHSM { get; } = new JsonWebKeyType(RSAHSMValue);
+ /// Determines if two values are the same.
+ public static bool operator ==(JsonWebKeyType left, JsonWebKeyType right) => left.Equals(right);
+ /// Determines if two values are not the same.
+ public static bool operator !=(JsonWebKeyType left, JsonWebKeyType right) => !left.Equals(right);
+ /// Converts a string to a .
+ public static implicit operator JsonWebKeyType(string value) => new JsonWebKeyType(value);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool Equals(object obj) => obj is JsonWebKeyType other && Equals(other);
+ ///
+ public bool Equals(JsonWebKeyType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override int GetHashCode() => _value?.GetHashCode() ?? 0;
+ ///
+ public override string ToString() => _value;
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyAttributes.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyAttributes.Serialization.cs
new file mode 100644
index 0000000000000..a264a8812e927
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyAttributes.Serialization.cs
@@ -0,0 +1,349 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Text;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.ResourceManager.KeyVault.Models
+{
+ public partial class KeyAttributes : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(KeyAttributes)} does not support writing '{format}' format.");
+ }
+
+ writer.WriteStartObject();
+ if (Optional.IsDefined(Enabled))
+ {
+ writer.WritePropertyName("enabled"u8);
+ writer.WriteBooleanValue(Enabled.Value);
+ }
+ if (Optional.IsDefined(NotBefore))
+ {
+ writer.WritePropertyName("nbf"u8);
+ writer.WriteNumberValue(NotBefore.Value);
+ }
+ if (Optional.IsDefined(Expires))
+ {
+ writer.WritePropertyName("exp"u8);
+ writer.WriteNumberValue(Expires.Value);
+ }
+ if (options.Format != "W" && Optional.IsDefined(Created))
+ {
+ writer.WritePropertyName("created"u8);
+ writer.WriteNumberValue(Created.Value);
+ }
+ if (options.Format != "W" && Optional.IsDefined(Updated))
+ {
+ writer.WritePropertyName("updated"u8);
+ writer.WriteNumberValue(Updated.Value);
+ }
+ if (options.Format != "W" && Optional.IsDefined(RecoveryLevel))
+ {
+ writer.WritePropertyName("recoveryLevel"u8);
+ writer.WriteStringValue(RecoveryLevel.Value.ToString());
+ }
+ if (Optional.IsDefined(Exportable))
+ {
+ writer.WritePropertyName("exportable"u8);
+ writer.WriteBooleanValue(Exportable.Value);
+ }
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ writer.WriteEndObject();
+ }
+
+ KeyAttributes IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(KeyAttributes)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeKeyAttributes(document.RootElement, options);
+ }
+
+ internal static KeyAttributes DeserializeKeyAttributes(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ bool? enabled = default;
+ long? nbf = default;
+ long? exp = default;
+ long? created = default;
+ long? updated = default;
+ DeletionRecoveryLevel? recoveryLevel = default;
+ bool? exportable = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("enabled"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ enabled = property.Value.GetBoolean();
+ continue;
+ }
+ if (property.NameEquals("nbf"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ nbf = property.Value.GetInt64();
+ continue;
+ }
+ if (property.NameEquals("exp"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ exp = property.Value.GetInt64();
+ continue;
+ }
+ if (property.NameEquals("created"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ created = property.Value.GetInt64();
+ continue;
+ }
+ if (property.NameEquals("updated"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ updated = property.Value.GetInt64();
+ continue;
+ }
+ if (property.NameEquals("recoveryLevel"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ recoveryLevel = new DeletionRecoveryLevel(property.Value.GetString());
+ continue;
+ }
+ if (property.NameEquals("exportable"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ exportable = property.Value.GetBoolean();
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new KeyAttributes(
+ enabled,
+ nbf,
+ exp,
+ created,
+ updated,
+ recoveryLevel,
+ exportable,
+ serializedAdditionalRawData);
+ }
+
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Enabled), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" enabled: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(Enabled))
+ {
+ builder.Append(" enabled: ");
+ var boolValue = Enabled.Value == true ? "true" : "false";
+ builder.AppendLine($"{boolValue}");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NotBefore), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" nbf: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(NotBefore))
+ {
+ builder.Append(" nbf: ");
+ builder.AppendLine($"'{NotBefore.Value.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Expires), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" exp: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(Expires))
+ {
+ builder.Append(" exp: ");
+ builder.AppendLine($"'{Expires.Value.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Created), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" created: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(Created))
+ {
+ builder.Append(" created: ");
+ builder.AppendLine($"'{Created.Value.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Updated), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" updated: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(Updated))
+ {
+ builder.Append(" updated: ");
+ builder.AppendLine($"'{Updated.Value.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RecoveryLevel), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" recoveryLevel: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(RecoveryLevel))
+ {
+ builder.Append(" recoveryLevel: ");
+ builder.AppendLine($"'{RecoveryLevel.Value.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Exportable), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" exportable: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(Exportable))
+ {
+ builder.Append(" exportable: ");
+ var boolValue = Exportable.Value == true ? "true" : "false";
+ builder.AppendLine($"{boolValue}");
+ }
+ }
+
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
+ default:
+ throw new FormatException($"The model {nameof(KeyAttributes)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ KeyAttributes IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data);
+ return DeserializeKeyAttributes(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(KeyAttributes)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyAttributes.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyAttributes.cs
new file mode 100644
index 0000000000000..c70bfbafd90f4
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyAttributes.cs
@@ -0,0 +1,96 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.ResourceManager.KeyVault.Models
+{
+ /// The object attributes managed by the Azure Key Vault service.
+ public partial class KeyAttributes
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ public KeyAttributes()
+ {
+ }
+
+ /// Initializes a new instance of .
+ /// Determines whether or not the object is enabled.
+ /// Not before date in seconds since 1970-01-01T00:00:00Z.
+ /// Expiry date in seconds since 1970-01-01T00:00:00Z.
+ /// Creation time in seconds since 1970-01-01T00:00:00Z.
+ /// Last updated time in seconds since 1970-01-01T00:00:00Z.
+ /// The deletion recovery level currently in effect for the object. If it contains 'Purgeable', then the object can be permanently deleted by a privileged user; otherwise, only the system can purge the object at the end of the retention interval.
+ /// Indicates if the private key can be exported.
+ /// Keeps track of any properties unknown to the library.
+ internal KeyAttributes(bool? enabled, long? notBefore, long? expires, long? created, long? updated, DeletionRecoveryLevel? recoveryLevel, bool? exportable, IDictionary serializedAdditionalRawData)
+ {
+ Enabled = enabled;
+ NotBefore = notBefore;
+ Expires = expires;
+ Created = created;
+ Updated = updated;
+ RecoveryLevel = recoveryLevel;
+ Exportable = exportable;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Determines whether or not the object is enabled.
+ [WirePath("enabled")]
+ public bool? Enabled { get; set; }
+ /// Not before date in seconds since 1970-01-01T00:00:00Z.
+ [WirePath("nbf")]
+ public long? NotBefore { get; set; }
+ /// Expiry date in seconds since 1970-01-01T00:00:00Z.
+ [WirePath("exp")]
+ public long? Expires { get; set; }
+ /// Creation time in seconds since 1970-01-01T00:00:00Z.
+ [WirePath("created")]
+ public long? Created { get; }
+ /// Last updated time in seconds since 1970-01-01T00:00:00Z.
+ [WirePath("updated")]
+ public long? Updated { get; }
+ /// The deletion recovery level currently in effect for the object. If it contains 'Purgeable', then the object can be permanently deleted by a privileged user; otherwise, only the system can purge the object at the end of the retention interval.
+ [WirePath("recoveryLevel")]
+ public DeletionRecoveryLevel? RecoveryLevel { get; }
+ /// Indicates if the private key can be exported.
+ [WirePath("exportable")]
+ public bool? Exportable { get; set; }
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyListResult.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyListResult.Serialization.cs
new file mode 100644
index 0000000000000..18e6aa8e4ef40
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyListResult.Serialization.cs
@@ -0,0 +1,212 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.ResourceManager.KeyVault.Models
+{
+ internal partial class KeyListResult : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(KeyListResult)} does not support writing '{format}' format.");
+ }
+
+ writer.WriteStartObject();
+ if (Optional.IsCollectionDefined(Value))
+ {
+ writer.WritePropertyName("value"u8);
+ writer.WriteStartArray();
+ foreach (var item in Value)
+ {
+ writer.WriteObjectValue(item, options);
+ }
+ writer.WriteEndArray();
+ }
+ if (Optional.IsDefined(NextLink))
+ {
+ writer.WritePropertyName("nextLink"u8);
+ writer.WriteStringValue(NextLink);
+ }
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ writer.WriteEndObject();
+ }
+
+ KeyListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(KeyListResult)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeKeyListResult(document.RootElement, options);
+ }
+
+ internal static KeyListResult DeserializeKeyListResult(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ IReadOnlyList value = default;
+ string nextLink = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("value"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ List array = new List();
+ foreach (var item in property.Value.EnumerateArray())
+ {
+ array.Add(KeyData.DeserializeKeyData(item, options));
+ }
+ value = array;
+ continue;
+ }
+ if (property.NameEquals("nextLink"u8))
+ {
+ nextLink = property.Value.GetString();
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new KeyListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData);
+ }
+
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" value: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsCollectionDefined(Value))
+ {
+ if (Value.Any())
+ {
+ builder.Append(" value: ");
+ builder.AppendLine("[");
+ foreach (var item in Value)
+ {
+ BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: ");
+ }
+ builder.AppendLine(" ]");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" nextLink: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(NextLink))
+ {
+ builder.Append(" nextLink: ");
+ if (NextLink.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{NextLink}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{NextLink}'");
+ }
+ }
+ }
+
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
+ default:
+ throw new FormatException($"The model {nameof(KeyListResult)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ KeyListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data);
+ return DeserializeKeyListResult(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(KeyListResult)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyListResult.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyListResult.cs
new file mode 100644
index 0000000000000..c882d391234ef
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyListResult.cs
@@ -0,0 +1,70 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.ResourceManager.KeyVault.Models
+{
+ /// The page of keys.
+ internal partial class KeyListResult
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ internal KeyListResult()
+ {
+ Value = new ChangeTrackingList();
+ }
+
+ /// Initializes a new instance of .
+ /// The key resources.
+ /// The URL to get the next page of keys.
+ /// Keeps track of any properties unknown to the library.
+ internal KeyListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData)
+ {
+ Value = value;
+ NextLink = nextLink;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// The key resources.
+ public IReadOnlyList Value { get; }
+ /// The URL to get the next page of keys.
+ public string NextLink { get; }
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyProperties.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyProperties.Serialization.cs
new file mode 100644
index 0000000000000..3760ff44ea8d4
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyProperties.Serialization.cs
@@ -0,0 +1,262 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.ResourceManager.KeyVault.Models
+{
+ public partial class KeyProperties : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(KeyProperties)} does not support writing '{format}' format.");
+ }
+
+ writer.WriteStartObject();
+ if (Optional.IsDefined(Attributes))
+ {
+ writer.WritePropertyName("attributes"u8);
+ writer.WriteObjectValue(Attributes, options);
+ }
+ if (Optional.IsDefined(Kty))
+ {
+ writer.WritePropertyName("kty"u8);
+ writer.WriteStringValue(Kty.Value.ToString());
+ }
+ if (Optional.IsCollectionDefined(KeyOps))
+ {
+ writer.WritePropertyName("keyOps"u8);
+ writer.WriteStartArray();
+ foreach (var item in KeyOps)
+ {
+ writer.WriteStringValue(item.ToString());
+ }
+ writer.WriteEndArray();
+ }
+ if (Optional.IsDefined(KeySize))
+ {
+ writer.WritePropertyName("keySize"u8);
+ writer.WriteNumberValue(KeySize.Value);
+ }
+ if (Optional.IsDefined(CurveName))
+ {
+ writer.WritePropertyName("curveName"u8);
+ writer.WriteStringValue(CurveName.Value.ToString());
+ }
+ if (options.Format != "W" && Optional.IsDefined(KeyUri))
+ {
+ writer.WritePropertyName("keyUri"u8);
+ writer.WriteStringValue(KeyUri.AbsoluteUri);
+ }
+ if (options.Format != "W" && Optional.IsDefined(KeyUriWithVersion))
+ {
+ writer.WritePropertyName("keyUriWithVersion"u8);
+ writer.WriteStringValue(KeyUriWithVersion);
+ }
+ if (Optional.IsDefined(RotationPolicy))
+ {
+ writer.WritePropertyName("rotationPolicy"u8);
+ writer.WriteObjectValue(RotationPolicy, options);
+ }
+ if (Optional.IsDefined(ReleasePolicy))
+ {
+ writer.WritePropertyName("release_policy"u8);
+ writer.WriteObjectValue(ReleasePolicy, options);
+ }
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ writer.WriteEndObject();
+ }
+
+ KeyProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(KeyProperties)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeKeyProperties(document.RootElement, options);
+ }
+
+ internal static KeyProperties DeserializeKeyProperties(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ KeyAttributes attributes = default;
+ JsonWebKeyType? kty = default;
+ IList keyOps = default;
+ int? keySize = default;
+ JsonWebKeyCurveName? curveName = default;
+ Uri keyUri = default;
+ string keyUriWithVersion = default;
+ RotationPolicy rotationPolicy = default;
+ KeyReleasePolicy releasePolicy = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("attributes"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ attributes = KeyAttributes.DeserializeKeyAttributes(property.Value, options);
+ continue;
+ }
+ if (property.NameEquals("kty"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ kty = new JsonWebKeyType(property.Value.GetString());
+ continue;
+ }
+ if (property.NameEquals("keyOps"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ List array = new List();
+ foreach (var item in property.Value.EnumerateArray())
+ {
+ array.Add(new JsonWebKeyOperation(item.GetString()));
+ }
+ keyOps = array;
+ continue;
+ }
+ if (property.NameEquals("keySize"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ keySize = property.Value.GetInt32();
+ continue;
+ }
+ if (property.NameEquals("curveName"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ curveName = new JsonWebKeyCurveName(property.Value.GetString());
+ continue;
+ }
+ if (property.NameEquals("keyUri"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ keyUri = new Uri(property.Value.GetString());
+ continue;
+ }
+ if (property.NameEquals("keyUriWithVersion"u8))
+ {
+ keyUriWithVersion = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("rotationPolicy"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ rotationPolicy = RotationPolicy.DeserializeRotationPolicy(property.Value, options);
+ continue;
+ }
+ if (property.NameEquals("release_policy"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ releasePolicy = KeyReleasePolicy.DeserializeKeyReleasePolicy(property.Value, options);
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new KeyProperties(
+ attributes,
+ kty,
+ keyOps ?? new ChangeTrackingList(),
+ keySize,
+ curveName,
+ keyUri,
+ keyUriWithVersion,
+ rotationPolicy,
+ releasePolicy,
+ serializedAdditionalRawData);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(KeyProperties)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ KeyProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data);
+ return DeserializeKeyProperties(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(KeyProperties)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyProperties.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyProperties.cs
new file mode 100644
index 0000000000000..13e0080367eea
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyProperties.cs
@@ -0,0 +1,107 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.ResourceManager.KeyVault.Models
+{
+ /// The properties of the key.
+ public partial class KeyProperties
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ public KeyProperties()
+ {
+ KeyOps = new ChangeTrackingList();
+ }
+
+ /// Initializes a new instance of .
+ /// The attributes of the key.
+ /// The type of the key. For valid values, see JsonWebKeyType.
+ ///
+ /// The key size in bits. For example: 2048, 3072, or 4096 for RSA.
+ /// The elliptic curve name. For valid values, see JsonWebKeyCurveName.
+ /// The URI to retrieve the current version of the key.
+ /// The URI to retrieve the specific version of the key.
+ /// Key rotation policy in response. It will be used for both output and input. Omitted if empty.
+ /// Key release policy in response. It will be used for both output and input. Omitted if empty.
+ /// Keeps track of any properties unknown to the library.
+ internal KeyProperties(KeyAttributes attributes, JsonWebKeyType? kty, IList keyOps, int? keySize, JsonWebKeyCurveName? curveName, Uri keyUri, string keyUriWithVersion, RotationPolicy rotationPolicy, KeyReleasePolicy releasePolicy, IDictionary serializedAdditionalRawData)
+ {
+ Attributes = attributes;
+ Kty = kty;
+ KeyOps = keyOps;
+ KeySize = keySize;
+ CurveName = curveName;
+ KeyUri = keyUri;
+ KeyUriWithVersion = keyUriWithVersion;
+ RotationPolicy = rotationPolicy;
+ ReleasePolicy = releasePolicy;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// The attributes of the key.
+ [WirePath("attributes")]
+ public KeyAttributes Attributes { get; set; }
+ /// The type of the key. For valid values, see JsonWebKeyType.
+ [WirePath("kty")]
+ public JsonWebKeyType? Kty { get; set; }
+ /// Gets the key ops.
+ [WirePath("keyOps")]
+ public IList KeyOps { get; }
+ /// The key size in bits. For example: 2048, 3072, or 4096 for RSA.
+ [WirePath("keySize")]
+ public int? KeySize { get; set; }
+ /// The elliptic curve name. For valid values, see JsonWebKeyCurveName.
+ [WirePath("curveName")]
+ public JsonWebKeyCurveName? CurveName { get; set; }
+ /// The URI to retrieve the current version of the key.
+ [WirePath("keyUri")]
+ public Uri KeyUri { get; }
+ /// The URI to retrieve the specific version of the key.
+ [WirePath("keyUriWithVersion")]
+ public string KeyUriWithVersion { get; }
+ /// Key rotation policy in response. It will be used for both output and input. Omitted if empty.
+ [WirePath("rotationPolicy")]
+ public RotationPolicy RotationPolicy { get; set; }
+ /// Key release policy in response. It will be used for both output and input. Omitted if empty.
+ [WirePath("release_policy")]
+ public KeyReleasePolicy ReleasePolicy { get; set; }
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyReleasePolicy.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyReleasePolicy.Serialization.cs
new file mode 100644
index 0000000000000..818bc23c7934e
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyReleasePolicy.Serialization.cs
@@ -0,0 +1,193 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Text;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.ResourceManager.KeyVault.Models
+{
+ public partial class KeyReleasePolicy : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(KeyReleasePolicy)} does not support writing '{format}' format.");
+ }
+
+ writer.WriteStartObject();
+ if (Optional.IsDefined(ContentType))
+ {
+ writer.WritePropertyName("contentType"u8);
+ writer.WriteStringValue(ContentType);
+ }
+ if (Optional.IsDefined(Data))
+ {
+ writer.WritePropertyName("data"u8);
+ writer.WriteBase64StringValue(Data, "U");
+ }
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ writer.WriteEndObject();
+ }
+
+ KeyReleasePolicy IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(KeyReleasePolicy)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeKeyReleasePolicy(document.RootElement, options);
+ }
+
+ internal static KeyReleasePolicy DeserializeKeyReleasePolicy(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string contentType = default;
+ byte[] data = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("contentType"u8))
+ {
+ contentType = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("data"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ data = property.Value.GetBytesFromBase64("U");
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new KeyReleasePolicy(contentType, data, serializedAdditionalRawData);
+ }
+
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ContentType), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" contentType: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(ContentType))
+ {
+ builder.Append(" contentType: ");
+ if (ContentType.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{ContentType}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{ContentType}'");
+ }
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Data), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" data: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(Data))
+ {
+ builder.Append(" data: ");
+ builder.AppendLine($"'{Data.ToString()}'");
+ }
+ }
+
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
+ default:
+ throw new FormatException($"The model {nameof(KeyReleasePolicy)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ KeyReleasePolicy IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data);
+ return DeserializeKeyReleasePolicy(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(KeyReleasePolicy)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyReleasePolicy.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyReleasePolicy.cs
new file mode 100644
index 0000000000000..1074b9653e7c2
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyReleasePolicy.cs
@@ -0,0 +1,71 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.ResourceManager.KeyVault.Models
+{
+ /// The KeyReleasePolicy.
+ public partial class KeyReleasePolicy
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ public KeyReleasePolicy()
+ {
+ }
+
+ /// Initializes a new instance of .
+ /// Content type and version of key release policy.
+ /// Blob encoding the policy rules under which the key can be released.
+ /// Keeps track of any properties unknown to the library.
+ internal KeyReleasePolicy(string contentType, byte[] data, IDictionary serializedAdditionalRawData)
+ {
+ ContentType = contentType;
+ Data = data;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Content type and version of key release policy.
+ [WirePath("contentType")]
+ public string ContentType { get; set; }
+ /// Blob encoding the policy rules under which the key can be released.
+ [WirePath("data")]
+ public byte[] Data { get; set; }
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyRotationPolicyActionType.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyRotationPolicyActionType.Serialization.cs
new file mode 100644
index 0000000000000..2f6a46a5dea2e
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyRotationPolicyActionType.Serialization.cs
@@ -0,0 +1,28 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+
+namespace Azure.ResourceManager.KeyVault.Models
+{
+ internal static partial class KeyRotationPolicyActionTypeExtensions
+ {
+ public static string ToSerialString(this KeyRotationPolicyActionType value) => value switch
+ {
+ KeyRotationPolicyActionType.Rotate => "rotate",
+ KeyRotationPolicyActionType.Notify => "notify",
+ _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown KeyRotationPolicyActionType value.")
+ };
+
+ public static KeyRotationPolicyActionType ToKeyRotationPolicyActionType(this string value)
+ {
+ if (StringComparer.OrdinalIgnoreCase.Equals(value, "rotate")) return KeyRotationPolicyActionType.Rotate;
+ if (StringComparer.OrdinalIgnoreCase.Equals(value, "notify")) return KeyRotationPolicyActionType.Notify;
+ throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown KeyRotationPolicyActionType value.");
+ }
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyRotationPolicyActionType.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyRotationPolicyActionType.cs
new file mode 100644
index 0000000000000..1b13ec69f697d
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyRotationPolicyActionType.cs
@@ -0,0 +1,18 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+namespace Azure.ResourceManager.KeyVault.Models
+{
+ /// The type of action.
+ public enum KeyRotationPolicyActionType
+ {
+ /// rotate.
+ Rotate,
+ /// notify.
+ Notify
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyRotationPolicyAttributes.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyRotationPolicyAttributes.Serialization.cs
new file mode 100644
index 0000000000000..28d61fa1720fa
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyRotationPolicyAttributes.Serialization.cs
@@ -0,0 +1,223 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Text;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.ResourceManager.KeyVault.Models
+{
+ public partial class KeyRotationPolicyAttributes : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(KeyRotationPolicyAttributes)} does not support writing '{format}' format.");
+ }
+
+ writer.WriteStartObject();
+ if (options.Format != "W" && Optional.IsDefined(Created))
+ {
+ writer.WritePropertyName("created"u8);
+ writer.WriteNumberValue(Created.Value);
+ }
+ if (options.Format != "W" && Optional.IsDefined(Updated))
+ {
+ writer.WritePropertyName("updated"u8);
+ writer.WriteNumberValue(Updated.Value);
+ }
+ if (Optional.IsDefined(ExpiryTime))
+ {
+ writer.WritePropertyName("expiryTime"u8);
+ writer.WriteStringValue(ExpiryTime);
+ }
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ writer.WriteEndObject();
+ }
+
+ KeyRotationPolicyAttributes IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(KeyRotationPolicyAttributes)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeKeyRotationPolicyAttributes(document.RootElement, options);
+ }
+
+ internal static KeyRotationPolicyAttributes DeserializeKeyRotationPolicyAttributes(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ long? created = default;
+ long? updated = default;
+ string expiryTime = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("created"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ created = property.Value.GetInt64();
+ continue;
+ }
+ if (property.NameEquals("updated"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ updated = property.Value.GetInt64();
+ continue;
+ }
+ if (property.NameEquals("expiryTime"u8))
+ {
+ expiryTime = property.Value.GetString();
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new KeyRotationPolicyAttributes(created, updated, expiryTime, serializedAdditionalRawData);
+ }
+
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Created), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" created: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(Created))
+ {
+ builder.Append(" created: ");
+ builder.AppendLine($"'{Created.Value.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Updated), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" updated: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(Updated))
+ {
+ builder.Append(" updated: ");
+ builder.AppendLine($"'{Updated.Value.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ExpiryTime), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" expiryTime: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(ExpiryTime))
+ {
+ builder.Append(" expiryTime: ");
+ if (ExpiryTime.Contains(Environment.NewLine))
+ {
+ builder.AppendLine("'''");
+ builder.AppendLine($"{ExpiryTime}'''");
+ }
+ else
+ {
+ builder.AppendLine($"'{ExpiryTime}'");
+ }
+ }
+ }
+
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
+ default:
+ throw new FormatException($"The model {nameof(KeyRotationPolicyAttributes)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ KeyRotationPolicyAttributes IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data);
+ return DeserializeKeyRotationPolicyAttributes(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(KeyRotationPolicyAttributes)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyRotationPolicyAttributes.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyRotationPolicyAttributes.cs
new file mode 100644
index 0000000000000..106a305064a2b
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyRotationPolicyAttributes.cs
@@ -0,0 +1,76 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.ResourceManager.KeyVault.Models
+{
+ /// The KeyRotationPolicyAttributes.
+ public partial class KeyRotationPolicyAttributes
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ public KeyRotationPolicyAttributes()
+ {
+ }
+
+ /// Initializes a new instance of .
+ /// Creation time in seconds since 1970-01-01T00:00:00Z.
+ /// Last updated time in seconds since 1970-01-01T00:00:00Z.
+ /// The expiration time for the new key version. It should be in ISO8601 format. Eg: 'P90D', 'P1Y'.
+ /// Keeps track of any properties unknown to the library.
+ internal KeyRotationPolicyAttributes(long? created, long? updated, string expiryTime, IDictionary serializedAdditionalRawData)
+ {
+ Created = created;
+ Updated = updated;
+ ExpiryTime = expiryTime;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Creation time in seconds since 1970-01-01T00:00:00Z.
+ [WirePath("created")]
+ public long? Created { get; }
+ /// Last updated time in seconds since 1970-01-01T00:00:00Z.
+ [WirePath("updated")]
+ public long? Updated { get; }
+ /// The expiration time for the new key version. It should be in ISO8601 format. Eg: 'P90D', 'P1Y'.
+ [WirePath("expiryTime")]
+ public string ExpiryTime { get; set; }
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/LifetimeAction.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/LifetimeAction.Serialization.cs
new file mode 100644
index 0000000000000..0f2649c6d9567
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/LifetimeAction.Serialization.cs
@@ -0,0 +1,192 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Text;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.ResourceManager.KeyVault.Models
+{
+ public partial class LifetimeAction : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(LifetimeAction)} does not support writing '{format}' format.");
+ }
+
+ writer.WriteStartObject();
+ if (Optional.IsDefined(Trigger))
+ {
+ writer.WritePropertyName("trigger"u8);
+ writer.WriteObjectValue(Trigger, options);
+ }
+ if (Optional.IsDefined(Action))
+ {
+ writer.WritePropertyName("action"u8);
+ writer.WriteObjectValue(Action, options);
+ }
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ writer.WriteEndObject();
+ }
+
+ LifetimeAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(LifetimeAction)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeLifetimeAction(document.RootElement, options);
+ }
+
+ internal static LifetimeAction DeserializeLifetimeAction(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ Trigger trigger = default;
+ Action action = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("trigger"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ trigger = Trigger.DeserializeTrigger(property.Value, options);
+ continue;
+ }
+ if (property.NameEquals("action"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ action = Action.DeserializeAction(property.Value, options);
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new LifetimeAction(trigger, action, serializedAdditionalRawData);
+ }
+
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Trigger), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" trigger: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(Trigger))
+ {
+ builder.Append(" trigger: ");
+ BicepSerializationHelpers.AppendChildObject(builder, Trigger, options, 2, false, " trigger: ");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("KeyRotationPolicyActionType", out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" action: ");
+ builder.AppendLine("{");
+ builder.Append(" type: ");
+ builder.AppendLine(propertyOverride);
+ builder.AppendLine(" }");
+ }
+ else
+ {
+ if (Optional.IsDefined(Action))
+ {
+ builder.Append(" action: ");
+ BicepSerializationHelpers.AppendChildObject(builder, Action, options, 2, false, " action: ");
+ }
+ }
+
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
+ default:
+ throw new FormatException($"The model {nameof(LifetimeAction)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ LifetimeAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data);
+ return DeserializeLifetimeAction(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(LifetimeAction)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/LifetimeAction.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/LifetimeAction.cs
new file mode 100644
index 0000000000000..27350f296acd7
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/LifetimeAction.cs
@@ -0,0 +1,82 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.ResourceManager.KeyVault.Models
+{
+ /// The LifetimeAction.
+ public partial class LifetimeAction
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ public LifetimeAction()
+ {
+ }
+
+ /// Initializes a new instance of .
+ /// The trigger of key rotation policy lifetimeAction.
+ /// The action of key rotation policy lifetimeAction.
+ /// Keeps track of any properties unknown to the library.
+ internal LifetimeAction(Trigger trigger, Action action, IDictionary serializedAdditionalRawData)
+ {
+ Trigger = trigger;
+ Action = action;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// The trigger of key rotation policy lifetimeAction.
+ [WirePath("trigger")]
+ public Trigger Trigger { get; set; }
+ /// The action of key rotation policy lifetimeAction.
+ internal Action Action { get; set; }
+ /// The type of action.
+ [WirePath("action.type")]
+ public KeyRotationPolicyActionType? KeyRotationPolicyActionType
+ {
+ get => Action is null ? default : Action.KeyRotationPolicyActionType;
+ set
+ {
+ if (Action is null)
+ Action = new Action();
+ Action.KeyRotationPolicyActionType = value;
+ }
+ }
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHSMKeyCreateOrUpdateContent.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHSMKeyCreateOrUpdateContent.Serialization.cs
new file mode 100644
index 0000000000000..115b6bd71bf50
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHSMKeyCreateOrUpdateContent.Serialization.cs
@@ -0,0 +1,145 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.ResourceManager.KeyVault.Models
+{
+ public partial class ManagedHSMKeyCreateOrUpdateContent : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(ManagedHSMKeyCreateOrUpdateContent)} does not support writing '{format}' format.");
+ }
+
+ writer.WriteStartObject();
+ if (Optional.IsCollectionDefined(Tags))
+ {
+ writer.WritePropertyName("tags"u8);
+ writer.WriteStartObject();
+ foreach (var item in Tags)
+ {
+ writer.WritePropertyName(item.Key);
+ writer.WriteStringValue(item.Value);
+ }
+ writer.WriteEndObject();
+ }
+ writer.WritePropertyName("properties"u8);
+ writer.WriteObjectValue(Properties, options);
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ writer.WriteEndObject();
+ }
+
+ ManagedHSMKeyCreateOrUpdateContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(ManagedHSMKeyCreateOrUpdateContent)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeManagedHSMKeyCreateOrUpdateContent(document.RootElement, options);
+ }
+
+ internal static ManagedHSMKeyCreateOrUpdateContent DeserializeManagedHSMKeyCreateOrUpdateContent(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ IDictionary tags = default;
+ ManagedHsmKeyProperties properties = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("tags"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ Dictionary dictionary = new Dictionary();
+ foreach (var property0 in property.Value.EnumerateObject())
+ {
+ dictionary.Add(property0.Name, property0.Value.GetString());
+ }
+ tags = dictionary;
+ continue;
+ }
+ if (property.NameEquals("properties"u8))
+ {
+ properties = ManagedHsmKeyProperties.DeserializeManagedHsmKeyProperties(property.Value, options);
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new ManagedHSMKeyCreateOrUpdateContent(tags ?? new ChangeTrackingDictionary(), properties, serializedAdditionalRawData);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(ManagedHSMKeyCreateOrUpdateContent)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ ManagedHSMKeyCreateOrUpdateContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data);
+ return DeserializeManagedHSMKeyCreateOrUpdateContent(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(ManagedHSMKeyCreateOrUpdateContent)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHSMKeyCreateOrUpdateContent.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHSMKeyCreateOrUpdateContent.cs
new file mode 100644
index 0000000000000..9bb011b0ffe6a
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHSMKeyCreateOrUpdateContent.cs
@@ -0,0 +1,82 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.ResourceManager.KeyVault.Models
+{
+ /// The parameters used to create a key.
+ public partial class ManagedHSMKeyCreateOrUpdateContent
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ /// The properties of the key to be created.
+ /// is null.
+ public ManagedHSMKeyCreateOrUpdateContent(ManagedHsmKeyProperties properties)
+ {
+ Argument.AssertNotNull(properties, nameof(properties));
+
+ Tags = new ChangeTrackingDictionary();
+ Properties = properties;
+ }
+
+ /// Initializes a new instance of .
+ /// The tags that will be assigned to the key.
+ /// The properties of the key to be created.
+ /// Keeps track of any properties unknown to the library.
+ internal ManagedHSMKeyCreateOrUpdateContent(IDictionary tags, ManagedHsmKeyProperties properties, IDictionary serializedAdditionalRawData)
+ {
+ Tags = tags;
+ Properties = properties;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal ManagedHSMKeyCreateOrUpdateContent()
+ {
+ }
+
+ /// The tags that will be assigned to the key.
+ [WirePath("tags")]
+ public IDictionary Tags { get; }
+ /// The properties of the key to be created.
+ [WirePath("properties")]
+ public ManagedHsmKeyProperties Properties { get; }
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmAction.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmAction.Serialization.cs
new file mode 100644
index 0000000000000..e9857d553e782
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmAction.Serialization.cs
@@ -0,0 +1,159 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Text;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.ResourceManager.KeyVault.Models
+{
+ internal partial class ManagedHsmAction : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(ManagedHsmAction)} does not support writing '{format}' format.");
+ }
+
+ writer.WriteStartObject();
+ if (Optional.IsDefined(KeyRotationPolicyActionType))
+ {
+ writer.WritePropertyName("type"u8);
+ writer.WriteStringValue(KeyRotationPolicyActionType.Value.ToSerialString());
+ }
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ writer.WriteEndObject();
+ }
+
+ ManagedHsmAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(ManagedHsmAction)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeManagedHsmAction(document.RootElement, options);
+ }
+
+ internal static ManagedHsmAction DeserializeManagedHsmAction(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ KeyRotationPolicyActionType? type = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("type"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ type = property.Value.GetString().ToKeyRotationPolicyActionType();
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new ManagedHsmAction(type, serializedAdditionalRawData);
+ }
+
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(KeyRotationPolicyActionType), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" type: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(KeyRotationPolicyActionType))
+ {
+ builder.Append(" type: ");
+ builder.AppendLine($"'{KeyRotationPolicyActionType.Value.ToSerialString()}'");
+ }
+ }
+
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
+ default:
+ throw new FormatException($"The model {nameof(ManagedHsmAction)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ ManagedHsmAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data);
+ return DeserializeManagedHsmAction(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(ManagedHsmAction)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmAction.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmAction.cs
new file mode 100644
index 0000000000000..55c59972391ea
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmAction.cs
@@ -0,0 +1,66 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.ResourceManager.KeyVault.Models
+{
+ /// The ManagedHsmAction.
+ internal partial class ManagedHsmAction
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ public ManagedHsmAction()
+ {
+ }
+
+ /// Initializes a new instance of .
+ /// The type of action.
+ /// Keeps track of any properties unknown to the library.
+ internal ManagedHsmAction(KeyRotationPolicyActionType? keyRotationPolicyActionType, IDictionary serializedAdditionalRawData)
+ {
+ KeyRotationPolicyActionType = keyRotationPolicyActionType;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// The type of action.
+ [WirePath("type")]
+ public KeyRotationPolicyActionType? KeyRotationPolicyActionType { get; set; }
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmKeyAttributes.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmKeyAttributes.Serialization.cs
new file mode 100644
index 0000000000000..635e7e4257b79
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmKeyAttributes.Serialization.cs
@@ -0,0 +1,349 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Text;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.ResourceManager.KeyVault.Models
+{
+ public partial class ManagedHsmKeyAttributes : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(ManagedHsmKeyAttributes)} does not support writing '{format}' format.");
+ }
+
+ writer.WriteStartObject();
+ if (Optional.IsDefined(Enabled))
+ {
+ writer.WritePropertyName("enabled"u8);
+ writer.WriteBooleanValue(Enabled.Value);
+ }
+ if (Optional.IsDefined(NotBefore))
+ {
+ writer.WritePropertyName("nbf"u8);
+ writer.WriteNumberValue(NotBefore.Value);
+ }
+ if (Optional.IsDefined(Expires))
+ {
+ writer.WritePropertyName("exp"u8);
+ writer.WriteNumberValue(Expires.Value);
+ }
+ if (options.Format != "W" && Optional.IsDefined(Created))
+ {
+ writer.WritePropertyName("created"u8);
+ writer.WriteNumberValue(Created.Value);
+ }
+ if (options.Format != "W" && Optional.IsDefined(Updated))
+ {
+ writer.WritePropertyName("updated"u8);
+ writer.WriteNumberValue(Updated.Value);
+ }
+ if (options.Format != "W" && Optional.IsDefined(RecoveryLevel))
+ {
+ writer.WritePropertyName("recoveryLevel"u8);
+ writer.WriteStringValue(RecoveryLevel.Value.ToString());
+ }
+ if (Optional.IsDefined(Exportable))
+ {
+ writer.WritePropertyName("exportable"u8);
+ writer.WriteBooleanValue(Exportable.Value);
+ }
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ writer.WriteEndObject();
+ }
+
+ ManagedHsmKeyAttributes IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(ManagedHsmKeyAttributes)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeManagedHsmKeyAttributes(document.RootElement, options);
+ }
+
+ internal static ManagedHsmKeyAttributes DeserializeManagedHsmKeyAttributes(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ bool? enabled = default;
+ long? nbf = default;
+ long? exp = default;
+ long? created = default;
+ long? updated = default;
+ DeletionRecoveryLevel? recoveryLevel = default;
+ bool? exportable = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("enabled"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ enabled = property.Value.GetBoolean();
+ continue;
+ }
+ if (property.NameEquals("nbf"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ nbf = property.Value.GetInt64();
+ continue;
+ }
+ if (property.NameEquals("exp"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ exp = property.Value.GetInt64();
+ continue;
+ }
+ if (property.NameEquals("created"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ created = property.Value.GetInt64();
+ continue;
+ }
+ if (property.NameEquals("updated"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ updated = property.Value.GetInt64();
+ continue;
+ }
+ if (property.NameEquals("recoveryLevel"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ recoveryLevel = new DeletionRecoveryLevel(property.Value.GetString());
+ continue;
+ }
+ if (property.NameEquals("exportable"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ exportable = property.Value.GetBoolean();
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new ManagedHsmKeyAttributes(
+ enabled,
+ nbf,
+ exp,
+ created,
+ updated,
+ recoveryLevel,
+ exportable,
+ serializedAdditionalRawData);
+ }
+
+ private BinaryData SerializeBicep(ModelReaderWriterOptions options)
+ {
+ StringBuilder builder = new StringBuilder();
+ BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions;
+ IDictionary propertyOverrides = null;
+ bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides);
+ bool hasPropertyOverride = false;
+ string propertyOverride = null;
+
+ builder.AppendLine("{");
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Enabled), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" enabled: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(Enabled))
+ {
+ builder.Append(" enabled: ");
+ var boolValue = Enabled.Value == true ? "true" : "false";
+ builder.AppendLine($"{boolValue}");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NotBefore), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" nbf: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(NotBefore))
+ {
+ builder.Append(" nbf: ");
+ builder.AppendLine($"'{NotBefore.Value.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Expires), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" exp: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(Expires))
+ {
+ builder.Append(" exp: ");
+ builder.AppendLine($"'{Expires.Value.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Created), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" created: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(Created))
+ {
+ builder.Append(" created: ");
+ builder.AppendLine($"'{Created.Value.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Updated), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" updated: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(Updated))
+ {
+ builder.Append(" updated: ");
+ builder.AppendLine($"'{Updated.Value.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RecoveryLevel), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" recoveryLevel: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(RecoveryLevel))
+ {
+ builder.Append(" recoveryLevel: ");
+ builder.AppendLine($"'{RecoveryLevel.Value.ToString()}'");
+ }
+ }
+
+ hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Exportable), out propertyOverride);
+ if (hasPropertyOverride)
+ {
+ builder.Append(" exportable: ");
+ builder.AppendLine(propertyOverride);
+ }
+ else
+ {
+ if (Optional.IsDefined(Exportable))
+ {
+ builder.Append(" exportable: ");
+ var boolValue = Exportable.Value == true ? "true" : "false";
+ builder.AppendLine($"{boolValue}");
+ }
+ }
+
+ builder.AppendLine("}");
+ return BinaryData.FromString(builder.ToString());
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ case "bicep":
+ return SerializeBicep(options);
+ default:
+ throw new FormatException($"The model {nameof(ManagedHsmKeyAttributes)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ ManagedHsmKeyAttributes IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data);
+ return DeserializeManagedHsmKeyAttributes(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(ManagedHsmKeyAttributes)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmKeyAttributes.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmKeyAttributes.cs
new file mode 100644
index 0000000000000..7d7294121f75a
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmKeyAttributes.cs
@@ -0,0 +1,96 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.ResourceManager.KeyVault.Models
+{
+ /// The object attributes managed by the Azure Key Vault service.
+ public partial class ManagedHsmKeyAttributes
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ public ManagedHsmKeyAttributes()
+ {
+ }
+
+ /// Initializes a new instance of .
+ /// Determines whether or not the object is enabled.
+ /// Not before date in seconds since 1970-01-01T00:00:00Z.
+ /// Expiry date in seconds since 1970-01-01T00:00:00Z.
+ /// Creation time in seconds since 1970-01-01T00:00:00Z.
+ /// Last updated time in seconds since 1970-01-01T00:00:00Z.
+ /// The deletion recovery level currently in effect for the object. If it contains 'Purgeable', then the object can be permanently deleted by a privileged user; otherwise, only the system can purge the object at the end of the retention interval.
+ /// Indicates if the private key can be exported.
+ /// Keeps track of any properties unknown to the library.
+ internal ManagedHsmKeyAttributes(bool? enabled, long? notBefore, long? expires, long? created, long? updated, DeletionRecoveryLevel? recoveryLevel, bool? exportable, IDictionary serializedAdditionalRawData)
+ {
+ Enabled = enabled;
+ NotBefore = notBefore;
+ Expires = expires;
+ Created = created;
+ Updated = updated;
+ RecoveryLevel = recoveryLevel;
+ Exportable = exportable;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Determines whether or not the object is enabled.
+ [WirePath("enabled")]
+ public bool? Enabled { get; set; }
+ /// Not before date in seconds since 1970-01-01T00:00:00Z.
+ [WirePath("nbf")]
+ public long? NotBefore { get; set; }
+ /// Expiry date in seconds since 1970-01-01T00:00:00Z.
+ [WirePath("exp")]
+ public long? Expires { get; set; }
+ /// Creation time in seconds since 1970-01-01T00:00:00Z.
+ [WirePath("created")]
+ public long? Created { get; }
+ /// Last updated time in seconds since 1970-01-01T00:00:00Z.
+ [WirePath("updated")]
+ public long? Updated { get; }
+ /// The deletion recovery level currently in effect for the object. If it contains 'Purgeable', then the object can be permanently deleted by a privileged user; otherwise, only the system can purge the object at the end of the retention interval.
+ [WirePath("recoveryLevel")]
+ public DeletionRecoveryLevel? RecoveryLevel { get; }
+ /// Indicates if the private key can be exported.
+ [WirePath("exportable")]
+ public bool? Exportable { get; set; }
+ }
+}
diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmKeyListResult.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmKeyListResult.Serialization.cs
new file mode 100644
index 0000000000000..dba0296c27479
--- /dev/null
+++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/ManagedHsmKeyListResult.Serialization.cs
@@ -0,0 +1,212 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.ResourceManager.KeyVault.Models
+{
+ internal partial class ManagedHsmKeyListResult : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(ManagedHsmKeyListResult)} does not support writing '{format}' format.");
+ }
+
+ writer.WriteStartObject();
+ if (Optional.IsCollectionDefined(Value))
+ {
+ writer.WritePropertyName("value"u8);
+ writer.WriteStartArray();
+ foreach (var item in Value)
+ {
+ writer.WriteObjectValue(item, options);
+ }
+ writer.WriteEndArray();
+ }
+ if (Optional.IsDefined(NextLink))
+ {
+ writer.WritePropertyName("nextLink"u8);
+ writer.WriteStringValue(NextLink);
+ }
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ writer.WriteEndObject();
+ }
+
+ ManagedHsmKeyListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(ManagedHsmKeyListResult)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeManagedHsmKeyListResult(document.RootElement, options);
+ }
+
+ internal static ManagedHsmKeyListResult DeserializeManagedHsmKeyListResult(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ IReadOnlyList value = default;
+ string nextLink = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("value"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ List