diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules.sln b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules.sln
new file mode 100644
index 000000000000..27796b8735b9
--- /dev/null
+++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules.sln
@@ -0,0 +1,56 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.29709.97
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Hardwaresecuritymodules.Samples", "samples\Azure.ResourceManager.Hardwaresecuritymodules.Samples.csproj", "{7A2DFF15-5746-49F4-BD0F-C6C35337088A}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.ResourceManager.Hardwaresecuritymodules", "src\Azure.ResourceManager.Hardwaresecuritymodules.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.ResourceManager.Hardwaresecuritymodules.Tests", "tests\Azure.ResourceManager.Hardwaresecuritymodules.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.Build.0 = Release|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.Build.0 = Release|Any CPU
+ {7A2DFF15-5746-49F4-BD0F-C6C35337088A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7A2DFF15-5746-49F4-BD0F-C6C35337088A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7A2DFF15-5746-49F4-BD0F-C6C35337088A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7A2DFF15-5746-49F4-BD0F-C6C35337088A}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.Build.0 = Release|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.Build.0 = Release|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {A97F4B90-2591-4689-B1F8-5F21FE6D6CAE}
+ EndGlobalSection
+EndGlobal
diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/CHANGELOG.md b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/CHANGELOG.md
new file mode 100644
index 000000000000..8b33f0fedccc
--- /dev/null
+++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/CHANGELOG.md
@@ -0,0 +1,11 @@
+# Release History
+
+## 1.0.0-beta.1 (Unreleased)
+
+### Features Added
+
+### Breaking Changes
+
+### Bugs Fixed
+
+### Other Changes
\ No newline at end of file
diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/Directory.Build.props b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/Directory.Build.props
new file mode 100644
index 000000000000..63bd836ad44b
--- /dev/null
+++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/Directory.Build.props
@@ -0,0 +1,6 @@
+
+
+
+
diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/README.md b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/README.md
new file mode 100644
index 000000000000..88194d4aa6f6
--- /dev/null
+++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/README.md
@@ -0,0 +1,80 @@
+# Microsoft Azure Hardwaresecuritymodules management client library for .NET
+
+**[Describe the service briefly first.]**
+
+This library follows the [new Azure SDK guidelines](https://azure.github.io/azure-sdk/general_introduction.html), and provides many core capabilities:
+
+ - Support MSAL.NET, Azure.Identity is out of box for supporting MSAL.NET.
+ - Support [OpenTelemetry](https://opentelemetry.io/) for distributed tracing.
+ - HTTP pipeline with custom policies.
+ - Better error-handling.
+ - Support uniform telemetry across all languages.
+
+## Getting started
+
+### Install the package
+
+Install the Microsoft Azure Hardwaresecuritymodules management library for .NET with [NuGet](https://www.nuget.org/):
+
+```dotnetcli
+dotnet add package Azure.ResourceManager.Hardwaresecuritymodules --prerelease
+```
+
+### Prerequisites
+
+* You must have an [Microsoft Azure subscription](https://azure.microsoft.com/free/dotnet/).
+
+### Authenticate the Client
+
+To create an authenticated client and start interacting with Microsoft Azure resources, see the [quickstart guide here](https://github.com/Azure/azure-sdk-for-net/blob/main/doc/dev/mgmt_quickstart.md).
+
+## Key concepts
+
+Key concepts of the Microsoft Azure SDK for .NET can be found [here](https://azure.github.io/azure-sdk/dotnet_introduction.html)
+
+## Documentation
+
+Documentation is available to help you learn how to use this package:
+
+- [Quickstart](https://github.com/Azure/azure-sdk-for-net/blob/main/doc/dev/mgmt_quickstart.md).
+- [API References](https://learn.microsoft.com/dotnet/api/?view=azure-dotnet).
+- [Authentication](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/identity/Azure.Identity/README.md).
+
+## Examples
+
+Code samples for using the management library for .NET can be found in the following locations
+- [.NET Management Library Code Samples](https://aka.ms/azuresdk-net-mgmt-samples)
+
+## Troubleshooting
+
+- File an issue via [GitHub Issues](https://github.com/Azure/azure-sdk-for-net/issues).
+- Check [previous questions](https://stackoverflow.com/questions/tagged/azure+.net) or ask new ones on Stack Overflow using Azure and .NET tags.
+
+## Next steps
+
+For more information about Microsoft Azure SDK, see [this website](https://azure.github.io/azure-sdk/).
+
+## Contributing
+
+For details on contributing to this repository, see the [contributing
+guide][cg].
+
+This project welcomes contributions and suggestions. Most contributions
+require you to agree to a Contributor License Agreement (CLA) declaring
+that you have the right to, and actually do, grant us the rights to use
+your contribution. For details, visit .
+
+When you submit a pull request, a CLA-bot will automatically determine
+whether you need to provide a CLA and decorate the PR appropriately
+(for example, label, comment). Follow the instructions provided by the
+bot. You'll only need to do this action once across all repositories
+using our CLA.
+
+This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For
+more information, see the [Code of Conduct FAQ][coc_faq] or contact
+ with any other questions or comments.
+
+
+[cg]: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/resourcemanager/Azure.ResourceManager/docs/CONTRIBUTING.md
+[coc]: https://opensource.microsoft.com/codeofconduct/
+[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/
\ No newline at end of file
diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/assets.json b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/assets.json
new file mode 100644
index 000000000000..ac7598249bce
--- /dev/null
+++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/assets.json
@@ -0,0 +1,7 @@
+
+{
+ "AssetsRepo": "Azure/azure-sdk-assets",
+ "AssetsRepoPrefixPath": "net",
+ "TagPrefix": "net/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules",
+ "Tag": ""
+}
diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/samples/Azure.ResourceManager.Hardwaresecuritymodules.Samples.csproj b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/samples/Azure.ResourceManager.Hardwaresecuritymodules.Samples.csproj
new file mode 100644
index 000000000000..a4adcdc80f67
--- /dev/null
+++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/samples/Azure.ResourceManager.Hardwaresecuritymodules.Samples.csproj
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/samples/Generated/Samples/Sample_CloudHsmClusterCollection.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/samples/Generated/Samples/Sample_CloudHsmClusterCollection.cs
new file mode 100644
index 000000000000..e69a9a9a5a43
--- /dev/null
+++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/samples/Generated/Samples/Sample_CloudHsmClusterCollection.cs
@@ -0,0 +1,209 @@
+// 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.Hardwaresecuritymodules.Models;
+using Azure.ResourceManager.Models;
+using Azure.ResourceManager.Resources;
+using NUnit.Framework;
+
+namespace Azure.ResourceManager.Hardwaresecuritymodules.Samples
+{
+ public partial class Sample_CloudHsmClusterCollection
+ {
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task CreateOrUpdate_CloudHsmClusterCreateOrUpdateMaximumSetGen()
+ {
+ // Generated from example definition: 2024-06-30-preview/CloudHsmCluster_CreateOrUpdate_MaximumSet_Gen.json
+ // this example is just showing the usage of "CloudHsmCluster_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
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this ResourceGroupResource created on azure
+ // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "rgcloudhsm";
+ ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
+ ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
+
+ // get the collection of this CloudHsmClusterResource
+ CloudHsmClusterCollection collection = resourceGroupResource.GetCloudHsmClusters();
+
+ // invoke the operation
+ string cloudHsmClusterName = "chsm1";
+ CloudHsmClusterData data = new CloudHsmClusterData(new AzureLocation("eastus2"))
+ {
+ Identity = new ManagedServiceIdentity("UserAssigned")
+ {
+ UserAssignedIdentities =
+{
+[new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-1")] = new UserAssignedIdentity()
+},
+ },
+ Sku = new CloudHsmClusterSku(CloudHsmClusterSkuFamily.B, CloudHsmClusterSkuName.StandardB1),
+ Tags =
+{
+["Dept"] = "hsm",
+["Environment"] = "dogfood"
+},
+ };
+ ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, cloudHsmClusterName, data);
+ CloudHsmClusterResource 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
+ CloudHsmClusterData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task Get_CloudHsmClusterGetMaximumSetGen()
+ {
+ // Generated from example definition: 2024-06-30-preview/CloudHsmCluster_Get_MaximumSet_Gen.json
+ // this example is just showing the usage of "CloudHsmCluster_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 ResourceGroupResource created on azure
+ // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "rgcloudhsm";
+ ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
+ ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
+
+ // get the collection of this CloudHsmClusterResource
+ CloudHsmClusterCollection collection = resourceGroupResource.GetCloudHsmClusters();
+
+ // invoke the operation
+ string cloudHsmClusterName = "chsm1";
+ CloudHsmClusterResource result = await collection.GetAsync(cloudHsmClusterName);
+
+ // 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
+ CloudHsmClusterData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task GetAll_CloudHsmClusterListByResourceGroupMaximumSetGen()
+ {
+ // Generated from example definition: 2024-06-30-preview/CloudHsmCluster_ListByResourceGroup_MaximumSet_Gen.json
+ // this example is just showing the usage of "CloudHsmCluster_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
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this ResourceGroupResource created on azure
+ // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "rgcloudhsm";
+ ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
+ ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
+
+ // get the collection of this CloudHsmClusterResource
+ CloudHsmClusterCollection collection = resourceGroupResource.GetCloudHsmClusters();
+
+ // invoke the operation and iterate over the result
+ await foreach (CloudHsmClusterResource 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
+ CloudHsmClusterData resourceData = item.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ Console.WriteLine("Succeeded");
+ }
+
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task Exists_CloudHsmClusterGetMaximumSetGen()
+ {
+ // Generated from example definition: 2024-06-30-preview/CloudHsmCluster_Get_MaximumSet_Gen.json
+ // this example is just showing the usage of "CloudHsmCluster_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 ResourceGroupResource created on azure
+ // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "rgcloudhsm";
+ ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
+ ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
+
+ // get the collection of this CloudHsmClusterResource
+ CloudHsmClusterCollection collection = resourceGroupResource.GetCloudHsmClusters();
+
+ // invoke the operation
+ string cloudHsmClusterName = "chsm1";
+ bool result = await collection.ExistsAsync(cloudHsmClusterName);
+
+ Console.WriteLine($"Succeeded: {result}");
+ }
+
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task GetIfExists_CloudHsmClusterGetMaximumSetGen()
+ {
+ // Generated from example definition: 2024-06-30-preview/CloudHsmCluster_Get_MaximumSet_Gen.json
+ // this example is just showing the usage of "CloudHsmCluster_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 ResourceGroupResource created on azure
+ // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "rgcloudhsm";
+ ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
+ ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
+
+ // get the collection of this CloudHsmClusterResource
+ CloudHsmClusterCollection collection = resourceGroupResource.GetCloudHsmClusters();
+
+ // invoke the operation
+ string cloudHsmClusterName = "chsm1";
+ NullableResponse response = await collection.GetIfExistsAsync(cloudHsmClusterName);
+ CloudHsmClusterResource 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
+ CloudHsmClusterData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+ }
+ }
+}
diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/samples/Generated/Samples/Sample_CloudHsmClusterResource.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/samples/Generated/Samples/Sample_CloudHsmClusterResource.cs
new file mode 100644
index 000000000000..150b557cb37b
--- /dev/null
+++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/samples/Generated/Samples/Sample_CloudHsmClusterResource.cs
@@ -0,0 +1,320 @@
+// 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.Hardwaresecuritymodules.Models;
+using Azure.ResourceManager.Models;
+using NUnit.Framework;
+
+namespace Azure.ResourceManager.Hardwaresecuritymodules.Samples
+{
+ public partial class Sample_CloudHsmClusterResource
+ {
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task Get_CloudHsmClusterGetMaximumSetGen()
+ {
+ // Generated from example definition: 2024-06-30-preview/CloudHsmCluster_Get_MaximumSet_Gen.json
+ // this example is just showing the usage of "CloudHsmCluster_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 CloudHsmClusterResource created on azure
+ // for more information of creating CloudHsmClusterResource, please refer to the document of CloudHsmClusterResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "rgcloudhsm";
+ string cloudHsmClusterName = "chsm1";
+ ResourceIdentifier cloudHsmClusterResourceId = CloudHsmClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cloudHsmClusterName);
+ CloudHsmClusterResource cloudHsmCluster = client.GetCloudHsmClusterResource(cloudHsmClusterResourceId);
+
+ // invoke the operation
+ CloudHsmClusterResource result = await cloudHsmCluster.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
+ CloudHsmClusterData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task Delete_CloudHsmClusterDeleteMaximumSetGen()
+ {
+ // Generated from example definition: 2024-06-30-preview/CloudHsmCluster_Delete_MaximumSet_Gen.json
+ // this example is just showing the usage of "CloudHsmCluster_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
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this CloudHsmClusterResource created on azure
+ // for more information of creating CloudHsmClusterResource, please refer to the document of CloudHsmClusterResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "rgcloudhsm";
+ string cloudHsmClusterName = "chsm1";
+ ResourceIdentifier cloudHsmClusterResourceId = CloudHsmClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cloudHsmClusterName);
+ CloudHsmClusterResource cloudHsmCluster = client.GetCloudHsmClusterResource(cloudHsmClusterResourceId);
+
+ // invoke the operation
+ await cloudHsmCluster.DeleteAsync(WaitUntil.Completed);
+
+ Console.WriteLine("Succeeded");
+ }
+
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task Update_CloudHsmClusterUpdateMaximumSetGen()
+ {
+ // Generated from example definition: 2024-06-30-preview/CloudHsmCluster_Update_MaximumSet_Gen.json
+ // this example is just showing the usage of "CloudHsmCluster_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
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this CloudHsmClusterResource created on azure
+ // for more information of creating CloudHsmClusterResource, please refer to the document of CloudHsmClusterResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "rgcloudhsm";
+ string cloudHsmClusterName = "chsm1";
+ ResourceIdentifier cloudHsmClusterResourceId = CloudHsmClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cloudHsmClusterName);
+ CloudHsmClusterResource cloudHsmCluster = client.GetCloudHsmClusterResource(cloudHsmClusterResourceId);
+
+ // invoke the operation
+ CloudHsmClusterPatch patch = new CloudHsmClusterPatch
+ {
+ Tags =
+{
+["Dept"] = "hsm",
+["Environment"] = "dogfood",
+["Slice"] = "A"
+},
+ Identity = new ManagedServiceIdentity("UserAssigned")
+ {
+ UserAssignedIdentities =
+{
+[new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-1")] = new UserAssignedIdentity()
+},
+ },
+ };
+ ArmOperation lro = await cloudHsmCluster.UpdateAsync(WaitUntil.Completed, patch);
+ CloudHsmClusterResource 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
+ CloudHsmClusterData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task ValidateBackupProperties_CloudHsmClusterValidateBackupValidationMaximumSetGen()
+ {
+ // Generated from example definition: 2024-06-30-preview/CloudHsmCluster_CreateOrValidate_Backup_MaximumSet_Gen.json
+ // this example is just showing the usage of "CloudHsmClusters_ValidateBackupProperties" 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 CloudHsmClusterResource created on azure
+ // for more information of creating CloudHsmClusterResource, please refer to the document of CloudHsmClusterResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "rgcloudhsm";
+ string cloudHsmClusterName = "chsm1";
+ ResourceIdentifier cloudHsmClusterResourceId = CloudHsmClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cloudHsmClusterName);
+ CloudHsmClusterResource cloudHsmCluster = client.GetCloudHsmClusterResource(cloudHsmClusterResourceId);
+
+ // invoke the operation
+ BackupRequestProperties backupRequestProperties = new BackupRequestProperties(new Uri("https://myaccount.blob.core.windows.net/sascontainer/sasContainer"))
+ {
+ Token = "se=2018-02-01T00%3A00Z&spr=https&sv=2017-04-17&sr=b&sig=REDACTED",
+ };
+ await cloudHsmCluster.ValidateBackupPropertiesAsync(WaitUntil.Completed, backupRequestProperties: backupRequestProperties);
+
+ Console.WriteLine("Succeeded");
+ }
+
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task Backup_CloudHsmClusterCreateBackupMaximumSetGen()
+ {
+ // Generated from example definition: 2024-06-30-preview/CloudHsmCluster_Create_Backup_MaximumSet_Gen.json
+ // this example is just showing the usage of "CloudHsmClusters_Backup" 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 CloudHsmClusterResource created on azure
+ // for more information of creating CloudHsmClusterResource, please refer to the document of CloudHsmClusterResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "rgcloudhsm";
+ string cloudHsmClusterName = "chsm1";
+ ResourceIdentifier cloudHsmClusterResourceId = CloudHsmClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cloudHsmClusterName);
+ CloudHsmClusterResource cloudHsmCluster = client.GetCloudHsmClusterResource(cloudHsmClusterResourceId);
+
+ // invoke the operation
+ BackupRequestProperties backupRequestProperties = new BackupRequestProperties(new Uri("https://myaccount.blob.core.windows.net/sascontainer/sasContainer"))
+ {
+ Token = "se=2018-02-01T00%3A00Z&spr=https&sv=2017-04-17&sr=b&sig=REDACTED",
+ };
+ await cloudHsmCluster.BackupAsync(WaitUntil.Completed, backupRequestProperties: backupRequestProperties);
+
+ Console.WriteLine("Succeeded");
+ }
+
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task ValidateRestoreProperties_CloudHsmClusterValidateRestoreMaximumSetGen()
+ {
+ // Generated from example definition: 2024-06-30-preview/CloudHsmCluster_RequestOrValidate_Restore_Properties_MaximumSet_Gen.json
+ // this example is just showing the usage of "CloudHsmClusters_ValidateRestoreProperties" 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 CloudHsmClusterResource created on azure
+ // for more information of creating CloudHsmClusterResource, please refer to the document of CloudHsmClusterResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "rgcloudhsm";
+ string cloudHsmClusterName = "chsm1";
+ ResourceIdentifier cloudHsmClusterResourceId = CloudHsmClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cloudHsmClusterName);
+ CloudHsmClusterResource cloudHsmCluster = client.GetCloudHsmClusterResource(cloudHsmClusterResourceId);
+
+ // invoke the operation
+ RestoreRequestProperties restoreRequestProperties = new RestoreRequestProperties(new Uri("https://myaccount.blob.core.windows.net/sascontainer/sasContainer"), "backupId");
+ await cloudHsmCluster.ValidateRestorePropertiesAsync(WaitUntil.Completed, restoreRequestProperties: restoreRequestProperties);
+
+ Console.WriteLine("Succeeded");
+ }
+
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task Restore_CloudHsmClusterRestoreMaximumSetGen()
+ {
+ // Generated from example definition: 2024-06-30-preview/CloudHsmCluster_RequestOrValidate_Restore_MaximumSet_Gen.json
+ // this example is just showing the usage of "CloudHsmClusters_Restore" 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 CloudHsmClusterResource created on azure
+ // for more information of creating CloudHsmClusterResource, please refer to the document of CloudHsmClusterResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "rgcloudhsm";
+ string cloudHsmClusterName = "chsm1";
+ ResourceIdentifier cloudHsmClusterResourceId = CloudHsmClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cloudHsmClusterName);
+ CloudHsmClusterResource cloudHsmCluster = client.GetCloudHsmClusterResource(cloudHsmClusterResourceId);
+
+ // invoke the operation
+ RestoreRequestProperties restoreRequestProperties = new RestoreRequestProperties(null, null);
+ await cloudHsmCluster.RestoreAsync(WaitUntil.Completed, restoreRequestProperties);
+
+ Console.WriteLine("Succeeded");
+ }
+
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task GetByCloudHsmCluster_CloudHsmClusterPrivateLinkResourcesListByResourceMaximumSetGen()
+ {
+ // Generated from example definition: 2024-06-30-preview/CloudHsmClusterPrivateLinkResource_ListByCloudHsmCluster_MaximumSet_Gen.json
+ // this example is just showing the usage of "CloudHsmClusters_ListByCloudHsmCluster" 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 CloudHsmClusterResource created on azure
+ // for more information of creating CloudHsmClusterResource, please refer to the document of CloudHsmClusterResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "rgcloudhsm";
+ string cloudHsmClusterName = "chsm1";
+ ResourceIdentifier cloudHsmClusterResourceId = CloudHsmClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cloudHsmClusterName);
+ CloudHsmClusterResource cloudHsmCluster = client.GetCloudHsmClusterResource(cloudHsmClusterResourceId);
+
+ // invoke the operation and iterate over the result
+ await foreach (HardwaresecuritymodulesPrivateLinkResourceData item in cloudHsmCluster.GetByCloudHsmClusterAsync())
+ {
+ Console.WriteLine($"Succeeded: {item}");
+ }
+
+ Console.WriteLine("Succeeded");
+ }
+
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task CloudHsmClusterBackupStatusGet_CloudHsmClusterGetBackupStatusMaximumSetGen()
+ {
+ // Generated from example definition: 2024-06-30-preview/CloudHsmCluster_Backup_Pending_MaximumSet_Gen.json
+ // this example is just showing the usage of "CloudHsmClusters_CloudHsmClusterBackupStatusGet" 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 CloudHsmClusterResource created on azure
+ // for more information of creating CloudHsmClusterResource, please refer to the document of CloudHsmClusterResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "rgcloudhsm";
+ string cloudHsmClusterName = "chsm1";
+ ResourceIdentifier cloudHsmClusterResourceId = CloudHsmClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cloudHsmClusterName);
+ CloudHsmClusterResource cloudHsmCluster = client.GetCloudHsmClusterResource(cloudHsmClusterResourceId);
+
+ // invoke the operation
+ string jobId = "572a45927fc240e1ac075de27371680b";
+ BackupResult result = await cloudHsmCluster.CloudHsmClusterBackupStatusGetAsync(jobId);
+
+ Console.WriteLine($"Succeeded: {result}");
+ }
+
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task CloudHsmClusterRestoreStatusGet_CloudHsmClusterGetRestoreStatusMaximumSetGen()
+ {
+ // Generated from example definition: 2024-06-30-preview/CloudHsmCluster_Restore_Pending_MaximumSet_Gen.json
+ // this example is just showing the usage of "CloudHsmClusters_CloudHsmClusterRestoreStatusGet" 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 CloudHsmClusterResource created on azure
+ // for more information of creating CloudHsmClusterResource, please refer to the document of CloudHsmClusterResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "rgcloudhsm";
+ string cloudHsmClusterName = "chsm1";
+ ResourceIdentifier cloudHsmClusterResourceId = CloudHsmClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cloudHsmClusterName);
+ CloudHsmClusterResource cloudHsmCluster = client.GetCloudHsmClusterResource(cloudHsmClusterResourceId);
+
+ // invoke the operation
+ string jobId = "572a45927fc240e1ac075de27371680b";
+ RestoreResult result = await cloudHsmCluster.CloudHsmClusterRestoreStatusGetAsync(jobId);
+
+ Console.WriteLine($"Succeeded: {result}");
+ }
+ }
+}
diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/samples/Generated/Samples/Sample_DedicatedHsmCollection.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/samples/Generated/Samples/Sample_DedicatedHsmCollection.cs
new file mode 100644
index 000000000000..878ba0ca45db
--- /dev/null
+++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/samples/Generated/Samples/Sample_DedicatedHsmCollection.cs
@@ -0,0 +1,489 @@
+// 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.Hardwaresecuritymodules.Models;
+using Azure.ResourceManager.Resources;
+using NUnit.Framework;
+
+namespace Azure.ResourceManager.Hardwaresecuritymodules.Samples
+{
+ public partial class Sample_DedicatedHsmCollection
+ {
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task CreateOrUpdate_CreateANewOrUpdateAnExistingDedicatedHSM()
+ {
+ // Generated from example definition: 2024-06-30-preview/DedicatedHsm_CreateOrUpdate.json
+ // this example is just showing the usage of "DedicatedHsm_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
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this ResourceGroupResource created on azure
+ // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "hsm-group";
+ ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
+ ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
+
+ // get the collection of this DedicatedHsmResource
+ DedicatedHsmCollection collection = resourceGroupResource.GetDedicatedHsms();
+
+ // invoke the operation
+ string name = "hsm1";
+ DedicatedHsmData data = new DedicatedHsmData(default, null);
+ await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, data);
+
+ Console.WriteLine("Succeeded");
+ }
+
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task CreateOrUpdate_CreateANewOrUpdateAnExistingPaymentHSM()
+ {
+ // Generated from example definition: 2024-06-30-preview/PaymentHsm_CreateOrUpdate.json
+ // this example is just showing the usage of "DedicatedHsm_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
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this ResourceGroupResource created on azure
+ // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "hsm-group";
+ ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
+ ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
+
+ // get the collection of this DedicatedHsmResource
+ DedicatedHsmCollection collection = resourceGroupResource.GetDedicatedHsms();
+
+ // invoke the operation
+ string name = "hsm1";
+ DedicatedHsmData data = new DedicatedHsmData(default, null);
+ await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, data);
+
+ Console.WriteLine("Succeeded");
+ }
+
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task CreateOrUpdate_CreateANewOrUpdateAnExistingPaymentHSMWithManagementProfile()
+ {
+ // Generated from example definition: 2024-06-30-preview/PaymentHsm_CreateOrUpdate_WithManagementProfile.json
+ // this example is just showing the usage of "DedicatedHsm_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
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this ResourceGroupResource created on azure
+ // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "hsm-group";
+ ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
+ ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
+
+ // get the collection of this DedicatedHsmResource
+ DedicatedHsmCollection collection = resourceGroupResource.GetDedicatedHsms();
+
+ // invoke the operation
+ string name = "hsm1";
+ DedicatedHsmData data = new DedicatedHsmData(default, null);
+ await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, data);
+
+ Console.WriteLine("Succeeded");
+ }
+
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task Get_GetADedicatedHSM()
+ {
+ // Generated from example definition: 2024-06-30-preview/DedicatedHsm_Get.json
+ // this example is just showing the usage of "DedicatedHsm_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 ResourceGroupResource created on azure
+ // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "hsm-group";
+ ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
+ ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
+
+ // get the collection of this DedicatedHsmResource
+ DedicatedHsmCollection collection = resourceGroupResource.GetDedicatedHsms();
+
+ // invoke the operation
+ string name = "hsm1";
+ DedicatedHsmResource result = await collection.GetAsync(name);
+
+ // 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
+ DedicatedHsmData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task Get_GetAPaymentHSM()
+ {
+ // Generated from example definition: 2024-06-30-preview/PaymentHsm_Get.json
+ // this example is just showing the usage of "DedicatedHsm_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 ResourceGroupResource created on azure
+ // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "hsm-group";
+ ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
+ ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
+
+ // get the collection of this DedicatedHsmResource
+ DedicatedHsmCollection collection = resourceGroupResource.GetDedicatedHsms();
+
+ // invoke the operation
+ string name = "hsm1";
+ DedicatedHsmResource result = await collection.GetAsync(name);
+
+ // 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
+ DedicatedHsmData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task Get_GetAPaymentHSMWith20181031PreviewApiVersion()
+ {
+ // Generated from example definition: 2024-06-30-preview/PaymentHsm_Get_With_2018-10-31Preview_Version.json
+ // this example is just showing the usage of "DedicatedHsm_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 ResourceGroupResource created on azure
+ // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "hsm-group";
+ ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
+ ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
+
+ // get the collection of this DedicatedHsmResource
+ DedicatedHsmCollection collection = resourceGroupResource.GetDedicatedHsms();
+
+ // invoke the operation
+ string name = "hsm1";
+ DedicatedHsmResource result = await collection.GetAsync(name);
+
+ // 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
+ DedicatedHsmData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task GetAll_ListDedicatedHSMDevicesInAResourceGroup()
+ {
+ // Generated from example definition: 2024-06-30-preview/DedicatedHsm_ListByResourceGroup.json
+ // this example is just showing the usage of "DedicatedHsm_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
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this ResourceGroupResource created on azure
+ // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "hsm-group";
+ ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
+ ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
+
+ // get the collection of this DedicatedHsmResource
+ DedicatedHsmCollection collection = resourceGroupResource.GetDedicatedHsms();
+
+ // invoke the operation and iterate over the result
+ await foreach (DedicatedHsmResource 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
+ DedicatedHsmData resourceData = item.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ Console.WriteLine("Succeeded");
+ }
+
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task GetAll_ListDedicatedHSMDevicesInAResourceGroupIncludingPaymentHSM()
+ {
+ // Generated from example definition: 2024-06-30-preview/PaymentHsm_ListByResourceGroup.json
+ // this example is just showing the usage of "DedicatedHsm_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
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this ResourceGroupResource created on azure
+ // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "hsm-group";
+ ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
+ ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
+
+ // get the collection of this DedicatedHsmResource
+ DedicatedHsmCollection collection = resourceGroupResource.GetDedicatedHsms();
+
+ // invoke the operation and iterate over the result
+ await foreach (DedicatedHsmResource 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
+ DedicatedHsmData resourceData = item.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ Console.WriteLine("Succeeded");
+ }
+
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task Exists_GetADedicatedHSM()
+ {
+ // Generated from example definition: 2024-06-30-preview/DedicatedHsm_Get.json
+ // this example is just showing the usage of "DedicatedHsm_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 ResourceGroupResource created on azure
+ // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "hsm-group";
+ ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
+ ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
+
+ // get the collection of this DedicatedHsmResource
+ DedicatedHsmCollection collection = resourceGroupResource.GetDedicatedHsms();
+
+ // invoke the operation
+ string name = "hsm1";
+ bool result = await collection.ExistsAsync(name);
+
+ Console.WriteLine($"Succeeded: {result}");
+ }
+
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task Exists_GetAPaymentHSM()
+ {
+ // Generated from example definition: 2024-06-30-preview/PaymentHsm_Get.json
+ // this example is just showing the usage of "DedicatedHsm_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 ResourceGroupResource created on azure
+ // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "hsm-group";
+ ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
+ ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
+
+ // get the collection of this DedicatedHsmResource
+ DedicatedHsmCollection collection = resourceGroupResource.GetDedicatedHsms();
+
+ // invoke the operation
+ string name = "hsm1";
+ bool result = await collection.ExistsAsync(name);
+
+ Console.WriteLine($"Succeeded: {result}");
+ }
+
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task Exists_GetAPaymentHSMWith20181031PreviewApiVersion()
+ {
+ // Generated from example definition: 2024-06-30-preview/PaymentHsm_Get_With_2018-10-31Preview_Version.json
+ // this example is just showing the usage of "DedicatedHsm_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 ResourceGroupResource created on azure
+ // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "hsm-group";
+ ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
+ ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
+
+ // get the collection of this DedicatedHsmResource
+ DedicatedHsmCollection collection = resourceGroupResource.GetDedicatedHsms();
+
+ // invoke the operation
+ string name = "hsm1";
+ bool result = await collection.ExistsAsync(name);
+
+ Console.WriteLine($"Succeeded: {result}");
+ }
+
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task GetIfExists_GetADedicatedHSM()
+ {
+ // Generated from example definition: 2024-06-30-preview/DedicatedHsm_Get.json
+ // this example is just showing the usage of "DedicatedHsm_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 ResourceGroupResource created on azure
+ // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "hsm-group";
+ ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
+ ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
+
+ // get the collection of this DedicatedHsmResource
+ DedicatedHsmCollection collection = resourceGroupResource.GetDedicatedHsms();
+
+ // invoke the operation
+ string name = "hsm1";
+ NullableResponse response = await collection.GetIfExistsAsync(name);
+ DedicatedHsmResource 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
+ DedicatedHsmData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+ }
+
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task GetIfExists_GetAPaymentHSM()
+ {
+ // Generated from example definition: 2024-06-30-preview/PaymentHsm_Get.json
+ // this example is just showing the usage of "DedicatedHsm_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 ResourceGroupResource created on azure
+ // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "hsm-group";
+ ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
+ ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
+
+ // get the collection of this DedicatedHsmResource
+ DedicatedHsmCollection collection = resourceGroupResource.GetDedicatedHsms();
+
+ // invoke the operation
+ string name = "hsm1";
+ NullableResponse response = await collection.GetIfExistsAsync(name);
+ DedicatedHsmResource 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
+ DedicatedHsmData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+ }
+
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task GetIfExists_GetAPaymentHSMWith20181031PreviewApiVersion()
+ {
+ // Generated from example definition: 2024-06-30-preview/PaymentHsm_Get_With_2018-10-31Preview_Version.json
+ // this example is just showing the usage of "DedicatedHsm_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 ResourceGroupResource created on azure
+ // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "hsm-group";
+ ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
+ ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
+
+ // get the collection of this DedicatedHsmResource
+ DedicatedHsmCollection collection = resourceGroupResource.GetDedicatedHsms();
+
+ // invoke the operation
+ string name = "hsm1";
+ NullableResponse response = await collection.GetIfExistsAsync(name);
+ DedicatedHsmResource 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
+ DedicatedHsmData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+ }
+ }
+}
diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/samples/Generated/Samples/Sample_DedicatedHsmResource.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/samples/Generated/Samples/Sample_DedicatedHsmResource.cs
new file mode 100644
index 000000000000..8d4c9b69be20
--- /dev/null
+++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/samples/Generated/Samples/Sample_DedicatedHsmResource.cs
@@ -0,0 +1,228 @@
+// 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.Hardwaresecuritymodules.Models;
+using NUnit.Framework;
+
+namespace Azure.ResourceManager.Hardwaresecuritymodules.Samples
+{
+ public partial class Sample_DedicatedHsmResource
+ {
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task Get_GetADedicatedHSM()
+ {
+ // Generated from example definition: 2024-06-30-preview/DedicatedHsm_Get.json
+ // this example is just showing the usage of "DedicatedHsm_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 DedicatedHsmResource created on azure
+ // for more information of creating DedicatedHsmResource, please refer to the document of DedicatedHsmResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "hsm-group";
+ string name = "hsm1";
+ ResourceIdentifier dedicatedHsmResourceId = DedicatedHsmResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name);
+ DedicatedHsmResource dedicatedHsm = client.GetDedicatedHsmResource(dedicatedHsmResourceId);
+
+ // invoke the operation
+ DedicatedHsmResource result = await dedicatedHsm.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
+ DedicatedHsmData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task Get_GetAPaymentHSM()
+ {
+ // Generated from example definition: 2024-06-30-preview/PaymentHsm_Get.json
+ // this example is just showing the usage of "DedicatedHsm_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 DedicatedHsmResource created on azure
+ // for more information of creating DedicatedHsmResource, please refer to the document of DedicatedHsmResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "hsm-group";
+ string name = "hsm1";
+ ResourceIdentifier dedicatedHsmResourceId = DedicatedHsmResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name);
+ DedicatedHsmResource dedicatedHsm = client.GetDedicatedHsmResource(dedicatedHsmResourceId);
+
+ // invoke the operation
+ DedicatedHsmResource result = await dedicatedHsm.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
+ DedicatedHsmData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task Get_GetAPaymentHSMWith20181031PreviewApiVersion()
+ {
+ // Generated from example definition: 2024-06-30-preview/PaymentHsm_Get_With_2018-10-31Preview_Version.json
+ // this example is just showing the usage of "DedicatedHsm_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 DedicatedHsmResource created on azure
+ // for more information of creating DedicatedHsmResource, please refer to the document of DedicatedHsmResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "hsm-group";
+ string name = "hsm1";
+ ResourceIdentifier dedicatedHsmResourceId = DedicatedHsmResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name);
+ DedicatedHsmResource dedicatedHsm = client.GetDedicatedHsmResource(dedicatedHsmResourceId);
+
+ // invoke the operation
+ DedicatedHsmResource result = await dedicatedHsm.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
+ DedicatedHsmData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task Delete_DeleteADedicatedHSM()
+ {
+ // Generated from example definition: 2024-06-30-preview/DedicatedHsm_Delete.json
+ // this example is just showing the usage of "DedicatedHsm_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
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this DedicatedHsmResource created on azure
+ // for more information of creating DedicatedHsmResource, please refer to the document of DedicatedHsmResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "hsm-group";
+ string name = "hsm1";
+ ResourceIdentifier dedicatedHsmResourceId = DedicatedHsmResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name);
+ DedicatedHsmResource dedicatedHsm = client.GetDedicatedHsmResource(dedicatedHsmResourceId);
+
+ // invoke the operation
+ await dedicatedHsm.DeleteAsync(WaitUntil.Completed);
+
+ Console.WriteLine("Succeeded");
+ }
+
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task Update_UpdateAnExistingDedicatedHSM()
+ {
+ // Generated from example definition: 2024-06-30-preview/DedicatedHsm_Update.json
+ // this example is just showing the usage of "DedicatedHsm_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
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this DedicatedHsmResource created on azure
+ // for more information of creating DedicatedHsmResource, please refer to the document of DedicatedHsmResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "hsm-group";
+ string name = "hsm1";
+ ResourceIdentifier dedicatedHsmResourceId = DedicatedHsmResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name);
+ DedicatedHsmResource dedicatedHsm = client.GetDedicatedHsmResource(dedicatedHsmResourceId);
+
+ // invoke the operation
+ DedicatedHsmPatch patch = new DedicatedHsmPatch();
+ ArmOperation lro = await dedicatedHsm.UpdateAsync(WaitUntil.Completed, patch);
+ DedicatedHsmResource 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
+ DedicatedHsmData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task Update_UpdateAnExistingPaymentHSM()
+ {
+ // Generated from example definition: 2024-06-30-preview/PaymentHsm_Update.json
+ // this example is just showing the usage of "DedicatedHsm_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
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this DedicatedHsmResource created on azure
+ // for more information of creating DedicatedHsmResource, please refer to the document of DedicatedHsmResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "hsm-group";
+ string name = "hsm1";
+ ResourceIdentifier dedicatedHsmResourceId = DedicatedHsmResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name);
+ DedicatedHsmResource dedicatedHsm = client.GetDedicatedHsmResource(dedicatedHsmResourceId);
+
+ // invoke the operation
+ DedicatedHsmPatch patch = new DedicatedHsmPatch();
+ ArmOperation lro = await dedicatedHsm.UpdateAsync(WaitUntil.Completed, patch);
+ DedicatedHsmResource 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
+ DedicatedHsmData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task GetOutboundNetworkDependenciesEndpoints_ListOutboundNetworkDependenciesEndpointsByManagedCluster()
+ {
+ // Generated from example definition: 2024-06-30-preview/GetOutboundNetworkDependenciesEndpointsList.json
+ // this example is just showing the usage of "DedicatedHsms_ListOutboundNetworkDependenciesEndpoints" 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 DedicatedHsmResource created on azure
+ // for more information of creating DedicatedHsmResource, please refer to the document of DedicatedHsmResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "hsm-group";
+ string name = "hsm1";
+ ResourceIdentifier dedicatedHsmResourceId = DedicatedHsmResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name);
+ DedicatedHsmResource dedicatedHsm = client.GetDedicatedHsmResource(dedicatedHsmResourceId);
+
+ // invoke the operation and iterate over the result
+ await foreach (OutboundEnvironmentEndpoint item in dedicatedHsm.GetOutboundNetworkDependenciesEndpointsAsync())
+ {
+ Console.WriteLine($"Succeeded: {item}");
+ }
+
+ Console.WriteLine("Succeeded");
+ }
+ }
+}
diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/samples/Generated/Samples/Sample_HardwaresecuritymodulesPrivateEndpointConnectionCollection.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/samples/Generated/Samples/Sample_HardwaresecuritymodulesPrivateEndpointConnectionCollection.cs
new file mode 100644
index 000000000000..14140adaeb3e
--- /dev/null
+++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/samples/Generated/Samples/Sample_HardwaresecuritymodulesPrivateEndpointConnectionCollection.cs
@@ -0,0 +1,196 @@
+// 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 NUnit.Framework;
+
+namespace Azure.ResourceManager.Hardwaresecuritymodules.Samples
+{
+ public partial class Sample_HardwaresecuritymodulesPrivateEndpointConnectionCollection
+ {
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task CreateOrUpdate_CloudHsmClusterPrivateEndpointConnectionCreateMaximumSetGen()
+ {
+ // Generated from example definition: 2024-06-30-preview/CloudHsmClusterPrivateEndpointConnection_Create_MaximumSet_Gen.json
+ // this example is just showing the usage of "PrivateEndpointConnection_Create" 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 CloudHsmClusterResource created on azure
+ // for more information of creating CloudHsmClusterResource, please refer to the document of CloudHsmClusterResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "rgcloudhsm";
+ string cloudHsmClusterName = "chsm1";
+ ResourceIdentifier cloudHsmClusterResourceId = CloudHsmClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cloudHsmClusterName);
+ CloudHsmClusterResource cloudHsmCluster = client.GetCloudHsmClusterResource(cloudHsmClusterResourceId);
+
+ // get the collection of this HardwaresecuritymodulesPrivateEndpointConnectionResource
+ HardwaresecuritymodulesPrivateEndpointConnectionCollection collection = cloudHsmCluster.GetHardwaresecuritymodulesPrivateEndpointConnections();
+
+ // invoke the operation
+ string peConnectionName = "sample-pec";
+ HardwaresecuritymodulesPrivateEndpointConnectionData data = new HardwaresecuritymodulesPrivateEndpointConnectionData();
+ ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, peConnectionName, data);
+ HardwaresecuritymodulesPrivateEndpointConnectionResource 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
+ HardwaresecuritymodulesPrivateEndpointConnectionData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task Get_CloudHsmClusterPrivateEndpointConnectionGetMaximumSetGen()
+ {
+ // Generated from example definition: 2024-06-30-preview/CloudHsmClusterPrivateEndpointConnection_Get_MaximumSet_Gen.json
+ // this example is just showing the usage of "PrivateEndpointConnection_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 CloudHsmClusterResource created on azure
+ // for more information of creating CloudHsmClusterResource, please refer to the document of CloudHsmClusterResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "rgcloudhsm";
+ string cloudHsmClusterName = "chsm1";
+ ResourceIdentifier cloudHsmClusterResourceId = CloudHsmClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cloudHsmClusterName);
+ CloudHsmClusterResource cloudHsmCluster = client.GetCloudHsmClusterResource(cloudHsmClusterResourceId);
+
+ // get the collection of this HardwaresecuritymodulesPrivateEndpointConnectionResource
+ HardwaresecuritymodulesPrivateEndpointConnectionCollection collection = cloudHsmCluster.GetHardwaresecuritymodulesPrivateEndpointConnections();
+
+ // invoke the operation
+ string peConnectionName = "sample-pec";
+ HardwaresecuritymodulesPrivateEndpointConnectionResource result = await collection.GetAsync(peConnectionName);
+
+ // 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
+ HardwaresecuritymodulesPrivateEndpointConnectionData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task GetAll_CloudHsmClusterPrivateEndpointConnectionListByResourceMaximumSetGen()
+ {
+ // Generated from example definition: 2024-06-30-preview/CloudHsmClusterPrivateEndpointConnection_ListByCloudHsmCluster_MaximumSet_Gen.json
+ // this example is just showing the usage of "PrivateEndpointConnection_ListByCloudHsmCluster" 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 CloudHsmClusterResource created on azure
+ // for more information of creating CloudHsmClusterResource, please refer to the document of CloudHsmClusterResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "rgcloudhsm";
+ string cloudHsmClusterName = "chsm1";
+ ResourceIdentifier cloudHsmClusterResourceId = CloudHsmClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cloudHsmClusterName);
+ CloudHsmClusterResource cloudHsmCluster = client.GetCloudHsmClusterResource(cloudHsmClusterResourceId);
+
+ // get the collection of this HardwaresecuritymodulesPrivateEndpointConnectionResource
+ HardwaresecuritymodulesPrivateEndpointConnectionCollection collection = cloudHsmCluster.GetHardwaresecuritymodulesPrivateEndpointConnections();
+
+ // invoke the operation and iterate over the result
+ await foreach (HardwaresecuritymodulesPrivateEndpointConnectionResource 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
+ HardwaresecuritymodulesPrivateEndpointConnectionData resourceData = item.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ Console.WriteLine("Succeeded");
+ }
+
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task Exists_CloudHsmClusterPrivateEndpointConnectionGetMaximumSetGen()
+ {
+ // Generated from example definition: 2024-06-30-preview/CloudHsmClusterPrivateEndpointConnection_Get_MaximumSet_Gen.json
+ // this example is just showing the usage of "PrivateEndpointConnection_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 CloudHsmClusterResource created on azure
+ // for more information of creating CloudHsmClusterResource, please refer to the document of CloudHsmClusterResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "rgcloudhsm";
+ string cloudHsmClusterName = "chsm1";
+ ResourceIdentifier cloudHsmClusterResourceId = CloudHsmClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cloudHsmClusterName);
+ CloudHsmClusterResource cloudHsmCluster = client.GetCloudHsmClusterResource(cloudHsmClusterResourceId);
+
+ // get the collection of this HardwaresecuritymodulesPrivateEndpointConnectionResource
+ HardwaresecuritymodulesPrivateEndpointConnectionCollection collection = cloudHsmCluster.GetHardwaresecuritymodulesPrivateEndpointConnections();
+
+ // invoke the operation
+ string peConnectionName = "sample-pec";
+ bool result = await collection.ExistsAsync(peConnectionName);
+
+ Console.WriteLine($"Succeeded: {result}");
+ }
+
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task GetIfExists_CloudHsmClusterPrivateEndpointConnectionGetMaximumSetGen()
+ {
+ // Generated from example definition: 2024-06-30-preview/CloudHsmClusterPrivateEndpointConnection_Get_MaximumSet_Gen.json
+ // this example is just showing the usage of "PrivateEndpointConnection_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 CloudHsmClusterResource created on azure
+ // for more information of creating CloudHsmClusterResource, please refer to the document of CloudHsmClusterResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "rgcloudhsm";
+ string cloudHsmClusterName = "chsm1";
+ ResourceIdentifier cloudHsmClusterResourceId = CloudHsmClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cloudHsmClusterName);
+ CloudHsmClusterResource cloudHsmCluster = client.GetCloudHsmClusterResource(cloudHsmClusterResourceId);
+
+ // get the collection of this HardwaresecuritymodulesPrivateEndpointConnectionResource
+ HardwaresecuritymodulesPrivateEndpointConnectionCollection collection = cloudHsmCluster.GetHardwaresecuritymodulesPrivateEndpointConnections();
+
+ // invoke the operation
+ string peConnectionName = "sample-pec";
+ NullableResponse response = await collection.GetIfExistsAsync(peConnectionName);
+ HardwaresecuritymodulesPrivateEndpointConnectionResource 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
+ HardwaresecuritymodulesPrivateEndpointConnectionData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+ }
+ }
+}
diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/samples/Generated/Samples/Sample_HardwaresecuritymodulesPrivateEndpointConnectionResource.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/samples/Generated/Samples/Sample_HardwaresecuritymodulesPrivateEndpointConnectionResource.cs
new file mode 100644
index 000000000000..3e66babe23e1
--- /dev/null
+++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/samples/Generated/Samples/Sample_HardwaresecuritymodulesPrivateEndpointConnectionResource.cs
@@ -0,0 +1,109 @@
+// 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 NUnit.Framework;
+
+namespace Azure.ResourceManager.Hardwaresecuritymodules.Samples
+{
+ public partial class Sample_HardwaresecuritymodulesPrivateEndpointConnectionResource
+ {
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task Get_CloudHsmClusterPrivateEndpointConnectionGetMaximumSetGen()
+ {
+ // Generated from example definition: 2024-06-30-preview/CloudHsmClusterPrivateEndpointConnection_Get_MaximumSet_Gen.json
+ // this example is just showing the usage of "PrivateEndpointConnection_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 HardwaresecuritymodulesPrivateEndpointConnectionResource created on azure
+ // for more information of creating HardwaresecuritymodulesPrivateEndpointConnectionResource, please refer to the document of HardwaresecuritymodulesPrivateEndpointConnectionResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "rgcloudhsm";
+ string cloudHsmClusterName = "chsm1";
+ string peConnectionName = "sample-pec";
+ ResourceIdentifier hardwaresecuritymodulesPrivateEndpointConnectionResourceId = HardwaresecuritymodulesPrivateEndpointConnectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cloudHsmClusterName, peConnectionName);
+ HardwaresecuritymodulesPrivateEndpointConnectionResource hardwaresecuritymodulesPrivateEndpointConnection = client.GetHardwaresecuritymodulesPrivateEndpointConnectionResource(hardwaresecuritymodulesPrivateEndpointConnectionResourceId);
+
+ // invoke the operation
+ HardwaresecuritymodulesPrivateEndpointConnectionResource result = await hardwaresecuritymodulesPrivateEndpointConnection.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
+ HardwaresecuritymodulesPrivateEndpointConnectionData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task Delete_CloudHsmClusterPrivateEndpointConnectionDeleteMaximumSetGen()
+ {
+ // Generated from example definition: 2024-06-30-preview/CloudHsmClusterPrivateEndpointConnection_Delete_MaximumSet_Gen.json
+ // this example is just showing the usage of "PrivateEndpointConnection_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
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this HardwaresecuritymodulesPrivateEndpointConnectionResource created on azure
+ // for more information of creating HardwaresecuritymodulesPrivateEndpointConnectionResource, please refer to the document of HardwaresecuritymodulesPrivateEndpointConnectionResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "rgcloudhsm";
+ string cloudHsmClusterName = "chsm1";
+ string peConnectionName = "sample-pec";
+ ResourceIdentifier hardwaresecuritymodulesPrivateEndpointConnectionResourceId = HardwaresecuritymodulesPrivateEndpointConnectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cloudHsmClusterName, peConnectionName);
+ HardwaresecuritymodulesPrivateEndpointConnectionResource hardwaresecuritymodulesPrivateEndpointConnection = client.GetHardwaresecuritymodulesPrivateEndpointConnectionResource(hardwaresecuritymodulesPrivateEndpointConnectionResourceId);
+
+ // invoke the operation
+ await hardwaresecuritymodulesPrivateEndpointConnection.DeleteAsync(WaitUntil.Completed);
+
+ Console.WriteLine("Succeeded");
+ }
+
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task Update_CloudHsmClusterPrivateEndpointConnectionCreateMaximumSetGen()
+ {
+ // Generated from example definition: 2024-06-30-preview/CloudHsmClusterPrivateEndpointConnection_Create_MaximumSet_Gen.json
+ // this example is just showing the usage of "PrivateEndpointConnection_Create" 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 HardwaresecuritymodulesPrivateEndpointConnectionResource created on azure
+ // for more information of creating HardwaresecuritymodulesPrivateEndpointConnectionResource, please refer to the document of HardwaresecuritymodulesPrivateEndpointConnectionResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ string resourceGroupName = "rgcloudhsm";
+ string cloudHsmClusterName = "chsm1";
+ string peConnectionName = "sample-pec";
+ ResourceIdentifier hardwaresecuritymodulesPrivateEndpointConnectionResourceId = HardwaresecuritymodulesPrivateEndpointConnectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cloudHsmClusterName, peConnectionName);
+ HardwaresecuritymodulesPrivateEndpointConnectionResource hardwaresecuritymodulesPrivateEndpointConnection = client.GetHardwaresecuritymodulesPrivateEndpointConnectionResource(hardwaresecuritymodulesPrivateEndpointConnectionResourceId);
+
+ // invoke the operation
+ HardwaresecuritymodulesPrivateEndpointConnectionData data = new HardwaresecuritymodulesPrivateEndpointConnectionData();
+ ArmOperation lro = await hardwaresecuritymodulesPrivateEndpointConnection.UpdateAsync(WaitUntil.Completed, data);
+ HardwaresecuritymodulesPrivateEndpointConnectionResource 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
+ HardwaresecuritymodulesPrivateEndpointConnectionData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+ }
+}
diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs
new file mode 100644
index 000000000000..e0bf51fa0671
--- /dev/null
+++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs
@@ -0,0 +1,112 @@
+// 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.Resources;
+using NUnit.Framework;
+
+namespace Azure.ResourceManager.Hardwaresecuritymodules.Samples
+{
+ public partial class Sample_SubscriptionResourceExtensions
+ {
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task GetCloudHsmClusters_CloudHsmClusterListBySubscriptionMaximumSetGen()
+ {
+ // Generated from example definition: 2024-06-30-preview/CloudHsmCluster_ListBySubscription_MaximumSet_Gen.json
+ // this example is just showing the usage of "CloudHsmCluster_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
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this SubscriptionResource created on azure
+ // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId);
+ SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId);
+
+ // invoke the operation and iterate over the result
+ await foreach (CloudHsmClusterResource item in subscriptionResource.GetCloudHsmClustersAsync())
+ {
+ // 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
+ CloudHsmClusterData resourceData = item.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ Console.WriteLine("Succeeded");
+ }
+
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task GetDedicatedHsms_ListDedicatedHSMDevicesInASubscription()
+ {
+ // Generated from example definition: 2024-06-30-preview/DedicatedHsm_ListBySubscription.json
+ // this example is just showing the usage of "DedicatedHsm_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
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this SubscriptionResource created on azure
+ // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId);
+ SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId);
+
+ // invoke the operation and iterate over the result
+ await foreach (DedicatedHsmResource item in subscriptionResource.GetDedicatedHsmsAsync())
+ {
+ // 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
+ DedicatedHsmData resourceData = item.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ Console.WriteLine("Succeeded");
+ }
+
+ [Test]
+ [Ignore("Only validating compilation of examples")]
+ public async Task GetDedicatedHsms_ListDedicatedHSMDevicesInASubscriptionIncludingPaymentHSM()
+ {
+ // Generated from example definition: 2024-06-30-preview/PaymentHsm_ListBySubscription.json
+ // this example is just showing the usage of "DedicatedHsm_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
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this SubscriptionResource created on azure
+ // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource
+ string subscriptionId = "00000000-0000-0000-0000-000000000000";
+ ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId);
+ SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId);
+
+ // invoke the operation and iterate over the result
+ await foreach (DedicatedHsmResource item in subscriptionResource.GetDedicatedHsmsAsync())
+ {
+ // 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
+ DedicatedHsmData 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/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Azure.ResourceManager.Hardwaresecuritymodules.csproj b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Azure.ResourceManager.Hardwaresecuritymodules.csproj
new file mode 100644
index 000000000000..1b45459b3fcf
--- /dev/null
+++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Azure.ResourceManager.Hardwaresecuritymodules.csproj
@@ -0,0 +1,8 @@
+
+
+ Azure Resource Manager client SDK for Azure resource provider Hardwaresecuritymodules.
+ 1.0.0-beta.1
+ azure;management;arm;resource manager;hardwaresecuritymodules
+ Azure.ResourceManager.Hardwaresecuritymodules
+
+
diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/ArmHardwaresecuritymodulesModelFactory.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/ArmHardwaresecuritymodulesModelFactory.cs
new file mode 100644
index 000000000000..8380c5c65841
--- /dev/null
+++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/ArmHardwaresecuritymodulesModelFactory.cs
@@ -0,0 +1,266 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Azure.Core;
+using Azure.ResourceManager.Models;
+
+namespace Azure.ResourceManager.Hardwaresecuritymodules.Models
+{
+ /// Model factory for models.
+ public static partial class ArmHardwaresecuritymodulesModelFactory
+ {
+ /// Initializes a new instance of .
+ /// The id.
+ /// The name.
+ /// The resourceType.
+ /// The systemData.
+ /// The tags.
+ /// The location.
+ /// State of security domain activation.
+ /// The Cloud HSM Cluster's auto-generated Domain Name Label Scope.
+ /// An array of Cloud HSM Cluster's HSMs.
+ /// List of private endpoint connection resources.
+ /// The Cloud HSM Cluster's provisioningState.
+ /// The Cloud HSM Cluster public network access.
+ /// Cloud HSM Cluster status message.
+ /// Managed service identity (system assigned and/or user assigned identities).
+ /// SKU details.
+ /// A new instance for mocking.
+ public static CloudHsmClusterData CloudHsmClusterData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ActivationState? activationState = null, AutoGeneratedDomainNameLabelScope? autoGeneratedDomainNameLabelScope = null, IEnumerable hsms = null, IEnumerable privateEndpointConnections = null, ProvisioningState? provisioningState = null, PublicNetworkAccess? publicNetworkAccess = null, string statusMessage = null, ManagedServiceIdentity identity = null, CloudHsmClusterSku sku = null)
+ {
+ tags ??= new Dictionary();
+ hsms ??= new List();
+ privateEndpointConnections ??= new List();
+
+ return new CloudHsmClusterData(
+ id,
+ name,
+ resourceType,
+ systemData,
+ tags,
+ location,
+ activationState,
+ autoGeneratedDomainNameLabelScope,
+ hsms?.ToList(),
+ privateEndpointConnections?.ToList(),
+ provisioningState,
+ publicNetworkAccess,
+ statusMessage,
+ identity,
+ sku,
+ serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// FQDN of the Cloud HSM.
+ /// The Cloud HSM State. Values are: Deploying, ConfiguringSlb, Starting, Starting, Failed, Failed, Deleting, DeletingSlbEntry, InitialProvisioning, Updating.
+ /// The Cloud HSM State message.
+ /// A new instance for mocking.
+ public static CloudHsmProperties CloudHsmProperties(string fqdn = null, string state = null, string stateMessage = null)
+ {
+ return new CloudHsmProperties(fqdn, state, stateMessage, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The id.
+ /// The name.
+ /// The resourceType.
+ /// The systemData.
+ /// The private endpoint resource.
+ /// A collection of information about the state of the connection between service consumer and provider.
+ /// The provisioning state of the private endpoint connection resource.
+ /// The group ids for the private endpoint resource.
+ /// Modified whenever there is a change in the state of private endpoint connection.
+ /// A new instance for mocking.
+ public static HardwaresecuritymodulesPrivateEndpointConnectionData HardwaresecuritymodulesPrivateEndpointConnectionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ResourceIdentifier privateEndpointId = null, HardwaresecuritymodulesPrivateLinkServiceConnectionState privateLinkServiceConnectionState = null, HardwaresecuritymodulesPrivateEndpointConnectionProvisioningState? provisioningState = null, IEnumerable groupIds = null, string etag = null)
+ {
+ groupIds ??= new List();
+
+ return new HardwaresecuritymodulesPrivateEndpointConnectionData(
+ id,
+ name,
+ resourceType,
+ systemData,
+ privateEndpointId != null ? ResourceManagerModelFactory.SubResource(privateEndpointId) : null,
+ privateLinkServiceConnectionState,
+ provisioningState,
+ groupIds?.ToList(),
+ etag,
+ serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The Azure blob storage container Uri which contains the backup.
+ /// The SAS token pointing to an Azure blob storage container. This property is reserved for Azure Backup Service.
+ /// A new instance for mocking.
+ public static BackupRequestProperties BackupRequestProperties(Uri azureStorageBlobContainerUri = null, string token = null)
+ {
+ return new BackupRequestProperties(azureStorageBlobContainerUri, token, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The Azure blob storage container Uri which contains the backup.
+ /// The SAS token pointing to an Azure blob storage container. This property is reserved for Azure Backup Service.
+ /// A new instance for mocking.
+ public static BackupRestoreRequestBaseProperties BackupRestoreRequestBaseProperties(Uri azureStorageBlobContainerUri = null, string token = null)
+ {
+ return new BackupRestoreRequestBaseProperties(azureStorageBlobContainerUri, token, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The Azure blob storage container Uri which contains the backup.
+ /// The ID of the backup.
+ /// A new instance for mocking.
+ public static BackupResult BackupResult(Uri azureStorageBlobContainerUri = null, string backupId = null)
+ {
+ return new BackupResult(azureStorageBlobContainerUri, backupId, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The Azure blob storage container Uri which contains the backup.
+ /// The SAS token pointing to an Azure blob storage container. This property is reserved for Azure Backup Service.
+ /// An autogenerated unique string ID for labeling the backup. It contains both a UUID and a date timestamp.
+ /// A new instance for mocking.
+ public static RestoreRequestProperties RestoreRequestProperties(Uri azureStorageBlobContainerUri = null, string token = null, string backupId = null)
+ {
+ return new RestoreRequestProperties(azureStorageBlobContainerUri, token, serializedAdditionalRawData: null, backupId);
+ }
+
+ /// Initializes a new instance of .
+ /// Status of the backup/restore operation.
+ /// The status details of backup/restore operation.
+ /// Error encountered, if any, during the backup/restore operation.
+ /// The start time of the backup/restore operation in UTC.
+ /// The end time of the backup/restore operation in UTC.
+ /// Identifier for the backup/restore operation.
+ /// A new instance for mocking.
+ public static RestoreResult RestoreResult(BackupRestoreOperationStatus? status = null, string statusDetails = null, ResponseError error = null, DateTimeOffset? startOn = null, DateTimeOffset? endOn = null, string jobId = null)
+ {
+ return new RestoreResult(
+ status,
+ statusDetails,
+ error,
+ startOn,
+ endOn,
+ jobId,
+ serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The id.
+ /// The name.
+ /// The resourceType.
+ /// The systemData.
+ /// Resource properties.
+ /// A new instance for mocking.
+ public static HardwaresecuritymodulesPrivateLinkResourceData HardwaresecuritymodulesPrivateLinkResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, HardwaresecuritymodulesPrivateLinkResourceProperties properties = null)
+ {
+ return new HardwaresecuritymodulesPrivateLinkResourceData(
+ id,
+ name,
+ resourceType,
+ systemData,
+ properties,
+ serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The private link resource group id.
+ /// The private link resource required member names.
+ /// The private link resource private link DNS zone name.
+ /// A new instance for mocking.
+ public static HardwaresecuritymodulesPrivateLinkResourceProperties HardwaresecuritymodulesPrivateLinkResourceProperties(string groupId = null, IEnumerable requiredMembers = null, IEnumerable requiredZoneNames = null)
+ {
+ requiredMembers ??= new List();
+ requiredZoneNames ??= new List();
+
+ return new HardwaresecuritymodulesPrivateLinkResourceProperties(groupId, requiredMembers?.ToList(), requiredZoneNames?.ToList(), serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The id.
+ /// The name.
+ /// The resourceType.
+ /// The systemData.
+ /// The tags.
+ /// The location.
+ /// SKU details.
+ /// The availability zones.
+ /// Specifies the network interfaces of the dedicated hsm.
+ /// Specifies the management network interfaces of the dedicated hsm.
+ /// This field will be used when RP does not support Availability zones.
+ /// Resource Status Message.
+ /// Provisioning state.
+ /// A new instance for mocking.
+ public static DedicatedHsmData DedicatedHsmData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, HardwaresecuritymodulesSkuName? skuName = null, IEnumerable zones = null, NetworkProfile networkProfile = null, NetworkProfile managementNetworkProfile = null, string stampId = null, string statusMessage = null, JsonWebKeyType? provisioningState = null)
+ {
+ tags ??= new Dictionary();
+ zones ??= new List();
+
+ return new DedicatedHsmData(
+ id,
+ name,
+ resourceType,
+ systemData,
+ tags,
+ location,
+ skuName != null ? new HardwaresecuritymodulesSku(skuName, serializedAdditionalRawData: null) : null,
+ zones?.ToList(),
+ networkProfile,
+ managementNetworkProfile,
+ stampId,
+ statusMessage,
+ provisioningState,
+ serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The Azure resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/...
+ /// Private Ip address of the interface.
+ /// A new instance for mocking.
+ public static NetworkInterface NetworkInterface(ResourceIdentifier resourceId = null, string privateIPAddress = null)
+ {
+ return new NetworkInterface(resourceId, privateIPAddress, serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The category of endpoints accessed by the dedicated hsm service, e.g. azure-resource-management, apiserver, etc.
+ /// The endpoints that dedicated hsm service connects to.
+ /// A new instance for mocking.
+ public static OutboundEnvironmentEndpoint OutboundEnvironmentEndpoint(string category = null, IEnumerable endpoints = null)
+ {
+ endpoints ??= new List();
+
+ return new OutboundEnvironmentEndpoint(category, endpoints?.ToList(), serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// The domain name of the dependency.
+ /// The Ports and Protocols used when connecting to domainName.
+ /// A new instance for mocking.
+ public static EndpointDependency EndpointDependency(string domainName = null, IEnumerable endpointDetails = null)
+ {
+ endpointDetails ??= new List();
+
+ return new EndpointDependency(domainName, endpointDetails?.ToList(), serializedAdditionalRawData: null);
+ }
+
+ /// Initializes a new instance of .
+ /// An IP Address that Domain Name currently resolves to.
+ /// The port an endpoint is connected to.
+ /// The protocol used for connection.
+ /// Description of the detail.
+ /// A new instance for mocking.
+ public static EndpointDetail EndpointDetail(string ipAddress = null, int? port = null, string protocol = null, string description = null)
+ {
+ return new EndpointDetail(ipAddress, port, protocol, description, serializedAdditionalRawData: null);
+ }
+ }
+}
diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/CloudHsmClusterCollection.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/CloudHsmClusterCollection.cs
new file mode 100644
index 000000000000..5333ecdbd6f1
--- /dev/null
+++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/CloudHsmClusterCollection.cs
@@ -0,0 +1,496 @@
+// 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.Resources;
+
+namespace Azure.ResourceManager.Hardwaresecuritymodules
+{
+ ///
+ /// 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 GetCloudHsmClusters method from an instance of .
+ ///
+ public partial class CloudHsmClusterCollection : ArmCollection, IEnumerable, IAsyncEnumerable
+ {
+ private readonly ClientDiagnostics _cloudHsmClusterClientDiagnostics;
+ private readonly CloudHsmClustersRestOperations _cloudHsmClusterRestClient;
+
+ /// Initializes a new instance of the class for mocking.
+ protected CloudHsmClusterCollection()
+ {
+ }
+
+ /// 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 CloudHsmClusterCollection(ArmClient client, ResourceIdentifier id) : base(client, id)
+ {
+ _cloudHsmClusterClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Hardwaresecuritymodules", CloudHsmClusterResource.ResourceType.Namespace, Diagnostics);
+ TryGetApiVersion(CloudHsmClusterResource.ResourceType, out string cloudHsmClusterApiVersion);
+ _cloudHsmClusterRestClient = new CloudHsmClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, cloudHsmClusterApiVersion);
+#if DEBUG
+ ValidateResourceId(Id);
+#endif
+ }
+
+ internal static void ValidateResourceId(ResourceIdentifier id)
+ {
+ if (id.ResourceType != ResourceGroupResource.ResourceType)
+ throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id));
+ }
+
+ ///
+ /// Create or Update a Cloud HSM Cluster in the specified subscription.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmCluster_CreateOrUpdate
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// 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 Cloud HSM Cluster within the specified resource group. Cloud HSM Cluster names must be between 3 and 23 characters in length.
+ /// Parameters to create Cloud HSM Cluster.
+ /// 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 cloudHsmClusterName, CloudHsmClusterData data, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(cloudHsmClusterName, nameof(cloudHsmClusterName));
+ Argument.AssertNotNull(data, nameof(data));
+
+ using var scope = _cloudHsmClusterClientDiagnostics.CreateScope("CloudHsmClusterCollection.CreateOrUpdate");
+ scope.Start();
+ try
+ {
+ var response = await _cloudHsmClusterRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, cloudHsmClusterName, data, cancellationToken).ConfigureAwait(false);
+ var operation = new HardwaresecuritymodulesArmOperation(new CloudHsmClusterOperationSource(Client), _cloudHsmClusterClientDiagnostics, Pipeline, _cloudHsmClusterRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, cloudHsmClusterName, data).Request, response, OperationFinalStateVia.OriginalUri);
+ if (waitUntil == WaitUntil.Completed)
+ await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
+ return operation;
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Create or Update a Cloud HSM Cluster in the specified subscription.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmCluster_CreateOrUpdate
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// 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 Cloud HSM Cluster within the specified resource group. Cloud HSM Cluster names must be between 3 and 23 characters in length.
+ /// Parameters to create Cloud HSM Cluster.
+ /// 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 cloudHsmClusterName, CloudHsmClusterData data, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(cloudHsmClusterName, nameof(cloudHsmClusterName));
+ Argument.AssertNotNull(data, nameof(data));
+
+ using var scope = _cloudHsmClusterClientDiagnostics.CreateScope("CloudHsmClusterCollection.CreateOrUpdate");
+ scope.Start();
+ try
+ {
+ var response = _cloudHsmClusterRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, cloudHsmClusterName, data, cancellationToken);
+ var operation = new HardwaresecuritymodulesArmOperation(new CloudHsmClusterOperationSource(Client), _cloudHsmClusterClientDiagnostics, Pipeline, _cloudHsmClusterRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, cloudHsmClusterName, data).Request, response, OperationFinalStateVia.OriginalUri);
+ if (waitUntil == WaitUntil.Completed)
+ operation.WaitForCompletion(cancellationToken);
+ return operation;
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Gets the specified Cloud HSM Cluster
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmCluster_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The name of the Cloud HSM Cluster within the specified resource group. Cloud HSM Cluster names must be between 3 and 23 characters in length.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ public virtual async Task> GetAsync(string cloudHsmClusterName, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(cloudHsmClusterName, nameof(cloudHsmClusterName));
+
+ using var scope = _cloudHsmClusterClientDiagnostics.CreateScope("CloudHsmClusterCollection.Get");
+ scope.Start();
+ try
+ {
+ var response = await _cloudHsmClusterRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, cloudHsmClusterName, cancellationToken).ConfigureAwait(false);
+ if (response.Value == null)
+ throw new RequestFailedException(response.GetRawResponse());
+ return Response.FromValue(new CloudHsmClusterResource(Client, response.Value), response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Gets the specified Cloud HSM Cluster
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmCluster_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The name of the Cloud HSM Cluster within the specified resource group. Cloud HSM Cluster names must be between 3 and 23 characters in length.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ public virtual Response Get(string cloudHsmClusterName, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(cloudHsmClusterName, nameof(cloudHsmClusterName));
+
+ using var scope = _cloudHsmClusterClientDiagnostics.CreateScope("CloudHsmClusterCollection.Get");
+ scope.Start();
+ try
+ {
+ var response = _cloudHsmClusterRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, cloudHsmClusterName, cancellationToken);
+ if (response.Value == null)
+ throw new RequestFailedException(response.GetRawResponse());
+ return Response.FromValue(new CloudHsmClusterResource(Client, response.Value), response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// The List operation gets information about the Cloud HSM Clusters associated with the subscription and within the specified resource group.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmCluster_ListByResourceGroup
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The page-continuation token to use with a paged version of this API.
+ /// The cancellation token to use.
+ /// An async collection of that may take multiple service requests to iterate over.
+ public virtual AsyncPageable GetAllAsync(string skiptoken = null, CancellationToken cancellationToken = default)
+ {
+ HttpMessage FirstPageRequest(int? pageSizeHint) => _cloudHsmClusterRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, skiptoken);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _cloudHsmClusterRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, skiptoken);
+ return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CloudHsmClusterResource(Client, CloudHsmClusterData.DeserializeCloudHsmClusterData(e)), _cloudHsmClusterClientDiagnostics, Pipeline, "CloudHsmClusterCollection.GetAll", "value", "nextLink", cancellationToken);
+ }
+
+ ///
+ /// The List operation gets information about the Cloud HSM Clusters associated with the subscription and within the specified resource group.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmCluster_ListByResourceGroup
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The page-continuation token to use with a paged version of this API.
+ /// The cancellation token to use.
+ /// A collection of that may take multiple service requests to iterate over.
+ public virtual Pageable GetAll(string skiptoken = null, CancellationToken cancellationToken = default)
+ {
+ HttpMessage FirstPageRequest(int? pageSizeHint) => _cloudHsmClusterRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, skiptoken);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _cloudHsmClusterRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, skiptoken);
+ return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CloudHsmClusterResource(Client, CloudHsmClusterData.DeserializeCloudHsmClusterData(e)), _cloudHsmClusterClientDiagnostics, Pipeline, "CloudHsmClusterCollection.GetAll", "value", "nextLink", cancellationToken);
+ }
+
+ ///
+ /// Checks to see if the resource exists in azure.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmCluster_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The name of the Cloud HSM Cluster within the specified resource group. Cloud HSM Cluster names must be between 3 and 23 characters in length.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ public virtual async Task> ExistsAsync(string cloudHsmClusterName, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(cloudHsmClusterName, nameof(cloudHsmClusterName));
+
+ using var scope = _cloudHsmClusterClientDiagnostics.CreateScope("CloudHsmClusterCollection.Exists");
+ scope.Start();
+ try
+ {
+ var response = await _cloudHsmClusterRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, cloudHsmClusterName, 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.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmCluster_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The name of the Cloud HSM Cluster within the specified resource group. Cloud HSM Cluster names must be between 3 and 23 characters in length.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ public virtual Response Exists(string cloudHsmClusterName, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(cloudHsmClusterName, nameof(cloudHsmClusterName));
+
+ using var scope = _cloudHsmClusterClientDiagnostics.CreateScope("CloudHsmClusterCollection.Exists");
+ scope.Start();
+ try
+ {
+ var response = _cloudHsmClusterRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, cloudHsmClusterName, 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.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmCluster_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The name of the Cloud HSM Cluster within the specified resource group. Cloud HSM Cluster names must be between 3 and 23 characters in length.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ public virtual async Task> GetIfExistsAsync(string cloudHsmClusterName, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(cloudHsmClusterName, nameof(cloudHsmClusterName));
+
+ using var scope = _cloudHsmClusterClientDiagnostics.CreateScope("CloudHsmClusterCollection.GetIfExists");
+ scope.Start();
+ try
+ {
+ var response = await _cloudHsmClusterRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, cloudHsmClusterName, cancellationToken: cancellationToken).ConfigureAwait(false);
+ if (response.Value == null)
+ return new NoValueResponse(response.GetRawResponse());
+ return Response.FromValue(new CloudHsmClusterResource(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.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmCluster_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The name of the Cloud HSM Cluster within the specified resource group. Cloud HSM Cluster names must be between 3 and 23 characters in length.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ public virtual NullableResponse GetIfExists(string cloudHsmClusterName, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(cloudHsmClusterName, nameof(cloudHsmClusterName));
+
+ using var scope = _cloudHsmClusterClientDiagnostics.CreateScope("CloudHsmClusterCollection.GetIfExists");
+ scope.Start();
+ try
+ {
+ var response = _cloudHsmClusterRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, cloudHsmClusterName, cancellationToken: cancellationToken);
+ if (response.Value == null)
+ return new NoValueResponse(response.GetRawResponse());
+ return Response.FromValue(new CloudHsmClusterResource(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/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/CloudHsmClusterData.Serialization.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/CloudHsmClusterData.Serialization.cs
new file mode 100644
index 000000000000..7d26ee893673
--- /dev/null
+++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/CloudHsmClusterData.Serialization.cs
@@ -0,0 +1,339 @@
+// 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;
+using Azure.ResourceManager.Hardwaresecuritymodules.Models;
+using Azure.ResourceManager.Models;
+
+namespace Azure.ResourceManager.Hardwaresecuritymodules
+{
+ public partial class CloudHsmClusterData : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ writer.WriteStartObject();
+ JsonModelWriteCore(writer, options);
+ writer.WriteEndObject();
+ }
+
+ /// The JSON writer.
+ /// The client options for reading and writing models.
+ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(CloudHsmClusterData)} does not support writing '{format}' format.");
+ }
+
+ base.JsonModelWriteCore(writer, options);
+ if (Optional.IsDefined(Identity))
+ {
+ writer.WritePropertyName("identity"u8);
+ var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } };
+ JsonSerializer.Serialize(writer, Identity, serializeOptions);
+ }
+ if (Optional.IsDefined(Sku))
+ {
+ writer.WritePropertyName("sku"u8);
+ writer.WriteObjectValue(Sku, options);
+ }
+ writer.WritePropertyName("properties"u8);
+ writer.WriteStartObject();
+ if (options.Format != "W" && Optional.IsDefined(ActivationState))
+ {
+ writer.WritePropertyName("activationState"u8);
+ writer.WriteStringValue(ActivationState.Value.ToString());
+ }
+ if (Optional.IsDefined(AutoGeneratedDomainNameLabelScope))
+ {
+ writer.WritePropertyName("autoGeneratedDomainNameLabelScope"u8);
+ writer.WriteStringValue(AutoGeneratedDomainNameLabelScope.Value.ToString());
+ }
+ if (options.Format != "W" && Optional.IsCollectionDefined(Hsms))
+ {
+ writer.WritePropertyName("hsms"u8);
+ writer.WriteStartArray();
+ foreach (var item in Hsms)
+ {
+ writer.WriteObjectValue(item, options);
+ }
+ writer.WriteEndArray();
+ }
+ if (options.Format != "W" && Optional.IsCollectionDefined(PrivateEndpointConnections))
+ {
+ writer.WritePropertyName("privateEndpointConnections"u8);
+ writer.WriteStartArray();
+ foreach (var item in PrivateEndpointConnections)
+ {
+ writer.WriteObjectValue(item, options);
+ }
+ writer.WriteEndArray();
+ }
+ if (options.Format != "W" && Optional.IsDefined(ProvisioningState))
+ {
+ writer.WritePropertyName("provisioningState"u8);
+ writer.WriteStringValue(ProvisioningState.Value.ToString());
+ }
+ if (Optional.IsDefined(PublicNetworkAccess))
+ {
+ writer.WritePropertyName("publicNetworkAccess"u8);
+ writer.WriteStringValue(PublicNetworkAccess.Value.ToString());
+ }
+ if (options.Format != "W" && Optional.IsDefined(StatusMessage))
+ {
+ writer.WritePropertyName("statusMessage"u8);
+ writer.WriteStringValue(StatusMessage);
+ }
+ writer.WriteEndObject();
+ }
+
+ CloudHsmClusterData 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(CloudHsmClusterData)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeCloudHsmClusterData(document.RootElement, options);
+ }
+
+ internal static CloudHsmClusterData DeserializeCloudHsmClusterData(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ ManagedServiceIdentity identity = default;
+ CloudHsmClusterSku sku = default;
+ IDictionary tags = default;
+ AzureLocation location = default;
+ ResourceIdentifier id = default;
+ string name = default;
+ ResourceType type = default;
+ SystemData systemData = default;
+ ActivationState? activationState = default;
+ AutoGeneratedDomainNameLabelScope? autoGeneratedDomainNameLabelScope = default;
+ IReadOnlyList hsms = default;
+ IReadOnlyList privateEndpointConnections = default;
+ ProvisioningState? provisioningState = default;
+ PublicNetworkAccess? publicNetworkAccess = default;
+ string statusMessage = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ 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("sku"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ sku = CloudHsmClusterSku.DeserializeCloudHsmClusterSku(property.Value, options);
+ 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("location"u8))
+ {
+ location = new AzureLocation(property.Value.GetString());
+ 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("activationState"u8))
+ {
+ if (property0.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ activationState = new ActivationState(property0.Value.GetString());
+ continue;
+ }
+ if (property0.NameEquals("autoGeneratedDomainNameLabelScope"u8))
+ {
+ if (property0.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ autoGeneratedDomainNameLabelScope = new AutoGeneratedDomainNameLabelScope(property0.Value.GetString());
+ continue;
+ }
+ if (property0.NameEquals("hsms"u8))
+ {
+ if (property0.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ List array = new List();
+ foreach (var item in property0.Value.EnumerateArray())
+ {
+ array.Add(CloudHsmProperties.DeserializeCloudHsmProperties(item, options));
+ }
+ hsms = array;
+ continue;
+ }
+ if (property0.NameEquals("privateEndpointConnections"u8))
+ {
+ if (property0.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ List array = new List();
+ foreach (var item in property0.Value.EnumerateArray())
+ {
+ array.Add(HardwaresecuritymodulesPrivateEndpointConnectionData.DeserializeHardwaresecuritymodulesPrivateEndpointConnectionData(item, options));
+ }
+ privateEndpointConnections = array;
+ continue;
+ }
+ if (property0.NameEquals("provisioningState"u8))
+ {
+ if (property0.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ provisioningState = new ProvisioningState(property0.Value.GetString());
+ continue;
+ }
+ if (property0.NameEquals("publicNetworkAccess"u8))
+ {
+ if (property0.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ publicNetworkAccess = new PublicNetworkAccess(property0.Value.GetString());
+ continue;
+ }
+ if (property0.NameEquals("statusMessage"u8))
+ {
+ statusMessage = property0.Value.GetString();
+ continue;
+ }
+ }
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new CloudHsmClusterData(
+ id,
+ name,
+ type,
+ systemData,
+ tags ?? new ChangeTrackingDictionary(),
+ location,
+ activationState,
+ autoGeneratedDomainNameLabelScope,
+ hsms ?? new ChangeTrackingList(),
+ privateEndpointConnections ?? new ChangeTrackingList(),
+ provisioningState,
+ publicNetworkAccess,
+ statusMessage,
+ identity,
+ sku,
+ 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, AzureResourceManagerHardwaresecuritymodulesContext.Default);
+ default:
+ throw new FormatException($"The model {nameof(CloudHsmClusterData)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ CloudHsmClusterData 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, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeCloudHsmClusterData(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(CloudHsmClusterData)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+ }
+}
diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/CloudHsmClusterData.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/CloudHsmClusterData.cs
new file mode 100644
index 000000000000..63d7430533e4
--- /dev/null
+++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/CloudHsmClusterData.cs
@@ -0,0 +1,117 @@
+// 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.Hardwaresecuritymodules.Models;
+using Azure.ResourceManager.Models;
+
+namespace Azure.ResourceManager.Hardwaresecuritymodules
+{
+ ///
+ /// A class representing the CloudHsmCluster data model.
+ /// Resource information with extended details.
+ ///
+ public partial class CloudHsmClusterData : TrackedResourceData
+ {
+ ///
+ /// 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 location.
+ public CloudHsmClusterData(AzureLocation location) : base(location)
+ {
+ Hsms = new ChangeTrackingList();
+ PrivateEndpointConnections = new ChangeTrackingList();
+ }
+
+ /// Initializes a new instance of .
+ /// The id.
+ /// The name.
+ /// The resourceType.
+ /// The systemData.
+ /// The tags.
+ /// The location.
+ /// State of security domain activation.
+ /// The Cloud HSM Cluster's auto-generated Domain Name Label Scope.
+ /// An array of Cloud HSM Cluster's HSMs.
+ /// List of private endpoint connection resources.
+ /// The Cloud HSM Cluster's provisioningState.
+ /// The Cloud HSM Cluster public network access.
+ /// Cloud HSM Cluster status message.
+ /// Managed service identity (system assigned and/or user assigned identities).
+ /// SKU details.
+ /// Keeps track of any properties unknown to the library.
+ internal CloudHsmClusterData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ActivationState? activationState, AutoGeneratedDomainNameLabelScope? autoGeneratedDomainNameLabelScope, IReadOnlyList hsms, IReadOnlyList privateEndpointConnections, ProvisioningState? provisioningState, PublicNetworkAccess? publicNetworkAccess, string statusMessage, ManagedServiceIdentity identity, CloudHsmClusterSku sku, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location)
+ {
+ ActivationState = activationState;
+ AutoGeneratedDomainNameLabelScope = autoGeneratedDomainNameLabelScope;
+ Hsms = hsms;
+ PrivateEndpointConnections = privateEndpointConnections;
+ ProvisioningState = provisioningState;
+ PublicNetworkAccess = publicNetworkAccess;
+ StatusMessage = statusMessage;
+ Identity = identity;
+ Sku = sku;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal CloudHsmClusterData()
+ {
+ }
+
+ /// State of security domain activation.
+ public ActivationState? ActivationState { get; }
+ /// The Cloud HSM Cluster's auto-generated Domain Name Label Scope.
+ public AutoGeneratedDomainNameLabelScope? AutoGeneratedDomainNameLabelScope { get; set; }
+ /// An array of Cloud HSM Cluster's HSMs.
+ public IReadOnlyList Hsms { get; }
+ /// List of private endpoint connection resources.
+ public IReadOnlyList PrivateEndpointConnections { get; }
+ /// The Cloud HSM Cluster's provisioningState.
+ public ProvisioningState? ProvisioningState { get; }
+ /// The Cloud HSM Cluster public network access.
+ public PublicNetworkAccess? PublicNetworkAccess { get; set; }
+ /// Cloud HSM Cluster status message.
+ public string StatusMessage { get; }
+ /// Managed service identity (system assigned and/or user assigned identities).
+ public ManagedServiceIdentity Identity { get; set; }
+ /// SKU details.
+ public CloudHsmClusterSku Sku { get; set; }
+ }
+}
diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/CloudHsmClusterResource.Serialization.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/CloudHsmClusterResource.Serialization.cs
new file mode 100644
index 000000000000..1b065c2ad87e
--- /dev/null
+++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/CloudHsmClusterResource.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.Hardwaresecuritymodules
+{
+ public partial class CloudHsmClusterResource : IJsonModel
+ {
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options);
+
+ CloudHsmClusterData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options);
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerHardwaresecuritymodulesContext.Default);
+
+ CloudHsmClusterData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerHardwaresecuritymodulesContext.Default);
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options);
+ }
+}
diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/CloudHsmClusterResource.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/CloudHsmClusterResource.cs
new file mode 100644
index 000000000000..9df132b16a60
--- /dev/null
+++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/CloudHsmClusterResource.cs
@@ -0,0 +1,1359 @@
+// 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 Autorest.CSharp.Core;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Hardwaresecuritymodules.Models;
+using Azure.ResourceManager.Resources;
+
+namespace Azure.ResourceManager.Hardwaresecuritymodules
+{
+ ///
+ /// A Class representing a CloudHsmCluster 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 GetCloudHsmClusterResource method.
+ /// Otherwise you can get one from its parent resource using the GetCloudHsmCluster method.
+ ///
+ public partial class CloudHsmClusterResource : ArmResource
+ {
+ /// Generate the resource identifier of a instance.
+ /// The subscriptionId.
+ /// The resourceGroupName.
+ /// The cloudHsmClusterName.
+ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string cloudHsmClusterName)
+ {
+ var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}";
+ return new ResourceIdentifier(resourceId);
+ }
+
+ private readonly ClientDiagnostics _cloudHsmClusterClientDiagnostics;
+ private readonly CloudHsmClustersRestOperations _cloudHsmClusterRestClient;
+ private readonly CloudHsmClusterData _data;
+
+ /// Gets the resource type for the operations.
+ public static readonly ResourceType ResourceType = "Microsoft.HardwareSecurityModules/cloudHsmClusters";
+
+ /// Initializes a new instance of the class for mocking.
+ protected CloudHsmClusterResource()
+ {
+ }
+
+ /// Initializes a new instance of the class.
+ /// The client parameters to use in these operations.
+ /// The resource that is the target of operations.
+ internal CloudHsmClusterResource(ArmClient client, CloudHsmClusterData 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 CloudHsmClusterResource(ArmClient client, ResourceIdentifier id) : base(client, id)
+ {
+ _cloudHsmClusterClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Hardwaresecuritymodules", ResourceType.Namespace, Diagnostics);
+ TryGetApiVersion(ResourceType, out string cloudHsmClusterApiVersion);
+ _cloudHsmClusterRestClient = new CloudHsmClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, cloudHsmClusterApiVersion);
+#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 CloudHsmClusterData 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 HardwaresecuritymodulesPrivateEndpointConnectionResources in the CloudHsmCluster.
+ /// An object representing collection of HardwaresecuritymodulesPrivateEndpointConnectionResources and their operations over a HardwaresecuritymodulesPrivateEndpointConnectionResource.
+ public virtual HardwaresecuritymodulesPrivateEndpointConnectionCollection GetHardwaresecuritymodulesPrivateEndpointConnections()
+ {
+ return GetCachedClient(client => new HardwaresecuritymodulesPrivateEndpointConnectionCollection(client, Id));
+ }
+
+ ///
+ /// Gets the private endpoint connection for the Cloud Hsm Cluster.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/privateEndpointConnections/{peConnectionName}
+ ///
+ /// -
+ /// Operation Id
+ /// PrivateEndpointConnection_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// Name of the private endpoint connection associated with the Cloud HSM Cluster.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ [ForwardsClientCalls]
+ public virtual async Task> GetHardwaresecuritymodulesPrivateEndpointConnectionAsync(string peConnectionName, CancellationToken cancellationToken = default)
+ {
+ return await GetHardwaresecuritymodulesPrivateEndpointConnections().GetAsync(peConnectionName, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// Gets the private endpoint connection for the Cloud Hsm Cluster.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/privateEndpointConnections/{peConnectionName}
+ ///
+ /// -
+ /// Operation Id
+ /// PrivateEndpointConnection_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// Name of the private endpoint connection associated with the Cloud HSM Cluster.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ [ForwardsClientCalls]
+ public virtual Response GetHardwaresecuritymodulesPrivateEndpointConnection(string peConnectionName, CancellationToken cancellationToken = default)
+ {
+ return GetHardwaresecuritymodulesPrivateEndpointConnections().Get(peConnectionName, cancellationToken);
+ }
+
+ ///
+ /// Gets the specified Cloud HSM Cluster
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmCluster_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The cancellation token to use.
+ public virtual async Task> GetAsync(CancellationToken cancellationToken = default)
+ {
+ using var scope = _cloudHsmClusterClientDiagnostics.CreateScope("CloudHsmClusterResource.Get");
+ scope.Start();
+ try
+ {
+ var response = await _cloudHsmClusterRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false);
+ if (response.Value == null)
+ throw new RequestFailedException(response.GetRawResponse());
+ return Response.FromValue(new CloudHsmClusterResource(Client, response.Value), response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Gets the specified Cloud HSM Cluster
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmCluster_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The cancellation token to use.
+ public virtual Response Get(CancellationToken cancellationToken = default)
+ {
+ using var scope = _cloudHsmClusterClientDiagnostics.CreateScope("CloudHsmClusterResource.Get");
+ scope.Start();
+ try
+ {
+ var response = _cloudHsmClusterRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken);
+ if (response.Value == null)
+ throw new RequestFailedException(response.GetRawResponse());
+ return Response.FromValue(new CloudHsmClusterResource(Client, response.Value), response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Deletes the specified Cloud HSM Cluster
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmCluster_Delete
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// 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 cancellation token to use.
+ public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default)
+ {
+ using var scope = _cloudHsmClusterClientDiagnostics.CreateScope("CloudHsmClusterResource.Delete");
+ scope.Start();
+ try
+ {
+ var response = await _cloudHsmClusterRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false);
+ var operation = new HardwaresecuritymodulesArmOperation(_cloudHsmClusterClientDiagnostics, Pipeline, _cloudHsmClusterRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location);
+ if (waitUntil == WaitUntil.Completed)
+ await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false);
+ return operation;
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Deletes the specified Cloud HSM Cluster
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmCluster_Delete
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// 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 cancellation token to use.
+ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default)
+ {
+ using var scope = _cloudHsmClusterClientDiagnostics.CreateScope("CloudHsmClusterResource.Delete");
+ scope.Start();
+ try
+ {
+ var response = _cloudHsmClusterRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken);
+ var operation = new HardwaresecuritymodulesArmOperation(_cloudHsmClusterClientDiagnostics, Pipeline, _cloudHsmClusterRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location);
+ if (waitUntil == WaitUntil.Completed)
+ operation.WaitForCompletionResponse(cancellationToken);
+ return operation;
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Update a Cloud HSM Cluster in the specified subscription.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmCluster_Update
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// 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.
+ /// Parameters to create Cloud HSM Cluster.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual async Task> UpdateAsync(WaitUntil waitUntil, CloudHsmClusterPatch patch, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(patch, nameof(patch));
+
+ using var scope = _cloudHsmClusterClientDiagnostics.CreateScope("CloudHsmClusterResource.Update");
+ scope.Start();
+ try
+ {
+ var response = await _cloudHsmClusterRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false);
+ var operation = new HardwaresecuritymodulesArmOperation(new CloudHsmClusterOperationSource(Client), _cloudHsmClusterClientDiagnostics, Pipeline, _cloudHsmClusterRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location);
+ if (waitUntil == WaitUntil.Completed)
+ await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
+ return operation;
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Update a Cloud HSM Cluster in the specified subscription.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmCluster_Update
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// 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.
+ /// Parameters to create Cloud HSM Cluster.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual ArmOperation Update(WaitUntil waitUntil, CloudHsmClusterPatch patch, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(patch, nameof(patch));
+
+ using var scope = _cloudHsmClusterClientDiagnostics.CreateScope("CloudHsmClusterResource.Update");
+ scope.Start();
+ try
+ {
+ var response = _cloudHsmClusterRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken);
+ var operation = new HardwaresecuritymodulesArmOperation(new CloudHsmClusterOperationSource(Client), _cloudHsmClusterClientDiagnostics, Pipeline, _cloudHsmClusterRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location);
+ if (waitUntil == WaitUntil.Completed)
+ operation.WaitForCompletion(cancellationToken);
+ return operation;
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Pre Backup operation to validate whether the customer can perform a backup on the Cloud HSM Cluster resource in the specified subscription.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/validateBackupProperties
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmClusters_ValidateBackupProperties
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// 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.
+ /// Backup Operation Required properties.
+ /// The cancellation token to use.
+ public virtual async Task ValidateBackupPropertiesAsync(WaitUntil waitUntil, BackupRequestProperties backupRequestProperties = null, CancellationToken cancellationToken = default)
+ {
+ using var scope = _cloudHsmClusterClientDiagnostics.CreateScope("CloudHsmClusterResource.ValidateBackupProperties");
+ scope.Start();
+ try
+ {
+ var response = await _cloudHsmClusterRestClient.ValidateBackupPropertiesAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupRequestProperties, cancellationToken).ConfigureAwait(false);
+ var operation = new HardwaresecuritymodulesArmOperation(_cloudHsmClusterClientDiagnostics, Pipeline, _cloudHsmClusterRestClient.CreateValidateBackupPropertiesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupRequestProperties).Request, response, OperationFinalStateVia.AzureAsyncOperation);
+ if (waitUntil == WaitUntil.Completed)
+ await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false);
+ return operation;
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Pre Backup operation to validate whether the customer can perform a backup on the Cloud HSM Cluster resource in the specified subscription.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/validateBackupProperties
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmClusters_ValidateBackupProperties
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// 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.
+ /// Backup Operation Required properties.
+ /// The cancellation token to use.
+ public virtual ArmOperation ValidateBackupProperties(WaitUntil waitUntil, BackupRequestProperties backupRequestProperties = null, CancellationToken cancellationToken = default)
+ {
+ using var scope = _cloudHsmClusterClientDiagnostics.CreateScope("CloudHsmClusterResource.ValidateBackupProperties");
+ scope.Start();
+ try
+ {
+ var response = _cloudHsmClusterRestClient.ValidateBackupProperties(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupRequestProperties, cancellationToken);
+ var operation = new HardwaresecuritymodulesArmOperation(_cloudHsmClusterClientDiagnostics, Pipeline, _cloudHsmClusterRestClient.CreateValidateBackupPropertiesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupRequestProperties).Request, response, OperationFinalStateVia.AzureAsyncOperation);
+ if (waitUntil == WaitUntil.Completed)
+ operation.WaitForCompletionResponse(cancellationToken);
+ return operation;
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Create a backup of the Cloud HSM Cluster in the specified subscription
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/backup
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmClusters_Backup
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// 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.
+ /// Azure storage Resource Uri.
+ /// The cancellation token to use.
+ public virtual async Task BackupAsync(WaitUntil waitUntil, BackupRequestProperties backupRequestProperties = null, CancellationToken cancellationToken = default)
+ {
+ using var scope = _cloudHsmClusterClientDiagnostics.CreateScope("CloudHsmClusterResource.Backup");
+ scope.Start();
+ try
+ {
+ var response = await _cloudHsmClusterRestClient.BackupAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupRequestProperties, cancellationToken).ConfigureAwait(false);
+ var operation = new HardwaresecuritymodulesArmOperation(_cloudHsmClusterClientDiagnostics, Pipeline, _cloudHsmClusterRestClient.CreateBackupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupRequestProperties).Request, response, OperationFinalStateVia.AzureAsyncOperation);
+ if (waitUntil == WaitUntil.Completed)
+ await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false);
+ return operation;
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Create a backup of the Cloud HSM Cluster in the specified subscription
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/backup
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmClusters_Backup
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// 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.
+ /// Azure storage Resource Uri.
+ /// The cancellation token to use.
+ public virtual ArmOperation Backup(WaitUntil waitUntil, BackupRequestProperties backupRequestProperties = null, CancellationToken cancellationToken = default)
+ {
+ using var scope = _cloudHsmClusterClientDiagnostics.CreateScope("CloudHsmClusterResource.Backup");
+ scope.Start();
+ try
+ {
+ var response = _cloudHsmClusterRestClient.Backup(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupRequestProperties, cancellationToken);
+ var operation = new HardwaresecuritymodulesArmOperation(_cloudHsmClusterClientDiagnostics, Pipeline, _cloudHsmClusterRestClient.CreateBackupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupRequestProperties).Request, response, OperationFinalStateVia.AzureAsyncOperation);
+ if (waitUntil == WaitUntil.Completed)
+ operation.WaitForCompletionResponse(cancellationToken);
+ return operation;
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Queued validating pre restore operation
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/validateRestoreProperties
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmClusters_ValidateRestoreProperties
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// 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.
+ /// Optional Parameters to validate prior performing a restore operation.
+ /// The cancellation token to use.
+ public virtual async Task ValidateRestorePropertiesAsync(WaitUntil waitUntil, RestoreRequestProperties restoreRequestProperties = null, CancellationToken cancellationToken = default)
+ {
+ using var scope = _cloudHsmClusterClientDiagnostics.CreateScope("CloudHsmClusterResource.ValidateRestoreProperties");
+ scope.Start();
+ try
+ {
+ var response = await _cloudHsmClusterRestClient.ValidateRestorePropertiesAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, restoreRequestProperties, cancellationToken).ConfigureAwait(false);
+ var operation = new HardwaresecuritymodulesArmOperation(_cloudHsmClusterClientDiagnostics, Pipeline, _cloudHsmClusterRestClient.CreateValidateRestorePropertiesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, restoreRequestProperties).Request, response, OperationFinalStateVia.AzureAsyncOperation);
+ if (waitUntil == WaitUntil.Completed)
+ await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false);
+ return operation;
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Queued validating pre restore operation
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/validateRestoreProperties
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmClusters_ValidateRestoreProperties
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// 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.
+ /// Optional Parameters to validate prior performing a restore operation.
+ /// The cancellation token to use.
+ public virtual ArmOperation ValidateRestoreProperties(WaitUntil waitUntil, RestoreRequestProperties restoreRequestProperties = null, CancellationToken cancellationToken = default)
+ {
+ using var scope = _cloudHsmClusterClientDiagnostics.CreateScope("CloudHsmClusterResource.ValidateRestoreProperties");
+ scope.Start();
+ try
+ {
+ var response = _cloudHsmClusterRestClient.ValidateRestoreProperties(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, restoreRequestProperties, cancellationToken);
+ var operation = new HardwaresecuritymodulesArmOperation(_cloudHsmClusterClientDiagnostics, Pipeline, _cloudHsmClusterRestClient.CreateValidateRestorePropertiesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, restoreRequestProperties).Request, response, OperationFinalStateVia.AzureAsyncOperation);
+ if (waitUntil == WaitUntil.Completed)
+ operation.WaitForCompletionResponse(cancellationToken);
+ return operation;
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Restores all key materials of a specified Cloud HSM Cluster
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/restore
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmClusters_Restore
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// 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.
+ /// Restore Operation Required properties.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual async Task RestoreAsync(WaitUntil waitUntil, RestoreRequestProperties restoreRequestProperties, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(restoreRequestProperties, nameof(restoreRequestProperties));
+
+ using var scope = _cloudHsmClusterClientDiagnostics.CreateScope("CloudHsmClusterResource.Restore");
+ scope.Start();
+ try
+ {
+ var response = await _cloudHsmClusterRestClient.RestoreAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, restoreRequestProperties, cancellationToken).ConfigureAwait(false);
+ var operation = new HardwaresecuritymodulesArmOperation(_cloudHsmClusterClientDiagnostics, Pipeline, _cloudHsmClusterRestClient.CreateRestoreRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, restoreRequestProperties).Request, response, OperationFinalStateVia.AzureAsyncOperation);
+ if (waitUntil == WaitUntil.Completed)
+ await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false);
+ return operation;
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Restores all key materials of a specified Cloud HSM Cluster
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/restore
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmClusters_Restore
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// 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.
+ /// Restore Operation Required properties.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual ArmOperation Restore(WaitUntil waitUntil, RestoreRequestProperties restoreRequestProperties, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(restoreRequestProperties, nameof(restoreRequestProperties));
+
+ using var scope = _cloudHsmClusterClientDiagnostics.CreateScope("CloudHsmClusterResource.Restore");
+ scope.Start();
+ try
+ {
+ var response = _cloudHsmClusterRestClient.Restore(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, restoreRequestProperties, cancellationToken);
+ var operation = new HardwaresecuritymodulesArmOperation(_cloudHsmClusterClientDiagnostics, Pipeline, _cloudHsmClusterRestClient.CreateRestoreRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, restoreRequestProperties).Request, response, OperationFinalStateVia.AzureAsyncOperation);
+ if (waitUntil == WaitUntil.Completed)
+ operation.WaitForCompletionResponse(cancellationToken);
+ return operation;
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Gets the private link resources supported for the Cloud Hsm Cluster.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/privateLinkResources
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmClusters_ListByCloudHsmCluster
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The cancellation token to use.
+ /// An async collection of that may take multiple service requests to iterate over.
+ public virtual AsyncPageable GetByCloudHsmClusterAsync(CancellationToken cancellationToken = default)
+ {
+ HttpMessage FirstPageRequest(int? pageSizeHint) => _cloudHsmClusterRestClient.CreateListByCloudHsmClusterRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _cloudHsmClusterRestClient.CreateListByCloudHsmClusterNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name);
+ return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => HardwaresecuritymodulesPrivateLinkResourceData.DeserializeHardwaresecuritymodulesPrivateLinkResourceData(e), _cloudHsmClusterClientDiagnostics, Pipeline, "CloudHsmClusterResource.GetByCloudHsmCluster", "value", "nextLink", cancellationToken);
+ }
+
+ ///
+ /// Gets the private link resources supported for the Cloud Hsm Cluster.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/privateLinkResources
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmClusters_ListByCloudHsmCluster
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The cancellation token to use.
+ /// A collection of that may take multiple service requests to iterate over.
+ public virtual Pageable GetByCloudHsmCluster(CancellationToken cancellationToken = default)
+ {
+ HttpMessage FirstPageRequest(int? pageSizeHint) => _cloudHsmClusterRestClient.CreateListByCloudHsmClusterRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _cloudHsmClusterRestClient.CreateListByCloudHsmClusterNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name);
+ return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => HardwaresecuritymodulesPrivateLinkResourceData.DeserializeHardwaresecuritymodulesPrivateLinkResourceData(e), _cloudHsmClusterClientDiagnostics, Pipeline, "CloudHsmClusterResource.GetByCloudHsmCluster", "value", "nextLink", cancellationToken);
+ }
+
+ ///
+ /// Gets the backup operation status of the specified Cloud HSM Cluster
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/backupOperationStatus/{jobId}
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmClusters_CloudHsmClusterBackupStatusGet
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// Identifier for the backup operation.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ public virtual async Task> CloudHsmClusterBackupStatusGetAsync(string jobId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(jobId, nameof(jobId));
+
+ using var scope = _cloudHsmClusterClientDiagnostics.CreateScope("CloudHsmClusterResource.CloudHsmClusterBackupStatusGet");
+ scope.Start();
+ try
+ {
+ var response = await _cloudHsmClusterRestClient.CloudHsmClusterBackupStatusGetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, jobId, cancellationToken).ConfigureAwait(false);
+ return response;
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Gets the backup operation status of the specified Cloud HSM Cluster
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/backupOperationStatus/{jobId}
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmClusters_CloudHsmClusterBackupStatusGet
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// Identifier for the backup operation.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ public virtual Response CloudHsmClusterBackupStatusGet(string jobId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(jobId, nameof(jobId));
+
+ using var scope = _cloudHsmClusterClientDiagnostics.CreateScope("CloudHsmClusterResource.CloudHsmClusterBackupStatusGet");
+ scope.Start();
+ try
+ {
+ var response = _cloudHsmClusterRestClient.CloudHsmClusterBackupStatusGet(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, jobId, cancellationToken);
+ return response;
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Gets the restore operation status of the specified Cloud HSM Cluster
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/restoreOperationStatus/{jobId}
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmClusters_CloudHsmClusterRestoreStatusGet
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// Identifier for the restore operation.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ public virtual async Task> CloudHsmClusterRestoreStatusGetAsync(string jobId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(jobId, nameof(jobId));
+
+ using var scope = _cloudHsmClusterClientDiagnostics.CreateScope("CloudHsmClusterResource.CloudHsmClusterRestoreStatusGet");
+ scope.Start();
+ try
+ {
+ var response = await _cloudHsmClusterRestClient.CloudHsmClusterRestoreStatusGetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, jobId, cancellationToken).ConfigureAwait(false);
+ return response;
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Gets the restore operation status of the specified Cloud HSM Cluster
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/restoreOperationStatus/{jobId}
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmClusters_CloudHsmClusterRestoreStatusGet
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// Identifier for the restore operation.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ public virtual Response CloudHsmClusterRestoreStatusGet(string jobId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(jobId, nameof(jobId));
+
+ using var scope = _cloudHsmClusterClientDiagnostics.CreateScope("CloudHsmClusterResource.CloudHsmClusterRestoreStatusGet");
+ scope.Start();
+ try
+ {
+ var response = _cloudHsmClusterRestClient.CloudHsmClusterRestoreStatusGet(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, jobId, cancellationToken);
+ return response;
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Add a tag to the current resource.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmCluster_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// 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 = _cloudHsmClusterClientDiagnostics.CreateScope("CloudHsmClusterResource.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 _cloudHsmClusterRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false);
+ return Response.FromValue(new CloudHsmClusterResource(Client, originalResponse.Value), originalResponse.GetRawResponse());
+ }
+ else
+ {
+ var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data;
+ var patch = new CloudHsmClusterPatch();
+ 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.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmCluster_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// 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 = _cloudHsmClusterClientDiagnostics.CreateScope("CloudHsmClusterResource.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 = _cloudHsmClusterRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken);
+ return Response.FromValue(new CloudHsmClusterResource(Client, originalResponse.Value), originalResponse.GetRawResponse());
+ }
+ else
+ {
+ var current = Get(cancellationToken: cancellationToken).Value.Data;
+ var patch = new CloudHsmClusterPatch();
+ 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.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmCluster_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// 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 = _cloudHsmClusterClientDiagnostics.CreateScope("CloudHsmClusterResource.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 _cloudHsmClusterRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false);
+ return Response.FromValue(new CloudHsmClusterResource(Client, originalResponse.Value), originalResponse.GetRawResponse());
+ }
+ else
+ {
+ var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data;
+ var patch = new CloudHsmClusterPatch();
+ 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.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmCluster_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// 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 = _cloudHsmClusterClientDiagnostics.CreateScope("CloudHsmClusterResource.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 = _cloudHsmClusterRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken);
+ return Response.FromValue(new CloudHsmClusterResource(Client, originalResponse.Value), originalResponse.GetRawResponse());
+ }
+ else
+ {
+ var current = Get(cancellationToken: cancellationToken).Value.Data;
+ var patch = new CloudHsmClusterPatch();
+ 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.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmCluster_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// 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 = _cloudHsmClusterClientDiagnostics.CreateScope("CloudHsmClusterResource.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 _cloudHsmClusterRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false);
+ return Response.FromValue(new CloudHsmClusterResource(Client, originalResponse.Value), originalResponse.GetRawResponse());
+ }
+ else
+ {
+ var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data;
+ var patch = new CloudHsmClusterPatch();
+ 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.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmCluster_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// 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 = _cloudHsmClusterClientDiagnostics.CreateScope("CloudHsmClusterResource.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 = _cloudHsmClusterRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken);
+ return Response.FromValue(new CloudHsmClusterResource(Client, originalResponse.Value), originalResponse.GetRawResponse());
+ }
+ else
+ {
+ var current = Get(cancellationToken: cancellationToken).Value.Data;
+ var patch = new CloudHsmClusterPatch();
+ 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/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/DedicatedHsmCollection.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/DedicatedHsmCollection.cs
new file mode 100644
index 000000000000..4e7a4e641823
--- /dev/null
+++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/DedicatedHsmCollection.cs
@@ -0,0 +1,496 @@
+// 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.Resources;
+
+namespace Azure.ResourceManager.Hardwaresecuritymodules
+{
+ ///
+ /// 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 GetDedicatedHsms method from an instance of .
+ ///
+ public partial class DedicatedHsmCollection : ArmCollection, IEnumerable, IAsyncEnumerable
+ {
+ private readonly ClientDiagnostics _dedicatedHsmClientDiagnostics;
+ private readonly DedicatedHsmsRestOperations _dedicatedHsmRestClient;
+
+ /// Initializes a new instance of the class for mocking.
+ protected DedicatedHsmCollection()
+ {
+ }
+
+ /// 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 DedicatedHsmCollection(ArmClient client, ResourceIdentifier id) : base(client, id)
+ {
+ _dedicatedHsmClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Hardwaresecuritymodules", DedicatedHsmResource.ResourceType.Namespace, Diagnostics);
+ TryGetApiVersion(DedicatedHsmResource.ResourceType, out string dedicatedHsmApiVersion);
+ _dedicatedHsmRestClient = new DedicatedHsmsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dedicatedHsmApiVersion);
+#if DEBUG
+ ValidateResourceId(Id);
+#endif
+ }
+
+ internal static void ValidateResourceId(ResourceIdentifier id)
+ {
+ if (id.ResourceType != ResourceGroupResource.ResourceType)
+ throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id));
+ }
+
+ ///
+ /// Create or Update a dedicated HSM in the specified subscription.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// DedicatedHsm_CreateOrUpdate
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// 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.
+ /// Name of the dedicated Hsm.
+ /// Parameters to create or update the dedicated hsm.
+ /// 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 name, DedicatedHsmData data, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(name, nameof(name));
+ Argument.AssertNotNull(data, nameof(data));
+
+ using var scope = _dedicatedHsmClientDiagnostics.CreateScope("DedicatedHsmCollection.CreateOrUpdate");
+ scope.Start();
+ try
+ {
+ var response = await _dedicatedHsmRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, name, data, cancellationToken).ConfigureAwait(false);
+ var operation = new HardwaresecuritymodulesArmOperation(_dedicatedHsmClientDiagnostics, Pipeline, _dedicatedHsmRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, name, data).Request, response, OperationFinalStateVia.Location);
+ if (waitUntil == WaitUntil.Completed)
+ await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false);
+ return operation;
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Create or Update a dedicated HSM in the specified subscription.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// DedicatedHsm_CreateOrUpdate
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// 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.
+ /// Name of the dedicated Hsm.
+ /// Parameters to create or update the dedicated hsm.
+ /// 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 name, DedicatedHsmData data, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(name, nameof(name));
+ Argument.AssertNotNull(data, nameof(data));
+
+ using var scope = _dedicatedHsmClientDiagnostics.CreateScope("DedicatedHsmCollection.CreateOrUpdate");
+ scope.Start();
+ try
+ {
+ var response = _dedicatedHsmRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, name, data, cancellationToken);
+ var operation = new HardwaresecuritymodulesArmOperation(_dedicatedHsmClientDiagnostics, Pipeline, _dedicatedHsmRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, name, data).Request, response, OperationFinalStateVia.Location);
+ if (waitUntil == WaitUntil.Completed)
+ operation.WaitForCompletionResponse(cancellationToken);
+ return operation;
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Gets the specified Azure dedicated HSM.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// DedicatedHsm_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// Name of the dedicated Hsm.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ public virtual async Task> GetAsync(string name, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(name, nameof(name));
+
+ using var scope = _dedicatedHsmClientDiagnostics.CreateScope("DedicatedHsmCollection.Get");
+ scope.Start();
+ try
+ {
+ var response = await _dedicatedHsmRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken).ConfigureAwait(false);
+ if (response.Value == null)
+ throw new RequestFailedException(response.GetRawResponse());
+ return Response.FromValue(new DedicatedHsmResource(Client, response.Value), response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Gets the specified Azure dedicated HSM.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// DedicatedHsm_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// Name of the dedicated Hsm.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ public virtual Response Get(string name, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(name, nameof(name));
+
+ using var scope = _dedicatedHsmClientDiagnostics.CreateScope("DedicatedHsmCollection.Get");
+ scope.Start();
+ try
+ {
+ var response = _dedicatedHsmRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken);
+ if (response.Value == null)
+ throw new RequestFailedException(response.GetRawResponse());
+ return Response.FromValue(new DedicatedHsmResource(Client, response.Value), response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// The List operation gets information about the dedicated hsms associated with the subscription and within the specified resource group.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs
+ ///
+ /// -
+ /// Operation Id
+ /// DedicatedHsm_ListByResourceGroup
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// Maximum number of results to return.
+ /// The cancellation token to use.
+ /// An async collection of that may take multiple service requests to iterate over.
+ public virtual AsyncPageable GetAllAsync(int? top = null, CancellationToken cancellationToken = default)
+ {
+ HttpMessage FirstPageRequest(int? pageSizeHint) => _dedicatedHsmRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, top);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dedicatedHsmRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, top);
+ return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DedicatedHsmResource(Client, DedicatedHsmData.DeserializeDedicatedHsmData(e)), _dedicatedHsmClientDiagnostics, Pipeline, "DedicatedHsmCollection.GetAll", "value", "nextLink", cancellationToken);
+ }
+
+ ///
+ /// The List operation gets information about the dedicated hsms associated with the subscription and within the specified resource group.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs
+ ///
+ /// -
+ /// Operation Id
+ /// DedicatedHsm_ListByResourceGroup
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// Maximum number of results to return.
+ /// The cancellation token to use.
+ /// A collection of that may take multiple service requests to iterate over.
+ public virtual Pageable GetAll(int? top = null, CancellationToken cancellationToken = default)
+ {
+ HttpMessage FirstPageRequest(int? pageSizeHint) => _dedicatedHsmRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, top);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dedicatedHsmRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, top);
+ return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DedicatedHsmResource(Client, DedicatedHsmData.DeserializeDedicatedHsmData(e)), _dedicatedHsmClientDiagnostics, Pipeline, "DedicatedHsmCollection.GetAll", "value", "nextLink", cancellationToken);
+ }
+
+ ///
+ /// Checks to see if the resource exists in azure.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// DedicatedHsm_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// Name of the dedicated Hsm.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ public virtual async Task> ExistsAsync(string name, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(name, nameof(name));
+
+ using var scope = _dedicatedHsmClientDiagnostics.CreateScope("DedicatedHsmCollection.Exists");
+ scope.Start();
+ try
+ {
+ var response = await _dedicatedHsmRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, 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.HardwareSecurityModules/dedicatedHSMs/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// DedicatedHsm_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// Name of the dedicated Hsm.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ public virtual Response Exists(string name, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(name, nameof(name));
+
+ using var scope = _dedicatedHsmClientDiagnostics.CreateScope("DedicatedHsmCollection.Exists");
+ scope.Start();
+ try
+ {
+ var response = _dedicatedHsmRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, 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.HardwareSecurityModules/dedicatedHSMs/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// DedicatedHsm_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// Name of the dedicated Hsm.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ public virtual async Task> GetIfExistsAsync(string name, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(name, nameof(name));
+
+ using var scope = _dedicatedHsmClientDiagnostics.CreateScope("DedicatedHsmCollection.GetIfExists");
+ scope.Start();
+ try
+ {
+ var response = await _dedicatedHsmRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken).ConfigureAwait(false);
+ if (response.Value == null)
+ return new NoValueResponse(response.GetRawResponse());
+ return Response.FromValue(new DedicatedHsmResource(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.HardwareSecurityModules/dedicatedHSMs/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// DedicatedHsm_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// Name of the dedicated Hsm.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ public virtual NullableResponse GetIfExists(string name, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(name, nameof(name));
+
+ using var scope = _dedicatedHsmClientDiagnostics.CreateScope("DedicatedHsmCollection.GetIfExists");
+ scope.Start();
+ try
+ {
+ var response = _dedicatedHsmRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken);
+ if (response.Value == null)
+ return new NoValueResponse(response.GetRawResponse());
+ return Response.FromValue(new DedicatedHsmResource(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/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/DedicatedHsmData.Serialization.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/DedicatedHsmData.Serialization.cs
new file mode 100644
index 000000000000..c11840965440
--- /dev/null
+++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/DedicatedHsmData.Serialization.cs
@@ -0,0 +1,284 @@
+// 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;
+using Azure.ResourceManager.Hardwaresecuritymodules.Models;
+using Azure.ResourceManager.Models;
+
+namespace Azure.ResourceManager.Hardwaresecuritymodules
+{
+ public partial class DedicatedHsmData : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ writer.WriteStartObject();
+ JsonModelWriteCore(writer, options);
+ writer.WriteEndObject();
+ }
+
+ /// The JSON writer.
+ /// The client options for reading and writing models.
+ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(DedicatedHsmData)} does not support writing '{format}' format.");
+ }
+
+ base.JsonModelWriteCore(writer, options);
+ writer.WritePropertyName("sku"u8);
+ writer.WriteObjectValue(Sku, options);
+ if (Optional.IsCollectionDefined(Zones))
+ {
+ writer.WritePropertyName("zones"u8);
+ writer.WriteStartArray();
+ foreach (var item in Zones)
+ {
+ writer.WriteStringValue(item);
+ }
+ writer.WriteEndArray();
+ }
+ writer.WritePropertyName("properties"u8);
+ writer.WriteStartObject();
+ if (Optional.IsDefined(NetworkProfile))
+ {
+ writer.WritePropertyName("networkProfile"u8);
+ writer.WriteObjectValue(NetworkProfile, options);
+ }
+ if (Optional.IsDefined(ManagementNetworkProfile))
+ {
+ writer.WritePropertyName("managementNetworkProfile"u8);
+ writer.WriteObjectValue(ManagementNetworkProfile, options);
+ }
+ if (Optional.IsDefined(StampId))
+ {
+ writer.WritePropertyName("stampId"u8);
+ writer.WriteStringValue(StampId);
+ }
+ if (options.Format != "W" && Optional.IsDefined(StatusMessage))
+ {
+ writer.WritePropertyName("statusMessage"u8);
+ writer.WriteStringValue(StatusMessage);
+ }
+ if (options.Format != "W" && Optional.IsDefined(ProvisioningState))
+ {
+ writer.WritePropertyName("provisioningState"u8);
+ writer.WriteStringValue(ProvisioningState.Value.ToString());
+ }
+ writer.WriteEndObject();
+ }
+
+ DedicatedHsmData 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(DedicatedHsmData)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeDedicatedHsmData(document.RootElement, options);
+ }
+
+ internal static DedicatedHsmData DeserializeDedicatedHsmData(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ HardwaresecuritymodulesSku sku = default;
+ IList zones = default;
+ IDictionary tags = default;
+ AzureLocation location = default;
+ ResourceIdentifier id = default;
+ string name = default;
+ ResourceType type = default;
+ SystemData systemData = default;
+ NetworkProfile networkProfile = default;
+ NetworkProfile managementNetworkProfile = default;
+ string stampId = default;
+ string statusMessage = default;
+ JsonWebKeyType? provisioningState = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("sku"u8))
+ {
+ sku = HardwaresecuritymodulesSku.DeserializeHardwaresecuritymodulesSku(property.Value, options);
+ continue;
+ }
+ if (property.NameEquals("zones"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ List array = new List();
+ foreach (var item in property.Value.EnumerateArray())
+ {
+ array.Add(item.GetString());
+ }
+ zones = array;
+ 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("location"u8))
+ {
+ location = new AzureLocation(property.Value.GetString());
+ 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("networkProfile"u8))
+ {
+ if (property0.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ networkProfile = NetworkProfile.DeserializeNetworkProfile(property0.Value, options);
+ continue;
+ }
+ if (property0.NameEquals("managementNetworkProfile"u8))
+ {
+ if (property0.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ managementNetworkProfile = NetworkProfile.DeserializeNetworkProfile(property0.Value, options);
+ continue;
+ }
+ if (property0.NameEquals("stampId"u8))
+ {
+ stampId = property0.Value.GetString();
+ continue;
+ }
+ if (property0.NameEquals("statusMessage"u8))
+ {
+ statusMessage = property0.Value.GetString();
+ continue;
+ }
+ if (property0.NameEquals("provisioningState"u8))
+ {
+ if (property0.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ provisioningState = new JsonWebKeyType(property0.Value.GetString());
+ continue;
+ }
+ }
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new DedicatedHsmData(
+ id,
+ name,
+ type,
+ systemData,
+ tags ?? new ChangeTrackingDictionary(),
+ location,
+ sku,
+ zones ?? new ChangeTrackingList(),
+ networkProfile,
+ managementNetworkProfile,
+ stampId,
+ statusMessage,
+ provisioningState,
+ 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, AzureResourceManagerHardwaresecuritymodulesContext.Default);
+ default:
+ throw new FormatException($"The model {nameof(DedicatedHsmData)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ DedicatedHsmData 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, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeDedicatedHsmData(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(DedicatedHsmData)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+ }
+}
diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/DedicatedHsmData.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/DedicatedHsmData.cs
new file mode 100644
index 000000000000..7b153f435885
--- /dev/null
+++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/DedicatedHsmData.cs
@@ -0,0 +1,125 @@
+// 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.Hardwaresecuritymodules.Models;
+using Azure.ResourceManager.Models;
+
+namespace Azure.ResourceManager.Hardwaresecuritymodules
+{
+ ///
+ /// A class representing the DedicatedHsm data model.
+ /// Resource information with extended details.
+ ///
+ public partial class DedicatedHsmData : TrackedResourceData
+ {
+ ///
+ /// 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 location.
+ /// SKU details.
+ /// is null.
+ public DedicatedHsmData(AzureLocation location, HardwaresecuritymodulesSku sku) : base(location)
+ {
+ Argument.AssertNotNull(sku, nameof(sku));
+
+ Sku = sku;
+ Zones = new ChangeTrackingList();
+ }
+
+ /// Initializes a new instance of .
+ /// The id.
+ /// The name.
+ /// The resourceType.
+ /// The systemData.
+ /// The tags.
+ /// The location.
+ /// SKU details.
+ /// The availability zones.
+ /// Specifies the network interfaces of the dedicated hsm.
+ /// Specifies the management network interfaces of the dedicated hsm.
+ /// This field will be used when RP does not support Availability zones.
+ /// Resource Status Message.
+ /// Provisioning state.
+ /// Keeps track of any properties unknown to the library.
+ internal DedicatedHsmData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, HardwaresecuritymodulesSku sku, IList zones, NetworkProfile networkProfile, NetworkProfile managementNetworkProfile, string stampId, string statusMessage, JsonWebKeyType? provisioningState, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location)
+ {
+ Sku = sku;
+ Zones = zones;
+ NetworkProfile = networkProfile;
+ ManagementNetworkProfile = managementNetworkProfile;
+ StampId = stampId;
+ StatusMessage = statusMessage;
+ ProvisioningState = provisioningState;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal DedicatedHsmData()
+ {
+ }
+
+ /// SKU details.
+ internal HardwaresecuritymodulesSku Sku { get; set; }
+ /// SKU of the dedicated HSM.
+ public HardwaresecuritymodulesSkuName? SkuName
+ {
+ get => Sku is null ? default : Sku.Name;
+ set
+ {
+ if (Sku is null)
+ Sku = new HardwaresecuritymodulesSku();
+ Sku.Name = value;
+ }
+ }
+
+ /// The availability zones.
+ public IList Zones { get; }
+ /// Specifies the network interfaces of the dedicated hsm.
+ public NetworkProfile NetworkProfile { get; set; }
+ /// Specifies the management network interfaces of the dedicated hsm.
+ public NetworkProfile ManagementNetworkProfile { get; set; }
+ /// This field will be used when RP does not support Availability zones.
+ public string StampId { get; set; }
+ /// Resource Status Message.
+ public string StatusMessage { get; }
+ /// Provisioning state.
+ public JsonWebKeyType? ProvisioningState { get; }
+ }
+}
diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/DedicatedHsmResource.Serialization.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/DedicatedHsmResource.Serialization.cs
new file mode 100644
index 000000000000..eefbc1c00e2d
--- /dev/null
+++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/DedicatedHsmResource.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.Hardwaresecuritymodules
+{
+ public partial class DedicatedHsmResource : IJsonModel
+ {
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options);
+
+ DedicatedHsmData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options);
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerHardwaresecuritymodulesContext.Default);
+
+ DedicatedHsmData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerHardwaresecuritymodulesContext.Default);
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options);
+ }
+}
diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/DedicatedHsmResource.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/DedicatedHsmResource.cs
new file mode 100644
index 000000000000..7efa7fefad9a
--- /dev/null
+++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/DedicatedHsmResource.cs
@@ -0,0 +1,768 @@
+// 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 Autorest.CSharp.Core;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.ResourceManager.Hardwaresecuritymodules.Models;
+using Azure.ResourceManager.Resources;
+
+namespace Azure.ResourceManager.Hardwaresecuritymodules
+{
+ ///
+ /// A Class representing a DedicatedHsm 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 GetDedicatedHsmResource method.
+ /// Otherwise you can get one from its parent resource using the GetDedicatedHsm method.
+ ///
+ public partial class DedicatedHsmResource : ArmResource
+ {
+ /// Generate the resource identifier of a instance.
+ /// The subscriptionId.
+ /// The resourceGroupName.
+ /// The name.
+ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name)
+ {
+ var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}";
+ return new ResourceIdentifier(resourceId);
+ }
+
+ private readonly ClientDiagnostics _dedicatedHsmClientDiagnostics;
+ private readonly DedicatedHsmsRestOperations _dedicatedHsmRestClient;
+ private readonly DedicatedHsmData _data;
+
+ /// Gets the resource type for the operations.
+ public static readonly ResourceType ResourceType = "Microsoft.HardwareSecurityModules/dedicatedHSMs";
+
+ /// Initializes a new instance of the class for mocking.
+ protected DedicatedHsmResource()
+ {
+ }
+
+ /// Initializes a new instance of the class.
+ /// The client parameters to use in these operations.
+ /// The resource that is the target of operations.
+ internal DedicatedHsmResource(ArmClient client, DedicatedHsmData 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 DedicatedHsmResource(ArmClient client, ResourceIdentifier id) : base(client, id)
+ {
+ _dedicatedHsmClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Hardwaresecuritymodules", ResourceType.Namespace, Diagnostics);
+ TryGetApiVersion(ResourceType, out string dedicatedHsmApiVersion);
+ _dedicatedHsmRestClient = new DedicatedHsmsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dedicatedHsmApiVersion);
+#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 DedicatedHsmData 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 Azure dedicated HSM.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// DedicatedHsm_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The cancellation token to use.
+ public virtual async Task> GetAsync(CancellationToken cancellationToken = default)
+ {
+ using var scope = _dedicatedHsmClientDiagnostics.CreateScope("DedicatedHsmResource.Get");
+ scope.Start();
+ try
+ {
+ var response = await _dedicatedHsmRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false);
+ if (response.Value == null)
+ throw new RequestFailedException(response.GetRawResponse());
+ return Response.FromValue(new DedicatedHsmResource(Client, response.Value), response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Gets the specified Azure dedicated HSM.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// DedicatedHsm_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The cancellation token to use.
+ public virtual Response Get(CancellationToken cancellationToken = default)
+ {
+ using var scope = _dedicatedHsmClientDiagnostics.CreateScope("DedicatedHsmResource.Get");
+ scope.Start();
+ try
+ {
+ var response = _dedicatedHsmRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken);
+ if (response.Value == null)
+ throw new RequestFailedException(response.GetRawResponse());
+ return Response.FromValue(new DedicatedHsmResource(Client, response.Value), response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Deletes the specified Azure Dedicated HSM.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// DedicatedHsm_Delete
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// 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 cancellation token to use.
+ public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default)
+ {
+ using var scope = _dedicatedHsmClientDiagnostics.CreateScope("DedicatedHsmResource.Delete");
+ scope.Start();
+ try
+ {
+ var response = await _dedicatedHsmRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false);
+ var operation = new HardwaresecuritymodulesArmOperation(_dedicatedHsmClientDiagnostics, Pipeline, _dedicatedHsmRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location);
+ if (waitUntil == WaitUntil.Completed)
+ await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false);
+ return operation;
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Deletes the specified Azure Dedicated HSM.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// DedicatedHsm_Delete
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// 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 cancellation token to use.
+ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default)
+ {
+ using var scope = _dedicatedHsmClientDiagnostics.CreateScope("DedicatedHsmResource.Delete");
+ scope.Start();
+ try
+ {
+ var response = _dedicatedHsmRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken);
+ var operation = new HardwaresecuritymodulesArmOperation(_dedicatedHsmClientDiagnostics, Pipeline, _dedicatedHsmRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location);
+ if (waitUntil == WaitUntil.Completed)
+ operation.WaitForCompletionResponse(cancellationToken);
+ return operation;
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Update a dedicated HSM in the specified subscription.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// DedicatedHsm_Update
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// 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.
+ /// Parameters to patch the dedicated HSM.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual async Task> UpdateAsync(WaitUntil waitUntil, DedicatedHsmPatch patch, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(patch, nameof(patch));
+
+ using var scope = _dedicatedHsmClientDiagnostics.CreateScope("DedicatedHsmResource.Update");
+ scope.Start();
+ try
+ {
+ var response = await _dedicatedHsmRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false);
+ var operation = new HardwaresecuritymodulesArmOperation(new DedicatedHsmOperationSource(Client), _dedicatedHsmClientDiagnostics, Pipeline, _dedicatedHsmRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location);
+ if (waitUntil == WaitUntil.Completed)
+ await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
+ return operation;
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Update a dedicated HSM in the specified subscription.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// DedicatedHsm_Update
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// 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.
+ /// Parameters to patch the dedicated HSM.
+ /// The cancellation token to use.
+ /// is null.
+ public virtual ArmOperation Update(WaitUntil waitUntil, DedicatedHsmPatch patch, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(patch, nameof(patch));
+
+ using var scope = _dedicatedHsmClientDiagnostics.CreateScope("DedicatedHsmResource.Update");
+ scope.Start();
+ try
+ {
+ var response = _dedicatedHsmRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken);
+ var operation = new HardwaresecuritymodulesArmOperation(new DedicatedHsmOperationSource(Client), _dedicatedHsmClientDiagnostics, Pipeline, _dedicatedHsmRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location);
+ if (waitUntil == WaitUntil.Completed)
+ operation.WaitForCompletion(cancellationToken);
+ return operation;
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified dedicated hsm resource. The operation returns properties of each egress endpoint.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}/outboundNetworkDependenciesEndpoints
+ ///
+ /// -
+ /// Operation Id
+ /// DedicatedHsms_ListOutboundNetworkDependenciesEndpoints
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The cancellation token to use.
+ /// An async collection of that may take multiple service requests to iterate over.
+ public virtual AsyncPageable GetOutboundNetworkDependenciesEndpointsAsync(CancellationToken cancellationToken = default)
+ {
+ HttpMessage FirstPageRequest(int? pageSizeHint) => _dedicatedHsmRestClient.CreateListOutboundNetworkDependenciesEndpointsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dedicatedHsmRestClient.CreateListOutboundNetworkDependenciesEndpointsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name);
+ return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => OutboundEnvironmentEndpoint.DeserializeOutboundEnvironmentEndpoint(e), _dedicatedHsmClientDiagnostics, Pipeline, "DedicatedHsmResource.GetOutboundNetworkDependenciesEndpoints", "value", "nextLink", cancellationToken);
+ }
+
+ ///
+ /// Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified dedicated hsm resource. The operation returns properties of each egress endpoint.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}/outboundNetworkDependenciesEndpoints
+ ///
+ /// -
+ /// Operation Id
+ /// DedicatedHsms_ListOutboundNetworkDependenciesEndpoints
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The cancellation token to use.
+ /// A collection of that may take multiple service requests to iterate over.
+ public virtual Pageable GetOutboundNetworkDependenciesEndpoints(CancellationToken cancellationToken = default)
+ {
+ HttpMessage FirstPageRequest(int? pageSizeHint) => _dedicatedHsmRestClient.CreateListOutboundNetworkDependenciesEndpointsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dedicatedHsmRestClient.CreateListOutboundNetworkDependenciesEndpointsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name);
+ return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => OutboundEnvironmentEndpoint.DeserializeOutboundEnvironmentEndpoint(e), _dedicatedHsmClientDiagnostics, Pipeline, "DedicatedHsmResource.GetOutboundNetworkDependenciesEndpoints", "value", "nextLink", cancellationToken);
+ }
+
+ ///
+ /// Add a tag to the current resource.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// DedicatedHsm_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// 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 = _dedicatedHsmClientDiagnostics.CreateScope("DedicatedHsmResource.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 _dedicatedHsmRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false);
+ return Response.FromValue(new DedicatedHsmResource(Client, originalResponse.Value), originalResponse.GetRawResponse());
+ }
+ else
+ {
+ var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data;
+ var patch = new DedicatedHsmPatch();
+ 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.HardwareSecurityModules/dedicatedHSMs/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// DedicatedHsm_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// 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 = _dedicatedHsmClientDiagnostics.CreateScope("DedicatedHsmResource.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 = _dedicatedHsmRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken);
+ return Response.FromValue(new DedicatedHsmResource(Client, originalResponse.Value), originalResponse.GetRawResponse());
+ }
+ else
+ {
+ var current = Get(cancellationToken: cancellationToken).Value.Data;
+ var patch = new DedicatedHsmPatch();
+ 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.HardwareSecurityModules/dedicatedHSMs/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// DedicatedHsm_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// 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 = _dedicatedHsmClientDiagnostics.CreateScope("DedicatedHsmResource.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 _dedicatedHsmRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false);
+ return Response.FromValue(new DedicatedHsmResource(Client, originalResponse.Value), originalResponse.GetRawResponse());
+ }
+ else
+ {
+ var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data;
+ var patch = new DedicatedHsmPatch();
+ 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.HardwareSecurityModules/dedicatedHSMs/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// DedicatedHsm_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// 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 = _dedicatedHsmClientDiagnostics.CreateScope("DedicatedHsmResource.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 = _dedicatedHsmRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken);
+ return Response.FromValue(new DedicatedHsmResource(Client, originalResponse.Value), originalResponse.GetRawResponse());
+ }
+ else
+ {
+ var current = Get(cancellationToken: cancellationToken).Value.Data;
+ var patch = new DedicatedHsmPatch();
+ 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.HardwareSecurityModules/dedicatedHSMs/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// DedicatedHsm_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// 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 = _dedicatedHsmClientDiagnostics.CreateScope("DedicatedHsmResource.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 _dedicatedHsmRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false);
+ return Response.FromValue(new DedicatedHsmResource(Client, originalResponse.Value), originalResponse.GetRawResponse());
+ }
+ else
+ {
+ var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data;
+ var patch = new DedicatedHsmPatch();
+ 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.HardwareSecurityModules/dedicatedHSMs/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// DedicatedHsm_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// 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 = _dedicatedHsmClientDiagnostics.CreateScope("DedicatedHsmResource.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 = _dedicatedHsmRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken);
+ return Response.FromValue(new DedicatedHsmResource(Client, originalResponse.Value), originalResponse.GetRawResponse());
+ }
+ else
+ {
+ var current = Get(cancellationToken: cancellationToken).Value.Data;
+ var patch = new DedicatedHsmPatch();
+ 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/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/Extensions/HardwaresecuritymodulesExtensions.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/Extensions/HardwaresecuritymodulesExtensions.cs
new file mode 100644
index 000000000000..5cb1e8dbe63f
--- /dev/null
+++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/Extensions/HardwaresecuritymodulesExtensions.cs
@@ -0,0 +1,426 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure.Core;
+using Azure.ResourceManager.Hardwaresecuritymodules.Mocking;
+using Azure.ResourceManager.Resources;
+
+namespace Azure.ResourceManager.Hardwaresecuritymodules
+{
+ /// A class to add extension methods to Azure.ResourceManager.Hardwaresecuritymodules.
+ public static partial class HardwaresecuritymodulesExtensions
+ {
+ private static MockableHardwaresecuritymodulesArmClient GetMockableHardwaresecuritymodulesArmClient(ArmClient client)
+ {
+ return client.GetCachedClient(client0 => new MockableHardwaresecuritymodulesArmClient(client0));
+ }
+
+ private static MockableHardwaresecuritymodulesResourceGroupResource GetMockableHardwaresecuritymodulesResourceGroupResource(ArmResource resource)
+ {
+ return resource.GetCachedClient(client => new MockableHardwaresecuritymodulesResourceGroupResource(client, resource.Id));
+ }
+
+ private static MockableHardwaresecuritymodulesSubscriptionResource GetMockableHardwaresecuritymodulesSubscriptionResource(ArmResource resource)
+ {
+ return resource.GetCachedClient(client => new MockableHardwaresecuritymodulesSubscriptionResource(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 CloudHsmClusterResource GetCloudHsmClusterResource(this ArmClient client, ResourceIdentifier id)
+ {
+ Argument.AssertNotNull(client, nameof(client));
+
+ return GetMockableHardwaresecuritymodulesArmClient(client).GetCloudHsmClusterResource(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 HardwaresecuritymodulesPrivateEndpointConnectionResource GetHardwaresecuritymodulesPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id)
+ {
+ Argument.AssertNotNull(client, nameof(client));
+
+ return GetMockableHardwaresecuritymodulesArmClient(client).GetHardwaresecuritymodulesPrivateEndpointConnectionResource(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 DedicatedHsmResource GetDedicatedHsmResource(this ArmClient client, ResourceIdentifier id)
+ {
+ Argument.AssertNotNull(client, nameof(client));
+
+ return GetMockableHardwaresecuritymodulesArmClient(client).GetDedicatedHsmResource(id);
+ }
+
+ ///
+ /// Gets a collection of CloudHsmClusterResources in the ResourceGroupResource.
+ /// -
+ /// Mocking
+ /// To mock this method, please mock instead.
+ ///
+ ///
+ /// The instance the method will execute against.
+ /// is null.
+ /// An object representing collection of CloudHsmClusterResources and their operations over a CloudHsmClusterResource.
+ public static CloudHsmClusterCollection GetCloudHsmClusters(this ResourceGroupResource resourceGroupResource)
+ {
+ Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource));
+
+ return GetMockableHardwaresecuritymodulesResourceGroupResource(resourceGroupResource).GetCloudHsmClusters();
+ }
+
+ ///
+ /// Gets the specified Cloud HSM Cluster
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmCluster_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ /// -
+ /// Mocking
+ /// To mock this method, please mock instead.
+ ///
+ ///
+ /// The instance the method will execute against.
+ /// The name of the Cloud HSM Cluster within the specified resource group. Cloud HSM Cluster names must be between 3 and 23 characters in length.
+ /// The cancellation token to use.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ [ForwardsClientCalls]
+ public static async Task> GetCloudHsmClusterAsync(this ResourceGroupResource resourceGroupResource, string cloudHsmClusterName, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource));
+
+ return await GetMockableHardwaresecuritymodulesResourceGroupResource(resourceGroupResource).GetCloudHsmClusterAsync(cloudHsmClusterName, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// Gets the specified Cloud HSM Cluster
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmCluster_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ /// -
+ /// Mocking
+ /// To mock this method, please mock instead.
+ ///
+ ///
+ /// The instance the method will execute against.
+ /// The name of the Cloud HSM Cluster within the specified resource group. Cloud HSM Cluster names must be between 3 and 23 characters in length.
+ /// The cancellation token to use.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ [ForwardsClientCalls]
+ public static Response GetCloudHsmCluster(this ResourceGroupResource resourceGroupResource, string cloudHsmClusterName, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource));
+
+ return GetMockableHardwaresecuritymodulesResourceGroupResource(resourceGroupResource).GetCloudHsmCluster(cloudHsmClusterName, cancellationToken);
+ }
+
+ ///
+ /// Gets a collection of DedicatedHsmResources in the ResourceGroupResource.
+ /// -
+ /// Mocking
+ /// To mock this method, please mock instead.
+ ///
+ ///
+ /// The instance the method will execute against.
+ /// is null.
+ /// An object representing collection of DedicatedHsmResources and their operations over a DedicatedHsmResource.
+ public static DedicatedHsmCollection GetDedicatedHsms(this ResourceGroupResource resourceGroupResource)
+ {
+ Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource));
+
+ return GetMockableHardwaresecuritymodulesResourceGroupResource(resourceGroupResource).GetDedicatedHsms();
+ }
+
+ ///
+ /// Gets the specified Azure dedicated HSM.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// DedicatedHsm_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ /// -
+ /// Mocking
+ /// To mock this method, please mock instead.
+ ///
+ ///
+ /// The instance the method will execute against.
+ /// Name of the dedicated Hsm.
+ /// The cancellation token to use.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ [ForwardsClientCalls]
+ public static async Task> GetDedicatedHsmAsync(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource));
+
+ return await GetMockableHardwaresecuritymodulesResourceGroupResource(resourceGroupResource).GetDedicatedHsmAsync(name, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// Gets the specified Azure dedicated HSM.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// DedicatedHsm_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ /// -
+ /// Mocking
+ /// To mock this method, please mock instead.
+ ///
+ ///
+ /// The instance the method will execute against.
+ /// Name of the dedicated Hsm.
+ /// The cancellation token to use.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ [ForwardsClientCalls]
+ public static Response GetDedicatedHsm(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource));
+
+ return GetMockableHardwaresecuritymodulesResourceGroupResource(resourceGroupResource).GetDedicatedHsm(name, cancellationToken);
+ }
+
+ ///
+ /// The List operation gets information about the Cloud HSM Clusters associated with the subscription.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmCluster_ListBySubscription
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ /// -
+ /// Mocking
+ /// To mock this method, please mock instead.
+ ///
+ ///
+ /// The instance the method will execute against.
+ /// The page-continuation token to use with a paged version of this API.
+ /// The cancellation token to use.
+ /// is null.
+ /// An async collection of that may take multiple service requests to iterate over.
+ public static AsyncPageable GetCloudHsmClustersAsync(this SubscriptionResource subscriptionResource, string skiptoken = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource));
+
+ return GetMockableHardwaresecuritymodulesSubscriptionResource(subscriptionResource).GetCloudHsmClustersAsync(skiptoken, cancellationToken);
+ }
+
+ ///
+ /// The List operation gets information about the Cloud HSM Clusters associated with the subscription.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmCluster_ListBySubscription
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ /// -
+ /// Mocking
+ /// To mock this method, please mock instead.
+ ///
+ ///
+ /// The instance the method will execute against.
+ /// The page-continuation token to use with a paged version of this API.
+ /// The cancellation token to use.
+ /// is null.
+ /// A collection of that may take multiple service requests to iterate over.
+ public static Pageable GetCloudHsmClusters(this SubscriptionResource subscriptionResource, string skiptoken = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource));
+
+ return GetMockableHardwaresecuritymodulesSubscriptionResource(subscriptionResource).GetCloudHsmClusters(skiptoken, cancellationToken);
+ }
+
+ ///
+ /// The List operation gets information about the dedicated HSMs associated with the subscription.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs
+ ///
+ /// -
+ /// Operation Id
+ /// DedicatedHsm_ListBySubscription
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ /// -
+ /// Mocking
+ /// To mock this method, please mock instead.
+ ///
+ ///
+ /// The instance the method will execute against.
+ /// Maximum number of results to return.
+ /// The cancellation token to use.
+ /// is null.
+ /// An async collection of that may take multiple service requests to iterate over.
+ public static AsyncPageable GetDedicatedHsmsAsync(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource));
+
+ return GetMockableHardwaresecuritymodulesSubscriptionResource(subscriptionResource).GetDedicatedHsmsAsync(top, cancellationToken);
+ }
+
+ ///
+ /// The List operation gets information about the dedicated HSMs associated with the subscription.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs
+ ///
+ /// -
+ /// Operation Id
+ /// DedicatedHsm_ListBySubscription
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ /// -
+ /// Mocking
+ /// To mock this method, please mock instead.
+ ///
+ ///
+ /// The instance the method will execute against.
+ /// Maximum number of results to return.
+ /// The cancellation token to use.
+ /// is null.
+ /// A collection of that may take multiple service requests to iterate over.
+ public static Pageable GetDedicatedHsms(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource));
+
+ return GetMockableHardwaresecuritymodulesSubscriptionResource(subscriptionResource).GetDedicatedHsms(top, cancellationToken);
+ }
+ }
+}
diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/Extensions/MockableHardwaresecuritymodulesArmClient.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/Extensions/MockableHardwaresecuritymodulesArmClient.cs
new file mode 100644
index 000000000000..0dae8b9b1881
--- /dev/null
+++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/Extensions/MockableHardwaresecuritymodulesArmClient.cs
@@ -0,0 +1,73 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using Azure.Core;
+
+namespace Azure.ResourceManager.Hardwaresecuritymodules.Mocking
+{
+ /// A class to add extension methods to ArmClient.
+ public partial class MockableHardwaresecuritymodulesArmClient : ArmResource
+ {
+ /// Initializes a new instance of the class for mocking.
+ protected MockableHardwaresecuritymodulesArmClient()
+ {
+ }
+
+ /// 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 MockableHardwaresecuritymodulesArmClient(ArmClient client, ResourceIdentifier id) : base(client, id)
+ {
+ }
+
+ internal MockableHardwaresecuritymodulesArmClient(ArmClient client) : this(client, ResourceIdentifier.Root)
+ {
+ }
+
+ private string GetApiVersionOrNull(ResourceType resourceType)
+ {
+ TryGetApiVersion(resourceType, out string apiVersion);
+ 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 CloudHsmClusterResource GetCloudHsmClusterResource(ResourceIdentifier id)
+ {
+ CloudHsmClusterResource.ValidateResourceId(id);
+ return new CloudHsmClusterResource(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 HardwaresecuritymodulesPrivateEndpointConnectionResource GetHardwaresecuritymodulesPrivateEndpointConnectionResource(ResourceIdentifier id)
+ {
+ HardwaresecuritymodulesPrivateEndpointConnectionResource.ValidateResourceId(id);
+ return new HardwaresecuritymodulesPrivateEndpointConnectionResource(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 DedicatedHsmResource GetDedicatedHsmResource(ResourceIdentifier id)
+ {
+ DedicatedHsmResource.ValidateResourceId(id);
+ return new DedicatedHsmResource(Client, id);
+ }
+ }
+}
diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/Extensions/MockableHardwaresecuritymodulesResourceGroupResource.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/Extensions/MockableHardwaresecuritymodulesResourceGroupResource.cs
new file mode 100644
index 000000000000..760b6e5e29d6
--- /dev/null
+++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/Extensions/MockableHardwaresecuritymodulesResourceGroupResource.cs
@@ -0,0 +1,174 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure.Core;
+
+namespace Azure.ResourceManager.Hardwaresecuritymodules.Mocking
+{
+ /// A class to add extension methods to ResourceGroupResource.
+ public partial class MockableHardwaresecuritymodulesResourceGroupResource : ArmResource
+ {
+ /// Initializes a new instance of the class for mocking.
+ protected MockableHardwaresecuritymodulesResourceGroupResource()
+ {
+ }
+
+ /// 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 MockableHardwaresecuritymodulesResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id)
+ {
+ }
+
+ private string GetApiVersionOrNull(ResourceType resourceType)
+ {
+ TryGetApiVersion(resourceType, out string apiVersion);
+ return apiVersion;
+ }
+
+ /// Gets a collection of CloudHsmClusterResources in the ResourceGroupResource.
+ /// An object representing collection of CloudHsmClusterResources and their operations over a CloudHsmClusterResource.
+ public virtual CloudHsmClusterCollection GetCloudHsmClusters()
+ {
+ return GetCachedClient(client => new CloudHsmClusterCollection(client, Id));
+ }
+
+ ///
+ /// Gets the specified Cloud HSM Cluster
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmCluster_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The name of the Cloud HSM Cluster within the specified resource group. Cloud HSM Cluster names must be between 3 and 23 characters in length.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ [ForwardsClientCalls]
+ public virtual async Task> GetCloudHsmClusterAsync(string cloudHsmClusterName, CancellationToken cancellationToken = default)
+ {
+ return await GetCloudHsmClusters().GetAsync(cloudHsmClusterName, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// Gets the specified Cloud HSM Cluster
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmCluster_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The name of the Cloud HSM Cluster within the specified resource group. Cloud HSM Cluster names must be between 3 and 23 characters in length.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ [ForwardsClientCalls]
+ public virtual Response GetCloudHsmCluster(string cloudHsmClusterName, CancellationToken cancellationToken = default)
+ {
+ return GetCloudHsmClusters().Get(cloudHsmClusterName, cancellationToken);
+ }
+
+ /// Gets a collection of DedicatedHsmResources in the ResourceGroupResource.
+ /// An object representing collection of DedicatedHsmResources and their operations over a DedicatedHsmResource.
+ public virtual DedicatedHsmCollection GetDedicatedHsms()
+ {
+ return GetCachedClient(client => new DedicatedHsmCollection(client, Id));
+ }
+
+ ///
+ /// Gets the specified Azure dedicated HSM.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// DedicatedHsm_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// Name of the dedicated Hsm.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ [ForwardsClientCalls]
+ public virtual async Task> GetDedicatedHsmAsync(string name, CancellationToken cancellationToken = default)
+ {
+ return await GetDedicatedHsms().GetAsync(name, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// Gets the specified Azure dedicated HSM.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}
+ ///
+ /// -
+ /// Operation Id
+ /// DedicatedHsm_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// Name of the dedicated Hsm.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ [ForwardsClientCalls]
+ public virtual Response GetDedicatedHsm(string name, CancellationToken cancellationToken = default)
+ {
+ return GetDedicatedHsms().Get(name, cancellationToken);
+ }
+ }
+}
diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/Extensions/MockableHardwaresecuritymodulesSubscriptionResource.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/Extensions/MockableHardwaresecuritymodulesSubscriptionResource.cs
new file mode 100644
index 000000000000..0931644f3844
--- /dev/null
+++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/Extensions/MockableHardwaresecuritymodulesSubscriptionResource.cs
@@ -0,0 +1,170 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Threading;
+using Autorest.CSharp.Core;
+using Azure.Core;
+using Azure.Core.Pipeline;
+
+namespace Azure.ResourceManager.Hardwaresecuritymodules.Mocking
+{
+ /// A class to add extension methods to SubscriptionResource.
+ public partial class MockableHardwaresecuritymodulesSubscriptionResource : ArmResource
+ {
+ private ClientDiagnostics _cloudHsmClusterClientDiagnostics;
+ private CloudHsmClustersRestOperations _cloudHsmClusterRestClient;
+ private ClientDiagnostics _dedicatedHsmClientDiagnostics;
+ private DedicatedHsmsRestOperations _dedicatedHsmRestClient;
+
+ /// Initializes a new instance of the class for mocking.
+ protected MockableHardwaresecuritymodulesSubscriptionResource()
+ {
+ }
+
+ /// 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 MockableHardwaresecuritymodulesSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id)
+ {
+ }
+
+ private ClientDiagnostics CloudHsmClusterClientDiagnostics => _cloudHsmClusterClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Hardwaresecuritymodules", CloudHsmClusterResource.ResourceType.Namespace, Diagnostics);
+ private CloudHsmClustersRestOperations CloudHsmClusterRestClient => _cloudHsmClusterRestClient ??= new CloudHsmClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(CloudHsmClusterResource.ResourceType));
+ private ClientDiagnostics DedicatedHsmClientDiagnostics => _dedicatedHsmClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Hardwaresecuritymodules", DedicatedHsmResource.ResourceType.Namespace, Diagnostics);
+ private DedicatedHsmsRestOperations DedicatedHsmRestClient => _dedicatedHsmRestClient ??= new DedicatedHsmsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DedicatedHsmResource.ResourceType));
+
+ private string GetApiVersionOrNull(ResourceType resourceType)
+ {
+ TryGetApiVersion(resourceType, out string apiVersion);
+ return apiVersion;
+ }
+
+ ///
+ /// The List operation gets information about the Cloud HSM Clusters associated with the subscription.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmCluster_ListBySubscription
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The page-continuation token to use with a paged version of this API.
+ /// The cancellation token to use.
+ /// An async collection of that may take multiple service requests to iterate over.
+ public virtual AsyncPageable GetCloudHsmClustersAsync(string skiptoken = null, CancellationToken cancellationToken = default)
+ {
+ HttpMessage FirstPageRequest(int? pageSizeHint) => CloudHsmClusterRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, skiptoken);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CloudHsmClusterRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, skiptoken);
+ return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CloudHsmClusterResource(Client, CloudHsmClusterData.DeserializeCloudHsmClusterData(e)), CloudHsmClusterClientDiagnostics, Pipeline, "MockableHardwaresecuritymodulesSubscriptionResource.GetCloudHsmClusters", "value", "nextLink", cancellationToken);
+ }
+
+ ///
+ /// The List operation gets information about the Cloud HSM Clusters associated with the subscription.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters
+ ///
+ /// -
+ /// Operation Id
+ /// CloudHsmCluster_ListBySubscription
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// The page-continuation token to use with a paged version of this API.
+ /// The cancellation token to use.
+ /// A collection of that may take multiple service requests to iterate over.
+ public virtual Pageable GetCloudHsmClusters(string skiptoken = null, CancellationToken cancellationToken = default)
+ {
+ HttpMessage FirstPageRequest(int? pageSizeHint) => CloudHsmClusterRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, skiptoken);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CloudHsmClusterRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, skiptoken);
+ return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CloudHsmClusterResource(Client, CloudHsmClusterData.DeserializeCloudHsmClusterData(e)), CloudHsmClusterClientDiagnostics, Pipeline, "MockableHardwaresecuritymodulesSubscriptionResource.GetCloudHsmClusters", "value", "nextLink", cancellationToken);
+ }
+
+ ///
+ /// The List operation gets information about the dedicated HSMs associated with the subscription.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs
+ ///
+ /// -
+ /// Operation Id
+ /// DedicatedHsm_ListBySubscription
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// Maximum number of results to return.
+ /// The cancellation token to use.
+ /// An async collection of that may take multiple service requests to iterate over.
+ public virtual AsyncPageable GetDedicatedHsmsAsync(int? top = null, CancellationToken cancellationToken = default)
+ {
+ HttpMessage FirstPageRequest(int? pageSizeHint) => DedicatedHsmRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DedicatedHsmRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top);
+ return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DedicatedHsmResource(Client, DedicatedHsmData.DeserializeDedicatedHsmData(e)), DedicatedHsmClientDiagnostics, Pipeline, "MockableHardwaresecuritymodulesSubscriptionResource.GetDedicatedHsms", "value", "nextLink", cancellationToken);
+ }
+
+ ///
+ /// The List operation gets information about the dedicated HSMs associated with the subscription.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs
+ ///
+ /// -
+ /// Operation Id
+ /// DedicatedHsm_ListBySubscription
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// Maximum number of results to return.
+ /// The cancellation token to use.
+ /// A collection of that may take multiple service requests to iterate over.
+ public virtual Pageable GetDedicatedHsms(int? top = null, CancellationToken cancellationToken = default)
+ {
+ HttpMessage FirstPageRequest(int? pageSizeHint) => DedicatedHsmRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DedicatedHsmRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top);
+ return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DedicatedHsmResource(Client, DedicatedHsmData.DeserializeDedicatedHsmData(e)), DedicatedHsmClientDiagnostics, Pipeline, "MockableHardwaresecuritymodulesSubscriptionResource.GetDedicatedHsms", "value", "nextLink", cancellationToken);
+ }
+ }
+}
diff --git a/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/HardwaresecuritymodulesPrivateEndpointConnectionCollection.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/HardwaresecuritymodulesPrivateEndpointConnectionCollection.cs
new file mode 100644
index 000000000000..420f27af55c5
--- /dev/null
+++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/HardwaresecuritymodulesPrivateEndpointConnectionCollection.cs
@@ -0,0 +1,497 @@
+// 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.Hardwaresecuritymodules
+{
+ ///
+ /// 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 GetHardwaresecuritymodulesPrivateEndpointConnections method from an instance of .
+ ///
+ public partial class HardwaresecuritymodulesPrivateEndpointConnectionCollection : ArmCollection, IEnumerable, IAsyncEnumerable
+ {
+ private readonly ClientDiagnostics _hardwaresecuritymodulesPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics;
+ private readonly PrivateEndpointConnectionsRestOperations _hardwaresecuritymodulesPrivateEndpointConnectionPrivateEndpointConnectionsRestClient;
+
+ /// Initializes a new instance of the class for mocking.
+ protected HardwaresecuritymodulesPrivateEndpointConnectionCollection()
+ {
+ }
+
+ /// 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 HardwaresecuritymodulesPrivateEndpointConnectionCollection(ArmClient client, ResourceIdentifier id) : base(client, id)
+ {
+ _hardwaresecuritymodulesPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Hardwaresecuritymodules", HardwaresecuritymodulesPrivateEndpointConnectionResource.ResourceType.Namespace, Diagnostics);
+ TryGetApiVersion(HardwaresecuritymodulesPrivateEndpointConnectionResource.ResourceType, out string hardwaresecuritymodulesPrivateEndpointConnectionPrivateEndpointConnectionsApiVersion);
+ _hardwaresecuritymodulesPrivateEndpointConnectionPrivateEndpointConnectionsRestClient = new PrivateEndpointConnectionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, hardwaresecuritymodulesPrivateEndpointConnectionPrivateEndpointConnectionsApiVersion);
+#if DEBUG
+ ValidateResourceId(Id);
+#endif
+ }
+
+ internal static void ValidateResourceId(ResourceIdentifier id)
+ {
+ if (id.ResourceType != CloudHsmClusterResource.ResourceType)
+ throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, CloudHsmClusterResource.ResourceType), nameof(id));
+ }
+
+ ///
+ /// Creates or updates the private endpoint connection for the Cloud Hsm Cluster.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/privateEndpointConnections/{peConnectionName}
+ ///
+ /// -
+ /// Operation Id
+ /// PrivateEndpointConnection_Create
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// 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.
+ /// Name of the private endpoint connection associated with the Cloud HSM Cluster.
+ /// Parameters of the PrivateEndpointConnection.
+ /// 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 peConnectionName, HardwaresecuritymodulesPrivateEndpointConnectionData data, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(peConnectionName, nameof(peConnectionName));
+ Argument.AssertNotNull(data, nameof(data));
+
+ using var scope = _hardwaresecuritymodulesPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("HardwaresecuritymodulesPrivateEndpointConnectionCollection.CreateOrUpdate");
+ scope.Start();
+ try
+ {
+ var response = await _hardwaresecuritymodulesPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, peConnectionName, data, cancellationToken).ConfigureAwait(false);
+ var uri = _hardwaresecuritymodulesPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateCreateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, peConnectionName, data);
+ var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString());
+ var operation = new HardwaresecuritymodulesArmOperation(Response.FromValue(new HardwaresecuritymodulesPrivateEndpointConnectionResource(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 or updates the private endpoint connection for the Cloud Hsm Cluster.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/privateEndpointConnections/{peConnectionName}
+ ///
+ /// -
+ /// Operation Id
+ /// PrivateEndpointConnection_Create
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// 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.
+ /// Name of the private endpoint connection associated with the Cloud HSM Cluster.
+ /// Parameters of the PrivateEndpointConnection.
+ /// 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 peConnectionName, HardwaresecuritymodulesPrivateEndpointConnectionData data, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(peConnectionName, nameof(peConnectionName));
+ Argument.AssertNotNull(data, nameof(data));
+
+ using var scope = _hardwaresecuritymodulesPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("HardwaresecuritymodulesPrivateEndpointConnectionCollection.CreateOrUpdate");
+ scope.Start();
+ try
+ {
+ var response = _hardwaresecuritymodulesPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, peConnectionName, data, cancellationToken);
+ var uri = _hardwaresecuritymodulesPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateCreateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, peConnectionName, data);
+ var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString());
+ var operation = new HardwaresecuritymodulesArmOperation(Response.FromValue(new HardwaresecuritymodulesPrivateEndpointConnectionResource(Client, response), response.GetRawResponse()), rehydrationToken);
+ if (waitUntil == WaitUntil.Completed)
+ operation.WaitForCompletion(cancellationToken);
+ return operation;
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Gets the private endpoint connection for the Cloud Hsm Cluster.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/privateEndpointConnections/{peConnectionName}
+ ///
+ /// -
+ /// Operation Id
+ /// PrivateEndpointConnection_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// Name of the private endpoint connection associated with the Cloud HSM Cluster.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ public virtual async Task> GetAsync(string peConnectionName, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(peConnectionName, nameof(peConnectionName));
+
+ using var scope = _hardwaresecuritymodulesPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("HardwaresecuritymodulesPrivateEndpointConnectionCollection.Get");
+ scope.Start();
+ try
+ {
+ var response = await _hardwaresecuritymodulesPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, peConnectionName, cancellationToken).ConfigureAwait(false);
+ if (response.Value == null)
+ throw new RequestFailedException(response.GetRawResponse());
+ return Response.FromValue(new HardwaresecuritymodulesPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// Gets the private endpoint connection for the Cloud Hsm Cluster.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/privateEndpointConnections/{peConnectionName}
+ ///
+ /// -
+ /// Operation Id
+ /// PrivateEndpointConnection_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// Name of the private endpoint connection associated with the Cloud HSM Cluster.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ public virtual Response Get(string peConnectionName, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(peConnectionName, nameof(peConnectionName));
+
+ using var scope = _hardwaresecuritymodulesPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("HardwaresecuritymodulesPrivateEndpointConnectionCollection.Get");
+ scope.Start();
+ try
+ {
+ var response = _hardwaresecuritymodulesPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, peConnectionName, cancellationToken);
+ if (response.Value == null)
+ throw new RequestFailedException(response.GetRawResponse());
+ return Response.FromValue(new HardwaresecuritymodulesPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse());
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// The List operation gets information about the private endpoint connections associated with the Cloud HSM Cluster
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/privateEndpointConnections
+ ///
+ /// -
+ /// Operation Id
+ /// PrivateEndpointConnection_ListByCloudHsmCluster
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// 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) => _hardwaresecuritymodulesPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListByCloudHsmClusterRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _hardwaresecuritymodulesPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListByCloudHsmClusterNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name);
+ return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new HardwaresecuritymodulesPrivateEndpointConnectionResource(Client, HardwaresecuritymodulesPrivateEndpointConnectionData.DeserializeHardwaresecuritymodulesPrivateEndpointConnectionData(e)), _hardwaresecuritymodulesPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "HardwaresecuritymodulesPrivateEndpointConnectionCollection.GetAll", "value", "nextLink", cancellationToken);
+ }
+
+ ///
+ /// The List operation gets information about the private endpoint connections associated with the Cloud HSM Cluster
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/privateEndpointConnections
+ ///
+ /// -
+ /// Operation Id
+ /// PrivateEndpointConnection_ListByCloudHsmCluster
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// 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) => _hardwaresecuritymodulesPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListByCloudHsmClusterRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _hardwaresecuritymodulesPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListByCloudHsmClusterNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name);
+ return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new HardwaresecuritymodulesPrivateEndpointConnectionResource(Client, HardwaresecuritymodulesPrivateEndpointConnectionData.DeserializeHardwaresecuritymodulesPrivateEndpointConnectionData(e)), _hardwaresecuritymodulesPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "HardwaresecuritymodulesPrivateEndpointConnectionCollection.GetAll", "value", "nextLink", cancellationToken);
+ }
+
+ ///
+ /// Checks to see if the resource exists in azure.
+ ///
+ /// -
+ /// Request Path
+ /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/privateEndpointConnections/{peConnectionName}
+ ///
+ /// -
+ /// Operation Id
+ /// PrivateEndpointConnection_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// Name of the private endpoint connection associated with the Cloud HSM Cluster.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ public virtual async Task> ExistsAsync(string peConnectionName, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(peConnectionName, nameof(peConnectionName));
+
+ using var scope = _hardwaresecuritymodulesPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("HardwaresecuritymodulesPrivateEndpointConnectionCollection.Exists");
+ scope.Start();
+ try
+ {
+ var response = await _hardwaresecuritymodulesPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, peConnectionName, 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.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/privateEndpointConnections/{peConnectionName}
+ ///
+ /// -
+ /// Operation Id
+ /// PrivateEndpointConnection_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// Name of the private endpoint connection associated with the Cloud HSM Cluster.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ public virtual Response Exists(string peConnectionName, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(peConnectionName, nameof(peConnectionName));
+
+ using var scope = _hardwaresecuritymodulesPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("HardwaresecuritymodulesPrivateEndpointConnectionCollection.Exists");
+ scope.Start();
+ try
+ {
+ var response = _hardwaresecuritymodulesPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, peConnectionName, 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.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/privateEndpointConnections/{peConnectionName}
+ ///
+ /// -
+ /// Operation Id
+ /// PrivateEndpointConnection_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// Name of the private endpoint connection associated with the Cloud HSM Cluster.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ public virtual async Task> GetIfExistsAsync(string peConnectionName, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(peConnectionName, nameof(peConnectionName));
+
+ using var scope = _hardwaresecuritymodulesPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("HardwaresecuritymodulesPrivateEndpointConnectionCollection.GetIfExists");
+ scope.Start();
+ try
+ {
+ var response = await _hardwaresecuritymodulesPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, peConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false);
+ if (response.Value == null)
+ return new NoValueResponse(response.GetRawResponse());
+ return Response.FromValue(new HardwaresecuritymodulesPrivateEndpointConnectionResource(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.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/privateEndpointConnections/{peConnectionName}
+ ///
+ /// -
+ /// Operation Id
+ /// PrivateEndpointConnection_Get
+ ///
+ /// -
+ /// Default Api Version
+ /// 2024-06-30-preview
+ ///
+ /// -
+ /// Resource
+ ///
+ ///
+ ///
+ ///
+ /// Name of the private endpoint connection associated with the Cloud HSM Cluster.
+ /// The cancellation token to use.
+ /// is an empty string, and was expected to be non-empty.
+ /// is null.
+ public virtual NullableResponse GetIfExists(string peConnectionName, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(peConnectionName, nameof(peConnectionName));
+
+ using var scope = _hardwaresecuritymodulesPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("HardwaresecuritymodulesPrivateEndpointConnectionCollection.GetIfExists");
+ scope.Start();
+ try
+ {
+ var response = _hardwaresecuritymodulesPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, peConnectionName, cancellationToken: cancellationToken);
+ if (response.Value == null)
+ return new NoValueResponse(response.GetRawResponse());
+ return Response.FromValue(new HardwaresecuritymodulesPrivateEndpointConnectionResource(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/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/HardwaresecuritymodulesPrivateEndpointConnectionData.Serialization.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/HardwaresecuritymodulesPrivateEndpointConnectionData.Serialization.cs
new file mode 100644
index 000000000000..13b9009b8408
--- /dev/null
+++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.Hardwaresecuritymodules/src/Generated/HardwaresecuritymodulesPrivateEndpointConnectionData.Serialization.cs
@@ -0,0 +1,241 @@
+// 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;
+using Azure.ResourceManager.Hardwaresecuritymodules.Models;
+using Azure.ResourceManager.Models;
+using Azure.ResourceManager.Resources.Models;
+
+namespace Azure.ResourceManager.Hardwaresecuritymodules
+{
+ public partial class HardwaresecuritymodulesPrivateEndpointConnectionData : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ writer.WriteStartObject();
+ JsonModelWriteCore(writer, options);
+ writer.WriteEndObject();
+ }
+
+ /// The JSON writer.
+ /// The client options for reading and writing models.
+ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(HardwaresecuritymodulesPrivateEndpointConnectionData)} does not support writing '{format}' format.");
+ }
+
+ base.JsonModelWriteCore(writer, options);
+ if (Optional.IsDefined(ETag))
+ {
+ writer.WritePropertyName("etag"u8);
+ writer.WriteStringValue(ETag);
+ }
+ writer.WritePropertyName("properties"u8);
+ writer.WriteStartObject();
+ if (Optional.IsDefined(PrivateEndpoint))
+ {
+ writer.WritePropertyName("privateEndpoint"u8);
+ JsonSerializer.Serialize(writer, PrivateEndpoint);
+ }
+ if (Optional.IsDefined(PrivateLinkServiceConnectionState))
+ {
+ writer.WritePropertyName("privateLinkServiceConnectionState"u8);
+ writer.WriteObjectValue(PrivateLinkServiceConnectionState, options);
+ }
+ if (options.Format != "W" && Optional.IsDefined(ProvisioningState))
+ {
+ writer.WritePropertyName("provisioningState"u8);
+ writer.WriteStringValue(ProvisioningState.Value.ToString());
+ }
+ if (options.Format != "W" && Optional.IsCollectionDefined(GroupIds))
+ {
+ writer.WritePropertyName("groupIds"u8);
+ writer.WriteStartArray();
+ foreach (var item in GroupIds)
+ {
+ writer.WriteStringValue(item);
+ }
+ writer.WriteEndArray();
+ }
+ writer.WriteEndObject();
+ }
+
+ HardwaresecuritymodulesPrivateEndpointConnectionData 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(HardwaresecuritymodulesPrivateEndpointConnectionData)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeHardwaresecuritymodulesPrivateEndpointConnectionData(document.RootElement, options);
+ }
+
+ internal static HardwaresecuritymodulesPrivateEndpointConnectionData DeserializeHardwaresecuritymodulesPrivateEndpointConnectionData(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string etag = default;
+ ResourceIdentifier id = default;
+ string name = default;
+ ResourceType type = default;
+ SystemData systemData = default;
+ SubResource privateEndpoint = default;
+ HardwaresecuritymodulesPrivateLinkServiceConnectionState privateLinkServiceConnectionState = default;
+ HardwaresecuritymodulesPrivateEndpointConnectionProvisioningState? provisioningState = default;
+ IReadOnlyList groupIds = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("etag"u8))
+ {
+ etag = property.Value.GetString();
+ 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("privateEndpoint"u8))
+ {
+ if (property0.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ privateEndpoint = JsonSerializer.Deserialize(property0.Value.GetRawText());
+ continue;
+ }
+ if (property0.NameEquals("privateLinkServiceConnectionState"u8))
+ {
+ if (property0.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ privateLinkServiceConnectionState = HardwaresecuritymodulesPrivateLinkServiceConnectionState.DeserializeHardwaresecuritymodulesPrivateLinkServiceConnectionState(property0.Value, options);
+ continue;
+ }
+ if (property0.NameEquals("provisioningState"u8))
+ {
+ if (property0.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ provisioningState = new HardwaresecuritymodulesPrivateEndpointConnectionProvisioningState(property0.Value.GetString());
+ continue;
+ }
+ if (property0.NameEquals("groupIds"u8))
+ {
+ if (property0.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ List array = new List();
+ foreach (var item in property0.Value.EnumerateArray())
+ {
+ array.Add(item.GetString());
+ }
+ groupIds = array;
+ continue;
+ }
+ }
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new HardwaresecuritymodulesPrivateEndpointConnectionData(
+ id,
+ name,
+ type,
+ systemData,
+ privateEndpoint,
+ privateLinkServiceConnectionState,
+ provisioningState,
+ groupIds ?? new ChangeTrackingList(),
+ etag,
+ serializedAdditionalRawData);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel