diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/CHANGELOG.md b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/CHANGELOG.md index 966f81d0787b..772f74beb791 100644 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/CHANGELOG.md +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/CHANGELOG.md @@ -1,14 +1,162 @@ # Release History -## 1.1.0-beta.1 (Unreleased) +## 1.0.0-beta.1 (2025-04-30) -### Features Added +- Azure Resource Manager Hardware Security Modules client library for Java. This package contains Microsoft Azure SDK for Hardware Security Modules Management SDK. The Azure management API provides a RESTful set of web services that interact with Azure HSM RP. Package tag package-preview-2024-06. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ### Breaking Changes -### Bugs Fixed +#### `models.DedicatedHsmOperationListResult` was removed -### Other Changes +#### `models.DedicatedHsmOperation` was removed + +#### `models.DedicatedHsmOperationDisplay` was removed + +#### `models.DedicatedHsmResource` was removed + +#### `models.DedicatedHsm$DefinitionStages` was modified + +* Required stage 4 was added +* `withProperties(models.DedicatedHsmProperties)` was removed in stage 3 + +#### `models.NetworkInterface` was modified + +* `id()` was removed + +#### `models.ApiEntityReference` was modified + +* `withId(java.lang.String)` was removed +* `id()` was removed + +### Features Added + +* `models.BackupResult` was added + +* `models.CloudHsmClusterPatchParameters` was added + +* `models.CloudHsmClusterBackupStatusGetResponse` was added + +* `models.ActivationState` was added + +* `models.BackupRequestProperties` was added + +* `models.CloudHsmClusterPrivateEndpointConnections` was added + +* `models.CloudHsmCluster$Definition` was added + +* `models.BackupResultProperties` was added + +* `models.PrivateEndpoint` was added + +* `models.CloudHsmClusterPrivateLinkResources` was added + +* `models.PrivateEndpointServiceConnectionStatus` was added + +* `models.AutoGeneratedDomainNameLabelScope` was added + +* `models.ActionType` was added + +* `models.CloudHsmClusterSkuName` was added + +* `models.PrivateLinkResourceListResult` was added + +* `models.OperationDisplay` was added + +* `models.CloudHsmClusterBackupStatus` was added + +* `models.ManagedServiceIdentity` was added + +* `models.PrivateEndpointConnection$DefinitionStages` was added + +* `models.CloudHsmClusterSkuFamily` was added + +* `models.CloudHsmClusterProperties` was added + +* `models.BackupRestoreOperationStatus` was added + +* `models.BackupRestoreRequestBaseProperties` was added + +* `models.ProvisioningState` was added + +* `models.PrivateLinkResourceProperties` was added + +* `models.CloudHsmClusterResource` was added + +* `models.PrivateEndpointConnectionListResult` was added + +* `models.CloudHsmClusterBackupStatusGetHeaders` was added + +* `models.CloudHsmClusterRestoreStatusGetHeaders` was added + +* `models.Origin` was added + +* `models.PrivateEndpointConnectionProvisioningState` was added + +* `models.ManagedServiceIdentityType` was added + +* `models.Operation` was added + +* `models.PrivateEndpointConnection$Definition` was added + +* `models.CloudHsmCluster` was added + +* `models.CloudHsmCluster$Update` was added + +* `models.PrivateEndpointConnections` was added + +* `models.PublicNetworkAccess` was added + +* `models.BackupRestoreBaseResultProperties` was added + +* `models.PrivateLinkResource` was added + +* `models.CloudHsmCluster$DefinitionStages` was added + +* `models.CloudHsmClusterRestoreStatus` was added + +* `models.UserAssignedIdentity` was added + +* `models.CloudHsmCluster$UpdateStages` was added + +* `models.PrivateLinkServiceConnectionState` was added + +* `models.CloudHsmClusterSku` was added + +* `models.RestoreResult` was added + +* `models.PrivateEndpointConnectionProperties` was added + +* `models.CloudHsmClusters` was added + +* `models.CloudHsmClusterRestoreStatusGetResponse` was added + +* `models.RestoreRequestProperties` was added + +* `models.CloudHsmProperties` was added + +* `models.CloudHsmClusterListResult` was added + +* `models.OperationListResult` was added + +* `models.PrivateEndpointConnection` was added + +#### `HardwareSecurityModulesManager` was modified + +* `privateEndpointConnections()` was added +* `cloudHsmClusterPrivateEndpointConnections()` was added +* `cloudHsmClusterBackupStatus()` was added +* `cloudHsmClusterRestoreStatus()` was added +* `cloudHsmClusters()` was added +* `cloudHsmClusterPrivateLinkResources()` was added + +#### `models.NetworkInterface` was modified + +* `resourceId()` was added + +#### `models.ApiEntityReference` was modified + +* `resourceId()` was added +* `withResourceId(java.lang.String)` was added ## 1.0.0 (2024-12-26) diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/README.md b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/README.md index a1355e5d0764..cfe5f939480c 100644 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/README.md +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/README.md @@ -2,7 +2,7 @@ Azure Resource Manager Hardware Security Modules client library for Java. -This package contains Microsoft Azure SDK for Hardware Security Modules Management SDK. The Azure management API provides a RESTful set of web services that interact with Azure HSM RP. Package tag package-2021-11. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +This package contains Microsoft Azure SDK for Hardware Security Modules Management SDK. The Azure management API provides a RESTful set of web services that interact with Azure HSM RP. Package tag package-preview-2024-06. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ## We'd love to hear your feedback @@ -52,7 +52,7 @@ Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code: ```java -AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +AzureProfile profile = new AzureProfile(AzureCloud.AZURE_PUBLIC_CLOUD); TokenCredential credential = new DefaultAzureCredentialBuilder() .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) .build(); @@ -60,7 +60,7 @@ HardwareSecurityModulesManager manager = HardwareSecurityModulesManager .authenticate(credential, profile); ``` -The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. +The sample code assumes global Azure. Please change the `AzureCloud.AZURE_PUBLIC_CLOUD` variable if otherwise. See [Authentication][authenticate] for more options. @@ -100,5 +100,3 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m [cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md [coc]: https://opensource.microsoft.com/codeofconduct/ [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ - - diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/SAMPLE.md b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/SAMPLE.md index f134a0a01c88..a50252e810fc 100644 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/SAMPLE.md +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/SAMPLE.md @@ -1,6 +1,37 @@ # Code snippets and samples +## CloudHsmClusterBackupStatus + +- [Get](#cloudhsmclusterbackupstatus_get) + +## CloudHsmClusterPrivateEndpointConnections + +- [Create](#cloudhsmclusterprivateendpointconnections_create) +- [Delete](#cloudhsmclusterprivateendpointconnections_delete) +- [Get](#cloudhsmclusterprivateendpointconnections_get) + +## CloudHsmClusterPrivateLinkResources + +- [ListByCloudHsmCluster](#cloudhsmclusterprivatelinkresources_listbycloudhsmcluster) + +## CloudHsmClusterRestoreStatus + +- [Get](#cloudhsmclusterrestorestatus_get) + +## CloudHsmClusters + +- [Backup](#cloudhsmclusters_backup) +- [CreateOrUpdate](#cloudhsmclusters_createorupdate) +- [Delete](#cloudhsmclusters_delete) +- [GetByResourceGroup](#cloudhsmclusters_getbyresourcegroup) +- [List](#cloudhsmclusters_list) +- [ListByResourceGroup](#cloudhsmclusters_listbyresourcegroup) +- [Restore](#cloudhsmclusters_restore) +- [Update](#cloudhsmclusters_update) +- [ValidateBackupProperties](#cloudhsmclusters_validatebackupproperties) +- [ValidateRestoreProperties](#cloudhsmclusters_validaterestoreproperties) + ## DedicatedHsm - [CreateOrUpdate](#dedicatedhsm_createorupdate) @@ -14,344 +45,415 @@ ## Operations - [List](#operations_list) -### DedicatedHsm_CreateOrUpdate + +## PrivateEndpointConnections + +- [ListByCloudHsmCluster](#privateendpointconnections_listbycloudhsmcluster) +### CloudHsmClusterBackupStatus_Get ```java -import com.azure.resourcemanager.hardwaresecuritymodules.models.ApiEntityReference; -import com.azure.resourcemanager.hardwaresecuritymodules.models.DedicatedHsmProperties; -import com.azure.resourcemanager.hardwaresecuritymodules.models.NetworkInterface; -import com.azure.resourcemanager.hardwaresecuritymodules.models.NetworkProfile; -import com.azure.resourcemanager.hardwaresecuritymodules.models.Sku; -import com.azure.resourcemanager.hardwaresecuritymodules.models.SkuName; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; +import com.azure.resourcemanager.hardwaresecuritymodules.models.BackupRequestProperties; /** - * Samples for DedicatedHsm CreateOrUpdate. + * Samples for CloudHsmClusters ValidateBackupProperties. */ -public final class DedicatedHsmCreateOrUpdateSamples { +public final class CloudHsmClustersValidateBackupPropertiesSamples { /* * x-ms-original-file: - * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/ - * examples/PaymentHsm_CreateOrUpdate_WithManagementProfile.json + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/CloudHsmCluster_CreateOrValidate_Backup_MaximumSet_Gen.json */ /** - * Sample code: Create a new or update an existing payment HSM with management profile. + * Sample code: CloudHsmCluster_ValidateBackup_Validation_MaximumSet_Gen. * * @param manager Entry point to HardwareSecurityModulesManager. */ - public static void createANewOrUpdateAnExistingPaymentHSMWithManagementProfile( + public static void cloudHsmClusterValidateBackupValidationMaximumSetGen( com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { - manager.dedicatedHsms() - .define("hsm1") - .withRegion("westus") - .withExistingResourceGroup("hsm-group") - .withProperties(new DedicatedHsmProperties() - .withNetworkProfile(new NetworkProfile().withSubnet(new ApiEntityReference().withId( - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01")) - .withNetworkInterfaces(Arrays.asList(new NetworkInterface().withPrivateIpAddress("1.0.0.1")))) - .withManagementNetworkProfile(new NetworkProfile().withSubnet(new ApiEntityReference().withId( - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01")) - .withNetworkInterfaces(Arrays.asList(new NetworkInterface().withPrivateIpAddress("1.0.0.2")))) - .withStampId("stamp01")) - .withTags(mapOf("Dept", "hsm", "Environment", "dogfood")) - .withSku(new Sku().withName(SkuName.PAY_SHIELD10K_LMK1_CPS60)) - .create(); + manager.cloudHsmClusters() + .validateBackupProperties("rgcloudhsm", "chsm1", + new BackupRequestProperties() + .withAzureStorageBlobContainerUri( + "https://myaccount.blob.core.windows.net/sascontainer/sasContainer") + .withToken("fakeTokenPlaceholder"), + com.azure.core.util.Context.NONE); } +} +``` + +### CloudHsmClusterPrivateEndpointConnections_Create +```java +/** + * Samples for CloudHsmClusterPrivateLinkResources ListByCloudHsmCluster. + */ +public final class CloudHsmClusterPrivateLinkResourcesListByCloudHsmClusterSamples { /* * x-ms-original-file: - * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/ - * examples/DedicatedHsm_CreateOrUpdate.json + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/CloudHsmClusterPrivateLinkResource_ListByCloudHsmCluster_MaximumSet_Gen.json */ /** - * Sample code: Create a new or update an existing dedicated HSM. + * Sample code: CloudHsmClusterPrivateLinkResources_ListByResource_MaximumSet_Gen. * * @param manager Entry point to HardwareSecurityModulesManager. */ - public static void createANewOrUpdateAnExistingDedicatedHSM( + public static void cloudHsmClusterPrivateLinkResourcesListByResourceMaximumSetGen( com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { - manager.dedicatedHsms() - .define("hsm1") - .withRegion("westus") - .withExistingResourceGroup("hsm-group") - .withProperties(new DedicatedHsmProperties() - .withNetworkProfile(new NetworkProfile().withSubnet(new ApiEntityReference().withId( - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01")) - .withNetworkInterfaces(Arrays.asList(new NetworkInterface().withPrivateIpAddress("1.0.0.1")))) - .withStampId("stamp01")) - .withTags(mapOf("Dept", "hsm", "Environment", "dogfood")) - .withSku(new Sku().withName(SkuName.SAFE_NET_LUNA_NETWORK_HSM_A790)) - .create(); + manager.cloudHsmClusterPrivateLinkResources() + .listByCloudHsmCluster("rgcloudhsm", "chsm1", com.azure.core.util.Context.NONE); } +} +``` +### CloudHsmClusterPrivateEndpointConnections_Delete + +```java +/** + * Samples for CloudHsmClusterRestoreStatus Get. + */ +public final class CloudHsmClusterRestoreStatusGetSamples { /* * x-ms-original-file: - * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/ - * examples/PaymentHsm_CreateOrUpdate.json + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/CloudHsmCluster_Restore_Pending_MaximumSet_Gen.json */ /** - * Sample code: Create a new or update an existing payment HSM. + * Sample code: CloudHsmCluster_Get_Restore_Status_MaximumSet_Gen. * * @param manager Entry point to HardwareSecurityModulesManager. */ - public static void createANewOrUpdateAnExistingPaymentHSM( + public static void cloudHsmClusterGetRestoreStatusMaximumSetGen( com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { - manager.dedicatedHsms() - .define("hsm1") - .withRegion("westus") - .withExistingResourceGroup("hsm-group") - .withProperties(new DedicatedHsmProperties() - .withNetworkProfile(new NetworkProfile().withSubnet(new ApiEntityReference().withId( - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01")) - .withNetworkInterfaces(Arrays.asList(new NetworkInterface().withPrivateIpAddress("1.0.0.1")))) - .withStampId("stamp01")) - .withTags(mapOf("Dept", "hsm", "Environment", "dogfood")) - .withSku(new Sku().withName(SkuName.PAY_SHIELD10K_LMK1_CPS60)) - .create(); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; + manager.cloudHsmClusterRestoreStatus() + .getWithResponse("rgcloudhsm", "chsm1", "572a45927fc240e1ac075de27371680b", + com.azure.core.util.Context.NONE); } } ``` -### DedicatedHsm_Delete +### CloudHsmClusterPrivateEndpointConnections_Get ```java /** - * Samples for DedicatedHsm Delete. + * Samples for CloudHsmClusters Delete. */ -public final class DedicatedHsmDeleteSamples { +public final class CloudHsmClustersDeleteSamples { /* * x-ms-original-file: - * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/ - * examples/DedicatedHsm_Delete.json + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/CloudHsmCluster_Delete_MaximumSet_Gen.json */ /** - * Sample code: Delete a dedicated HSM. + * Sample code: CloudHsmCluster_Delete_MaximumSet_Gen. * * @param manager Entry point to HardwareSecurityModulesManager. */ - public static void - deleteADedicatedHSM(com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { - manager.dedicatedHsms().delete("hsm-group", "hsm1", com.azure.core.util.Context.NONE); + public static void cloudHsmClusterDeleteMaximumSetGen( + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { + manager.cloudHsmClusters().delete("rgcloudhsm", "chsm1", com.azure.core.util.Context.NONE); } } ``` -### DedicatedHsm_GetByResourceGroup +### CloudHsmClusterPrivateLinkResources_ListByCloudHsmCluster ```java /** - * Samples for DedicatedHsm GetByResourceGroup. + * Samples for CloudHsmClusterPrivateEndpointConnections Get. */ -public final class DedicatedHsmGetByResourceGroupSamples { +public final class CloudHsmClusterPrivateEndpointConnectionsGetSamples { /* * x-ms-original-file: - * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/ - * examples/PaymentHsm_Get.json + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/CloudHsmClusterPrivateEndpointConnection_Get_MaximumSet_Gen.json */ /** - * Sample code: Get a payment HSM. + * Sample code: CloudHsmClusterPrivateEndpointConnection_Get_MaximumSet_Gen. * * @param manager Entry point to HardwareSecurityModulesManager. */ - public static void - getAPaymentHSM(com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { - manager.dedicatedHsms().getByResourceGroupWithResponse("hsm-group", "hsm1", com.azure.core.util.Context.NONE); + public static void cloudHsmClusterPrivateEndpointConnectionGetMaximumSetGen( + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { + manager.cloudHsmClusterPrivateEndpointConnections() + .getWithResponse("rgcloudhsm", "chsm1", "sample-pec", com.azure.core.util.Context.NONE); } +} +``` + +### CloudHsmClusterRestoreStatus_Get +```java +/** + * Samples for DedicatedHsm ListOutboundNetworkDependenciesEndpoints. + */ +public final class DedicatedHsmListOutboundNetworkDependenciesEndpointsSamples { /* * x-ms-original-file: - * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/ - * examples/PaymentHsm_Get_With_2018-10-31Preview_Version.json + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/GetOutboundNetworkDependenciesEndpointsList.json */ /** - * Sample code: Get a payment HSM with 2018-10-31Preview api version. + * Sample code: List OutboundNetworkDependenciesEndpoints by Managed Cluster. * * @param manager Entry point to HardwareSecurityModulesManager. */ - public static void getAPaymentHSMWith20181031PreviewApiVersion( + public static void listOutboundNetworkDependenciesEndpointsByManagedCluster( com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { - manager.dedicatedHsms().getByResourceGroupWithResponse("hsm-group", "hsm1", com.azure.core.util.Context.NONE); + manager.dedicatedHsms() + .listOutboundNetworkDependenciesEndpoints("hsm-group", "hsm1", com.azure.core.util.Context.NONE); } +} +``` +### CloudHsmClusters_Backup + +```java +/** + * Samples for CloudHsmClusters List. + */ +public final class CloudHsmClustersListSamples { /* * x-ms-original-file: - * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/ - * examples/DedicatedHsm_Get.json + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/CloudHsmCluster_ListBySubscription_MaximumSet_Gen.json */ /** - * Sample code: Get a dedicated HSM. + * Sample code: CloudHsmCluster_ListBySubscription_MaximumSet_Gen. * * @param manager Entry point to HardwareSecurityModulesManager. */ - public static void - getADedicatedHSM(com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { - manager.dedicatedHsms().getByResourceGroupWithResponse("hsm-group", "hsm1", com.azure.core.util.Context.NONE); + public static void cloudHsmClusterListBySubscriptionMaximumSetGen( + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { + manager.cloudHsmClusters().list(null, com.azure.core.util.Context.NONE); } } ``` -### DedicatedHsm_List +### CloudHsmClusters_CreateOrUpdate ```java /** - * Samples for DedicatedHsm List. + * Samples for DedicatedHsm ListByResourceGroup. */ -public final class DedicatedHsmListSamples { +public final class DedicatedHsmListByResourceGroupSamples { /* * x-ms-original-file: - * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/ - * examples/PaymentHsm_ListBySubscription.json + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/DedicatedHsm_ListByResourceGroup.json */ /** - * Sample code: List dedicated HSM devices in a subscription including payment HSM. + * Sample code: List dedicated HSM devices in a resource group. * * @param manager Entry point to HardwareSecurityModulesManager. */ - public static void listDedicatedHSMDevicesInASubscriptionIncludingPaymentHSM( + public static void listDedicatedHSMDevicesInAResourceGroup( com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { - manager.dedicatedHsms().list(null, com.azure.core.util.Context.NONE); + manager.dedicatedHsms().listByResourceGroup("hsm-group", null, com.azure.core.util.Context.NONE); } /* * x-ms-original-file: - * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/ - * examples/DedicatedHsm_ListBySubscription.json + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/PaymentHsm_ListByResourceGroup.json */ /** - * Sample code: List dedicated HSM devices in a subscription. + * Sample code: List dedicated HSM devices in a resource group including payment HSM. * * @param manager Entry point to HardwareSecurityModulesManager. */ - public static void listDedicatedHSMDevicesInASubscription( + public static void listDedicatedHSMDevicesInAResourceGroupIncludingPaymentHSM( com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { - manager.dedicatedHsms().list(null, com.azure.core.util.Context.NONE); + manager.dedicatedHsms().listByResourceGroup("hsm-group", null, com.azure.core.util.Context.NONE); } } ``` -### DedicatedHsm_ListByResourceGroup +### CloudHsmClusters_Delete ```java +import com.azure.resourcemanager.hardwaresecuritymodules.models.DedicatedHsm; +import java.util.HashMap; +import java.util.Map; + /** - * Samples for DedicatedHsm ListByResourceGroup. + * Samples for DedicatedHsm Update. */ -public final class DedicatedHsmListByResourceGroupSamples { +public final class DedicatedHsmUpdateSamples { /* * x-ms-original-file: - * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/ - * examples/DedicatedHsm_ListByResourceGroup.json + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/DedicatedHsm_Update.json */ /** - * Sample code: List dedicated HSM devices in a resource group. + * Sample code: Update an existing dedicated HSM. * * @param manager Entry point to HardwareSecurityModulesManager. */ - public static void listDedicatedHSMDevicesInAResourceGroup( + public static void updateAnExistingDedicatedHSM( com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { - manager.dedicatedHsms().listByResourceGroup("hsm-group", null, com.azure.core.util.Context.NONE); + DedicatedHsm resource = manager.dedicatedHsms() + .getByResourceGroupWithResponse("hsm-group", "hsm1", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("Dept", "hsm", "Environment", "dogfood", "Slice", "A")).apply(); } /* * x-ms-original-file: - * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/ - * examples/PaymentHsm_ListByResourceGroup.json + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/PaymentHsm_Update.json */ /** - * Sample code: List dedicated HSM devices in a resource group including payment HSM. + * Sample code: Update an existing payment HSM. * * @param manager Entry point to HardwareSecurityModulesManager. */ - public static void listDedicatedHSMDevicesInAResourceGroupIncludingPaymentHSM( + public static void updateAnExistingPaymentHSM( com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { - manager.dedicatedHsms().listByResourceGroup("hsm-group", null, com.azure.core.util.Context.NONE); + DedicatedHsm resource = manager.dedicatedHsms() + .getByResourceGroupWithResponse("hsm-group", "hsm1", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("Dept", "hsm", "Environment", "dogfood", "Slice", "A")).apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; } } ``` -### DedicatedHsm_ListOutboundNetworkDependenciesEndpoints +### CloudHsmClusters_GetByResourceGroup ```java /** - * Samples for DedicatedHsm ListOutboundNetworkDependenciesEndpoints. + * Samples for CloudHsmClusters ListByResourceGroup. */ -public final class DedicatedHsmListOutboundNetworkDependenciesEndpointsSamples { +public final class CloudHsmClustersListByResourceGroupSamples { /* * x-ms-original-file: - * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/ - * examples/GetOutboundNetworkDependenciesEndpointsList.json + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/CloudHsmCluster_ListByResourceGroup_MaximumSet_Gen.json */ /** - * Sample code: List OutboundNetworkDependenciesEndpoints by Managed Cluster. + * Sample code: CloudHsmCluster_ListByResourceGroup_MaximumSet_Gen. * * @param manager Entry point to HardwareSecurityModulesManager. */ - public static void listOutboundNetworkDependenciesEndpointsByManagedCluster( + public static void cloudHsmClusterListByResourceGroupMaximumSetGen( com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { - manager.dedicatedHsms() - .listOutboundNetworkDependenciesEndpoints("hsm-group", "hsm1", com.azure.core.util.Context.NONE); + manager.cloudHsmClusters().listByResourceGroup("rgcloudhsm", null, com.azure.core.util.Context.NONE); } } ``` -### DedicatedHsm_Update +### CloudHsmClusters_List ```java -import com.azure.resourcemanager.hardwaresecuritymodules.models.DedicatedHsm; -import java.util.HashMap; -import java.util.Map; +import com.azure.resourcemanager.hardwaresecuritymodules.models.RestoreRequestProperties; /** - * Samples for DedicatedHsm Update. + * Samples for CloudHsmClusters Restore. */ -public final class DedicatedHsmUpdateSamples { +public final class CloudHsmClustersRestoreSamples { /* * x-ms-original-file: - * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/ - * examples/DedicatedHsm_Update.json + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/CloudHsmCluster_RequestOrValidate_Restore_MaximumSet_Gen.json */ /** - * Sample code: Update an existing dedicated HSM. + * Sample code: CloudHsmCluster_Restore_MaximumSet_Gen. * * @param manager Entry point to HardwareSecurityModulesManager. */ - public static void updateAnExistingDedicatedHSM( + public static void cloudHsmClusterRestoreMaximumSetGen( com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { - DedicatedHsm resource = manager.dedicatedHsms() - .getByResourceGroupWithResponse("hsm-group", "hsm1", com.azure.core.util.Context.NONE) - .getValue(); - resource.update().withTags(mapOf("Dept", "hsm", "Environment", "dogfood", "Slice", "A")).apply(); + manager.cloudHsmClusters() + .restore("rgcloudhsm", "chsm1", + new RestoreRequestProperties() + .withAzureStorageBlobContainerUri( + "https://myaccount.blob.core.windows.net/sascontainer/sasContainer") + .withBackupId("backupId"), + com.azure.core.util.Context.NONE); } +} +``` +### CloudHsmClusters_ListByResourceGroup + +```java +import com.azure.resourcemanager.hardwaresecuritymodules.models.BackupRequestProperties; + +/** + * Samples for CloudHsmClusters Backup. + */ +public final class CloudHsmClustersBackupSamples { /* * x-ms-original-file: - * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/ - * examples/PaymentHsm_Update.json + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/CloudHsmCluster_CreateOrValidate_Backup_MaximumSet_Gen.json */ /** - * Sample code: Update an existing payment HSM. + * Sample code: CloudHsmCluster_Create_Backup_MaximumSet_Gen. * * @param manager Entry point to HardwareSecurityModulesManager. */ - public static void updateAnExistingPaymentHSM( + public static void cloudHsmClusterCreateBackupMaximumSetGen( com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { - DedicatedHsm resource = manager.dedicatedHsms() - .getByResourceGroupWithResponse("hsm-group", "hsm1", com.azure.core.util.Context.NONE) + manager.cloudHsmClusters() + .backup("rgcloudhsm", "chsm1", + new BackupRequestProperties() + .withAzureStorageBlobContainerUri( + "https://myaccount.blob.core.windows.net/sascontainer/sasContainer") + .withToken("fakeTokenPlaceholder"), + com.azure.core.util.Context.NONE); + } +} +``` + +### CloudHsmClusters_Restore + +```java +import com.azure.resourcemanager.hardwaresecuritymodules.models.CloudHsmCluster; +import com.azure.resourcemanager.hardwaresecuritymodules.models.ManagedServiceIdentity; +import com.azure.resourcemanager.hardwaresecuritymodules.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.hardwaresecuritymodules.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for CloudHsmClusters Update. + */ +public final class CloudHsmClustersUpdateSamples { + /* + * x-ms-original-file: + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/CloudHsmCluster_Update_MaximumSet_Gen.json + */ + /** + * Sample code: CloudHsmCluster_Update_MaximumSet_Gen. + * + * @param manager Entry point to HardwareSecurityModulesManager. + */ + public static void cloudHsmClusterUpdateMaximumSetGen( + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { + CloudHsmCluster resource = manager.cloudHsmClusters() + .getByResourceGroupWithResponse("rgcloudhsm", "chsm1", com.azure.core.util.Context.NONE) .getValue(); - resource.update().withTags(mapOf("Dept", "hsm", "Environment", "dogfood", "Slice", "A")).apply(); + resource.update() + .withTags(mapOf("Dept", "hsm", "Environment", "dogfood", "Slice", "A")) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-1", + new UserAssignedIdentity()))) + .apply(); } // Use "Map.of" if available @@ -368,41 +470,496 @@ public final class DedicatedHsmUpdateSamples { } ``` -### Operations_List +### CloudHsmClusters_Update ```java /** - * Samples for Operations List. + * Samples for DedicatedHsm GetByResourceGroup. */ -public final class OperationsListSamples { +public final class DedicatedHsmGetByResourceGroupSamples { /* * x-ms-original-file: - * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/ - * examples/PaymentHsm_OperationsList.json + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/PaymentHsm_Get.json */ /** - * Sample code: Get a list of Payment HSM operations. + * Sample code: Get a payment HSM. * * @param manager Entry point to HardwareSecurityModulesManager. */ - public static void getAListOfPaymentHSMOperations( - com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { - manager.operations().list(com.azure.core.util.Context.NONE); + public static void + getAPaymentHSM(com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { + manager.dedicatedHsms().getByResourceGroupWithResponse("hsm-group", "hsm1", com.azure.core.util.Context.NONE); } /* * x-ms-original-file: - * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/ - * examples/DedicatedHsm_OperationsList.json + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/PaymentHsm_Get_With_2018-10-31Preview_Version.json */ /** - * Sample code: Get a list of Dedicated HSM operations. + * Sample code: Get a payment HSM with 2018-10-31Preview api version. * * @param manager Entry point to HardwareSecurityModulesManager. */ - public static void getAListOfDedicatedHSMOperations( + public static void getAPaymentHSMWith20181031PreviewApiVersion( com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { - manager.operations().list(com.azure.core.util.Context.NONE); + manager.dedicatedHsms().getByResourceGroupWithResponse("hsm-group", "hsm1", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/DedicatedHsm_Get.json + */ + /** + * Sample code: Get a dedicated HSM. + * + * @param manager Entry point to HardwareSecurityModulesManager. + */ + public static void + getADedicatedHSM(com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { + manager.dedicatedHsms().getByResourceGroupWithResponse("hsm-group", "hsm1", com.azure.core.util.Context.NONE); + } +} +``` + +### CloudHsmClusters_ValidateBackupProperties + +```java +/** + * Samples for DedicatedHsm List. + */ +public final class DedicatedHsmListSamples { + /* + * x-ms-original-file: + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/PaymentHsm_ListBySubscription.json + */ + /** + * Sample code: List dedicated HSM devices in a subscription including payment HSM. + * + * @param manager Entry point to HardwareSecurityModulesManager. + */ + public static void listDedicatedHSMDevicesInASubscriptionIncludingPaymentHSM( + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { + manager.dedicatedHsms().list(null, com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/DedicatedHsm_ListBySubscription.json + */ + /** + * Sample code: List dedicated HSM devices in a subscription. + * + * @param manager Entry point to HardwareSecurityModulesManager. + */ + public static void listDedicatedHSMDevicesInASubscription( + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { + manager.dedicatedHsms().list(null, com.azure.core.util.Context.NONE); + } +} +``` + +### CloudHsmClusters_ValidateRestoreProperties + +```java +import com.azure.resourcemanager.hardwaresecuritymodules.models.PrivateEndpointConnectionProperties; +import com.azure.resourcemanager.hardwaresecuritymodules.models.PrivateEndpointServiceConnectionStatus; +import com.azure.resourcemanager.hardwaresecuritymodules.models.PrivateLinkServiceConnectionState; + +/** + * Samples for CloudHsmClusterPrivateEndpointConnections Create. + */ +public final class CloudHsmClusterPrivateEndpointConnectionsCreateSamples { + /* + * x-ms-original-file: + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/CloudHsmClusterPrivateEndpointConnection_Create_MaximumSet_Gen.json + */ + /** + * Sample code: CloudHsmClusterPrivateEndpointConnection_Create_MaximumSet_Gen. + * + * @param manager Entry point to HardwareSecurityModulesManager. + */ + public static void cloudHsmClusterPrivateEndpointConnectionCreateMaximumSetGen( + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { + manager.cloudHsmClusterPrivateEndpointConnections() + .define("sample-pec") + .withExistingCloudHsmCluster("rgcloudhsm", "chsm1") + .withProperties(new PrivateEndpointConnectionProperties().withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionState().withStatus(PrivateEndpointServiceConnectionStatus.APPROVED) + .withDescription("My name is Joe and I'm approving this."))) + .create(); + } +} +``` + +### DedicatedHsm_CreateOrUpdate + +```java +/** + * Samples for CloudHsmClusters GetByResourceGroup. + */ +public final class CloudHsmClustersGetByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/CloudHsmCluster_Get_MaximumSet_Gen.json + */ + /** + * Sample code: CloudHsmCluster_Get_MaximumSet_Gen. + * + * @param manager Entry point to HardwareSecurityModulesManager. + */ + public static void cloudHsmClusterGetMaximumSetGen( + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { + manager.cloudHsmClusters() + .getByResourceGroupWithResponse("rgcloudhsm", "chsm1", com.azure.core.util.Context.NONE); + } +} +``` + +### DedicatedHsm_Delete + +```java +import com.azure.resourcemanager.hardwaresecuritymodules.models.ApiEntityReference; +import com.azure.resourcemanager.hardwaresecuritymodules.models.DedicatedHsmProperties; +import com.azure.resourcemanager.hardwaresecuritymodules.models.NetworkInterface; +import com.azure.resourcemanager.hardwaresecuritymodules.models.NetworkProfile; +import com.azure.resourcemanager.hardwaresecuritymodules.models.Sku; +import com.azure.resourcemanager.hardwaresecuritymodules.models.SkuName; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for DedicatedHsm CreateOrUpdate. + */ +public final class DedicatedHsmCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/PaymentHsm_CreateOrUpdate_WithManagementProfile.json + */ + /** + * Sample code: Create a new or update an existing payment HSM with management profile. + * + * @param manager Entry point to HardwareSecurityModulesManager. + */ + public static void createANewOrUpdateAnExistingPaymentHSMWithManagementProfile( + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { + manager.dedicatedHsms() + .define("hsm1") + .withRegion("westus") + .withExistingResourceGroup("hsm-group") + .withSku(new Sku().withName(SkuName.PAY_SHIELD10K_LMK1_CPS60)) + .withProperties(new DedicatedHsmProperties() + .withNetworkProfile(new NetworkProfile().withSubnet(new ApiEntityReference().withResourceId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01")) + .withNetworkInterfaces(Arrays.asList(new NetworkInterface().withPrivateIpAddress("1.0.0.1")))) + .withManagementNetworkProfile(new NetworkProfile().withSubnet(new ApiEntityReference().withResourceId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01")) + .withNetworkInterfaces(Arrays.asList(new NetworkInterface().withPrivateIpAddress("1.0.0.2")))) + .withStampId("stamp01")) + .withTags(mapOf("Dept", "hsm", "Environment", "dogfood")) + .create(); + } + + /* + * x-ms-original-file: + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/DedicatedHsm_CreateOrUpdate.json + */ + /** + * Sample code: Create a new or update an existing dedicated HSM. + * + * @param manager Entry point to HardwareSecurityModulesManager. + */ + public static void createANewOrUpdateAnExistingDedicatedHSM( + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { + manager.dedicatedHsms() + .define("hsm1") + .withRegion("westus") + .withExistingResourceGroup("hsm-group") + .withSku(new Sku().withName(SkuName.SAFE_NET_LUNA_NETWORK_HSM_A790)) + .withProperties(new DedicatedHsmProperties() + .withNetworkProfile(new NetworkProfile().withSubnet(new ApiEntityReference().withResourceId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01")) + .withNetworkInterfaces(Arrays.asList(new NetworkInterface().withPrivateIpAddress("1.0.0.1")))) + .withStampId("stamp01")) + .withTags(mapOf("Dept", "hsm", "Environment", "dogfood")) + .create(); + } + + /* + * x-ms-original-file: + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/PaymentHsm_CreateOrUpdate.json + */ + /** + * Sample code: Create a new or update an existing payment HSM. + * + * @param manager Entry point to HardwareSecurityModulesManager. + */ + public static void createANewOrUpdateAnExistingPaymentHSM( + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { + manager.dedicatedHsms() + .define("hsm1") + .withRegion("westus") + .withExistingResourceGroup("hsm-group") + .withSku(new Sku().withName(SkuName.PAY_SHIELD10K_LMK1_CPS60)) + .withProperties(new DedicatedHsmProperties() + .withNetworkProfile(new NetworkProfile().withSubnet(new ApiEntityReference().withResourceId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01")) + .withNetworkInterfaces(Arrays.asList(new NetworkInterface().withPrivateIpAddress("1.0.0.1")))) + .withStampId("stamp01")) + .withTags(mapOf("Dept", "hsm", "Environment", "dogfood")) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### DedicatedHsm_GetByResourceGroup + +```java +/** + * Samples for CloudHsmClusterBackupStatus Get. + */ +public final class CloudHsmClusterBackupStatusGetSamples { + /* + * x-ms-original-file: + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/CloudHsmCluster_Backup_Pending_MaximumSet_Gen.json + */ + /** + * Sample code: CloudHsmCluster_Get_Backup_Status_MaximumSet_Gen. + * + * @param manager Entry point to HardwareSecurityModulesManager. + */ + public static void cloudHsmClusterGetBackupStatusMaximumSetGen( + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { + manager.cloudHsmClusterBackupStatus() + .getWithResponse("rgcloudhsm", "chsm1", "572a45927fc240e1ac075de27371680b", + com.azure.core.util.Context.NONE); + } +} +``` + +### DedicatedHsm_List + +```java +/** + * Samples for CloudHsmClusterPrivateEndpointConnections Delete. + */ +public final class CloudHsmClusterPrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/CloudHsmClusterPrivateEndpointConnection_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: CloudHsmClusterPrivateEndpointConnection_Delete_MaximumSet_Gen. + * + * @param manager Entry point to HardwareSecurityModulesManager. + */ + public static void cloudHsmClusterPrivateEndpointConnectionDeleteMaximumSetGen( + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { + manager.cloudHsmClusterPrivateEndpointConnections() + .delete("rgcloudhsm", "chsm1", "sample-pec", com.azure.core.util.Context.NONE); + } +} +``` + +### DedicatedHsm_ListByResourceGroup + +```java +import com.azure.resourcemanager.hardwaresecuritymodules.models.RestoreRequestProperties; + +/** + * Samples for CloudHsmClusters ValidateRestoreProperties. + */ +public final class CloudHsmClustersValidateRestorePropertiesSamples { + /* + * x-ms-original-file: + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/CloudHsmCluster_RequestOrValidate_Restore_MaximumSet_Gen.json + */ + /** + * Sample code: CloudHsmCluster_ValidateRestore_MaximumSet_Gen. + * + * @param manager Entry point to HardwareSecurityModulesManager. + */ + public static void cloudHsmClusterValidateRestoreMaximumSetGen( + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { + manager.cloudHsmClusters() + .validateRestoreProperties("rgcloudhsm", "chsm1", + new RestoreRequestProperties() + .withAzureStorageBlobContainerUri( + "https://myaccount.blob.core.windows.net/sascontainer/sasContainer") + .withBackupId("backupId"), + com.azure.core.util.Context.NONE); + } +} +``` + +### DedicatedHsm_ListOutboundNetworkDependenciesEndpoints + +```java +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/OperationsList.json + */ + /** + * Sample code: Get a list of Payment HSM operations. + * + * @param manager Entry point to HardwareSecurityModulesManager. + */ + public static void getAListOfPaymentHSMOperations( + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/OperationsList.json + */ + /** + * Sample code: Get a list of Dedicated HSM operations. + * + * @param manager Entry point to HardwareSecurityModulesManager. + */ + public static void getAListOfDedicatedHSMOperations( + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### DedicatedHsm_Update + +```java +/** + * Samples for DedicatedHsm Delete. + */ +public final class DedicatedHsmDeleteSamples { + /* + * x-ms-original-file: + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/DedicatedHsm_Delete.json + */ + /** + * Sample code: Delete a dedicated HSM. + * + * @param manager Entry point to HardwareSecurityModulesManager. + */ + public static void + deleteADedicatedHSM(com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { + manager.dedicatedHsms().delete("hsm-group", "hsm1", com.azure.core.util.Context.NONE); + } +} +``` + +### Operations_List + +```java +/** + * Samples for PrivateEndpointConnections ListByCloudHsmCluster. + */ +public final class PrivateEndpointConnectionsListByCloudHsmClusterSamples { + /* + * x-ms-original-file: + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/CloudHsmClusterPrivateEndpointConnection_ListByCloudHsmCluster_MaximumSet_Gen.json + */ + /** + * Sample code: CloudHsmClusterPrivateEndpointConnection_ListByResource_MaximumSet_Gen. + * + * @param manager Entry point to HardwareSecurityModulesManager. + */ + public static void cloudHsmClusterPrivateEndpointConnectionListByResourceMaximumSetGen( + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { + manager.privateEndpointConnections() + .listByCloudHsmCluster("rgcloudhsm", "chsm1", com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateEndpointConnections_ListByCloudHsmCluster + +```java +import com.azure.resourcemanager.hardwaresecuritymodules.models.CloudHsmClusterProperties; +import com.azure.resourcemanager.hardwaresecuritymodules.models.CloudHsmClusterSku; +import com.azure.resourcemanager.hardwaresecuritymodules.models.CloudHsmClusterSkuFamily; +import com.azure.resourcemanager.hardwaresecuritymodules.models.CloudHsmClusterSkuName; +import com.azure.resourcemanager.hardwaresecuritymodules.models.ManagedServiceIdentity; +import com.azure.resourcemanager.hardwaresecuritymodules.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.hardwaresecuritymodules.models.PublicNetworkAccess; +import com.azure.resourcemanager.hardwaresecuritymodules.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for CloudHsmClusters CreateOrUpdate. + */ +public final class CloudHsmClustersCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/CloudHsmCluster_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: CloudHsmCluster_CreateOrUpdate_MaximumSet_Gen. + * + * @param manager Entry point to HardwareSecurityModulesManager. + */ + public static void cloudHsmClusterCreateOrUpdateMaximumSetGen( + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { + manager.cloudHsmClusters() + .define("chsm1") + .withRegion("eastus2") + .withExistingResourceGroup("rgcloudhsm") + .withTags(mapOf("Dept", "hsm", "Environment", "dogfood")) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-1", + new UserAssignedIdentity()))) + .withSku(new CloudHsmClusterSku().withFamily(CloudHsmClusterSkuFamily.B) + .withName(CloudHsmClusterSkuName.STANDARD_B1)) + .withProperties(new CloudHsmClusterProperties().withPublicNetworkAccess(PublicNetworkAccess.DISABLED)) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; } } ``` diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/pom.xml b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/pom.xml index 6ef367c2cc93..032fa8532d34 100644 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/pom.xml +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/pom.xml @@ -18,7 +18,7 @@ jar Microsoft Azure SDK for Hardware Security Modules Management - This package contains Microsoft Azure SDK for Hardware Security Modules Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The Azure management API provides a RESTful set of web services that interact with Azure HSM RP. Package tag package-2021-11. + This package contains Microsoft Azure SDK for Hardware Security Modules Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The Azure management API provides a RESTful set of web services that interact with Azure HSM RP. Package tag package-preview-2024-06. https://github.com/Azure/azure-sdk-for-java @@ -45,7 +45,7 @@ UTF-8 0 0 - false + true diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/HardwareSecurityModulesManager.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/HardwareSecurityModulesManager.java index f8df0259a194..c8399d627e00 100644 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/HardwareSecurityModulesManager.java +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/HardwareSecurityModulesManager.java @@ -22,17 +22,31 @@ import com.azure.core.http.policy.UserAgentPolicy; import com.azure.core.management.profile.AzureProfile; import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.hardwaresecuritymodules.fluent.AzureHsmResourceProvider; import com.azure.resourcemanager.hardwaresecuritymodules.implementation.AzureHsmResourceProviderBuilder; +import com.azure.resourcemanager.hardwaresecuritymodules.implementation.CloudHsmClusterBackupStatusImpl; +import com.azure.resourcemanager.hardwaresecuritymodules.implementation.CloudHsmClusterPrivateEndpointConnectionsImpl; +import com.azure.resourcemanager.hardwaresecuritymodules.implementation.CloudHsmClusterPrivateLinkResourcesImpl; +import com.azure.resourcemanager.hardwaresecuritymodules.implementation.CloudHsmClusterRestoreStatusImpl; +import com.azure.resourcemanager.hardwaresecuritymodules.implementation.CloudHsmClustersImpl; import com.azure.resourcemanager.hardwaresecuritymodules.implementation.DedicatedHsmsImpl; import com.azure.resourcemanager.hardwaresecuritymodules.implementation.OperationsImpl; +import com.azure.resourcemanager.hardwaresecuritymodules.implementation.PrivateEndpointConnectionsImpl; +import com.azure.resourcemanager.hardwaresecuritymodules.models.CloudHsmClusterBackupStatus; +import com.azure.resourcemanager.hardwaresecuritymodules.models.CloudHsmClusterPrivateEndpointConnections; +import com.azure.resourcemanager.hardwaresecuritymodules.models.CloudHsmClusterPrivateLinkResources; +import com.azure.resourcemanager.hardwaresecuritymodules.models.CloudHsmClusterRestoreStatus; +import com.azure.resourcemanager.hardwaresecuritymodules.models.CloudHsmClusters; import com.azure.resourcemanager.hardwaresecuritymodules.models.DedicatedHsms; import com.azure.resourcemanager.hardwaresecuritymodules.models.Operations; +import com.azure.resourcemanager.hardwaresecuritymodules.models.PrivateEndpointConnections; import java.time.Duration; import java.time.temporal.ChronoUnit; import java.util.ArrayList; import java.util.List; +import java.util.Map; import java.util.Objects; import java.util.stream.Collectors; @@ -41,10 +55,22 @@ * The Azure management API provides a RESTful set of web services that interact with Azure HSM RP. */ public final class HardwareSecurityModulesManager { - private Operations operations; + private CloudHsmClusters cloudHsmClusters; + + private CloudHsmClusterPrivateLinkResources cloudHsmClusterPrivateLinkResources; + + private CloudHsmClusterPrivateEndpointConnections cloudHsmClusterPrivateEndpointConnections; + + private PrivateEndpointConnections privateEndpointConnections; + + private CloudHsmClusterBackupStatus cloudHsmClusterBackupStatus; + + private CloudHsmClusterRestoreStatus cloudHsmClusterRestoreStatus; private DedicatedHsms dedicatedHsms; + private Operations operations; + private final AzureHsmResourceProvider clientObject; private HardwareSecurityModulesManager(HttpPipeline httpPipeline, AzureProfile profile, @@ -99,6 +125,9 @@ public static Configurable configure() { */ public static final class Configurable { private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + private static final String SDK_VERSION = "version"; + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-resourcemanager-hardwaresecuritymodules.properties"); private HttpClient httpClient; private HttpLogOptions httpLogOptions; @@ -206,12 +235,14 @@ public HardwareSecurityModulesManager authenticate(TokenCredential credential, A Objects.requireNonNull(credential, "'credential' cannot be null."); Objects.requireNonNull(profile, "'profile' cannot be null."); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + StringBuilder userAgentBuilder = new StringBuilder(); userAgentBuilder.append("azsdk-java") .append("-") .append("com.azure.resourcemanager.hardwaresecuritymodules") .append("/") - .append("1.0.0"); + .append(clientVersion); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder.append(" (") .append(Configuration.getGlobalConfiguration().get("java.version")) @@ -258,15 +289,81 @@ public HardwareSecurityModulesManager authenticate(TokenCredential credential, A } /** - * Gets the resource collection API of Operations. + * Gets the resource collection API of CloudHsmClusters. It manages CloudHsmCluster. * - * @return Resource collection API of Operations. + * @return Resource collection API of CloudHsmClusters. */ - public Operations operations() { - if (this.operations == null) { - this.operations = new OperationsImpl(clientObject.getOperations(), this); + public CloudHsmClusters cloudHsmClusters() { + if (this.cloudHsmClusters == null) { + this.cloudHsmClusters = new CloudHsmClustersImpl(clientObject.getCloudHsmClusters(), this); } - return operations; + return cloudHsmClusters; + } + + /** + * Gets the resource collection API of CloudHsmClusterPrivateLinkResources. + * + * @return Resource collection API of CloudHsmClusterPrivateLinkResources. + */ + public CloudHsmClusterPrivateLinkResources cloudHsmClusterPrivateLinkResources() { + if (this.cloudHsmClusterPrivateLinkResources == null) { + this.cloudHsmClusterPrivateLinkResources = new CloudHsmClusterPrivateLinkResourcesImpl( + clientObject.getCloudHsmClusterPrivateLinkResources(), this); + } + return cloudHsmClusterPrivateLinkResources; + } + + /** + * Gets the resource collection API of CloudHsmClusterPrivateEndpointConnections. It manages + * PrivateEndpointConnection. + * + * @return Resource collection API of CloudHsmClusterPrivateEndpointConnections. + */ + public CloudHsmClusterPrivateEndpointConnections cloudHsmClusterPrivateEndpointConnections() { + if (this.cloudHsmClusterPrivateEndpointConnections == null) { + this.cloudHsmClusterPrivateEndpointConnections = new CloudHsmClusterPrivateEndpointConnectionsImpl( + clientObject.getCloudHsmClusterPrivateEndpointConnections(), this); + } + return cloudHsmClusterPrivateEndpointConnections; + } + + /** + * Gets the resource collection API of PrivateEndpointConnections. + * + * @return Resource collection API of PrivateEndpointConnections. + */ + public PrivateEndpointConnections privateEndpointConnections() { + if (this.privateEndpointConnections == null) { + this.privateEndpointConnections + = new PrivateEndpointConnectionsImpl(clientObject.getPrivateEndpointConnections(), this); + } + return privateEndpointConnections; + } + + /** + * Gets the resource collection API of CloudHsmClusterBackupStatus. + * + * @return Resource collection API of CloudHsmClusterBackupStatus. + */ + public CloudHsmClusterBackupStatus cloudHsmClusterBackupStatus() { + if (this.cloudHsmClusterBackupStatus == null) { + this.cloudHsmClusterBackupStatus + = new CloudHsmClusterBackupStatusImpl(clientObject.getCloudHsmClusterBackupStatus(), this); + } + return cloudHsmClusterBackupStatus; + } + + /** + * Gets the resource collection API of CloudHsmClusterRestoreStatus. + * + * @return Resource collection API of CloudHsmClusterRestoreStatus. + */ + public CloudHsmClusterRestoreStatus cloudHsmClusterRestoreStatus() { + if (this.cloudHsmClusterRestoreStatus == null) { + this.cloudHsmClusterRestoreStatus + = new CloudHsmClusterRestoreStatusImpl(clientObject.getCloudHsmClusterRestoreStatus(), this); + } + return cloudHsmClusterRestoreStatus; } /** @@ -281,6 +378,18 @@ public DedicatedHsms dedicatedHsms() { return dedicatedHsms; } + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + /** * Gets wrapped service client AzureHsmResourceProvider providing direct access to the underlying auto-generated API * implementation, based on Azure REST API. diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/AzureHsmResourceProvider.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/AzureHsmResourceProvider.java index 0d4466715200..9df5d59c7e45 100644 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/AzureHsmResourceProvider.java +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/AzureHsmResourceProvider.java @@ -12,7 +12,7 @@ */ public interface AzureHsmResourceProvider { /** - * Gets The ID of the target subscription. + * Gets The ID of the target subscription. The value must be an UUID. * * @return the subscriptionId value. */ @@ -47,11 +47,46 @@ public interface AzureHsmResourceProvider { Duration getDefaultPollInterval(); /** - * Gets the OperationsClient object to access its operations. + * Gets the CloudHsmClustersClient object to access its operations. * - * @return the OperationsClient object. + * @return the CloudHsmClustersClient object. */ - OperationsClient getOperations(); + CloudHsmClustersClient getCloudHsmClusters(); + + /** + * Gets the CloudHsmClusterPrivateLinkResourcesClient object to access its operations. + * + * @return the CloudHsmClusterPrivateLinkResourcesClient object. + */ + CloudHsmClusterPrivateLinkResourcesClient getCloudHsmClusterPrivateLinkResources(); + + /** + * Gets the CloudHsmClusterPrivateEndpointConnectionsClient object to access its operations. + * + * @return the CloudHsmClusterPrivateEndpointConnectionsClient object. + */ + CloudHsmClusterPrivateEndpointConnectionsClient getCloudHsmClusterPrivateEndpointConnections(); + + /** + * Gets the PrivateEndpointConnectionsClient object to access its operations. + * + * @return the PrivateEndpointConnectionsClient object. + */ + PrivateEndpointConnectionsClient getPrivateEndpointConnections(); + + /** + * Gets the CloudHsmClusterBackupStatusClient object to access its operations. + * + * @return the CloudHsmClusterBackupStatusClient object. + */ + CloudHsmClusterBackupStatusClient getCloudHsmClusterBackupStatus(); + + /** + * Gets the CloudHsmClusterRestoreStatusClient object to access its operations. + * + * @return the CloudHsmClusterRestoreStatusClient object. + */ + CloudHsmClusterRestoreStatusClient getCloudHsmClusterRestoreStatus(); /** * Gets the DedicatedHsmsClient object to access its operations. @@ -59,4 +94,11 @@ public interface AzureHsmResourceProvider { * @return the DedicatedHsmsClient object. */ DedicatedHsmsClient getDedicatedHsms(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); } diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/CloudHsmClusterBackupStatusClient.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/CloudHsmClusterBackupStatusClient.java new file mode 100644 index 000000000000..a972254e8f41 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/CloudHsmClusterBackupStatusClient.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.util.Context; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.BackupResultInner; +import com.azure.resourcemanager.hardwaresecuritymodules.models.CloudHsmClusterBackupStatusGetResponse; + +/** + * An instance of this class provides access to all the operations defined in CloudHsmClusterBackupStatusClient. + */ +public interface CloudHsmClusterBackupStatusClient { + /** + * Gets the backup operation status of the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param jobId The id returned as part of the backup request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the backup operation status of the specified Cloud HSM Cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CloudHsmClusterBackupStatusGetResponse getWithResponse(String resourceGroupName, String cloudHsmClusterName, + String jobId, Context context); + + /** + * Gets the backup operation status of the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param jobId The id returned as part of the backup request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the backup operation status of the specified Cloud HSM Cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BackupResultInner get(String resourceGroupName, String cloudHsmClusterName, String jobId); +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/CloudHsmClusterPrivateEndpointConnectionsClient.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/CloudHsmClusterPrivateEndpointConnectionsClient.java new file mode 100644 index 000000000000..3871a5e8af96 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/CloudHsmClusterPrivateEndpointConnectionsClient.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.PrivateEndpointConnectionInner; + +/** + * An instance of this class provides access to all the operations defined in + * CloudHsmClusterPrivateEndpointConnectionsClient. + */ +public interface CloudHsmClusterPrivateEndpointConnectionsClient { + /** + * Creates or updates the private endpoint connection for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param peConnectionName Name of the private endpoint connection associated with the Cloud HSM Cluster. + * @param properties Parameters of the PrivateEndpointConnection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse(String resourceGroupName, String cloudHsmClusterName, + String peConnectionName, PrivateEndpointConnectionInner properties, Context context); + + /** + * Creates or updates the private endpoint connection for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param peConnectionName Name of the private endpoint connection associated with the Cloud HSM Cluster. + * @param properties Parameters of the PrivateEndpointConnection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner create(String resourceGroupName, String cloudHsmClusterName, String peConnectionName, + PrivateEndpointConnectionInner properties); + + /** + * Deletes the private endpoint connection for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param peConnectionName Name of the private endpoint connection associated with the Cloud HSM Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String cloudHsmClusterName, + String peConnectionName); + + /** + * Deletes the private endpoint connection for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param peConnectionName Name of the private endpoint connection associated with the Cloud HSM Cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String cloudHsmClusterName, + String peConnectionName, Context context); + + /** + * Deletes the private endpoint connection for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param peConnectionName Name of the private endpoint connection associated with the Cloud HSM Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String cloudHsmClusterName, String peConnectionName); + + /** + * Deletes the private endpoint connection for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param peConnectionName Name of the private endpoint connection associated with the Cloud HSM Cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String cloudHsmClusterName, String peConnectionName, Context context); + + /** + * Gets the private endpoint connection for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param peConnectionName Name of the private endpoint connection associated with the Cloud HSM Cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection for the Cloud Hsm Cluster along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String cloudHsmClusterName, + String peConnectionName, Context context); + + /** + * Gets the private endpoint connection for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param peConnectionName Name of the private endpoint connection associated with the Cloud HSM Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection for the Cloud Hsm Cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner get(String resourceGroupName, String cloudHsmClusterName, String peConnectionName); +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/CloudHsmClusterPrivateLinkResourcesClient.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/CloudHsmClusterPrivateLinkResourcesClient.java new file mode 100644 index 000000000000..e2a91915c0fc --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/CloudHsmClusterPrivateLinkResourcesClient.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.PrivateLinkResourceInner; + +/** + * An instance of this class provides access to all the operations defined in CloudHsmClusterPrivateLinkResourcesClient. + */ +public interface CloudHsmClusterPrivateLinkResourcesClient { + /** + * Gets the private link resources supported for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources supported for the Cloud Hsm Cluster as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCloudHsmCluster(String resourceGroupName, String cloudHsmClusterName); + + /** + * Gets the private link resources supported for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources supported for the Cloud Hsm Cluster as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCloudHsmCluster(String resourceGroupName, String cloudHsmClusterName, + Context context); +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/CloudHsmClusterRestoreStatusClient.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/CloudHsmClusterRestoreStatusClient.java new file mode 100644 index 000000000000..1d13e6ed369e --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/CloudHsmClusterRestoreStatusClient.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.util.Context; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.RestoreResultInner; +import com.azure.resourcemanager.hardwaresecuritymodules.models.CloudHsmClusterRestoreStatusGetResponse; + +/** + * An instance of this class provides access to all the operations defined in CloudHsmClusterRestoreStatusClient. + */ +public interface CloudHsmClusterRestoreStatusClient { + /** + * Gets the restore operation status of the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param jobId The id returned as part of the backup request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the restore operation status of the specified Cloud HSM Cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CloudHsmClusterRestoreStatusGetResponse getWithResponse(String resourceGroupName, String cloudHsmClusterName, + String jobId, Context context); + + /** + * Gets the restore operation status of the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param jobId The id returned as part of the backup request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the restore operation status of the specified Cloud HSM Cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RestoreResultInner get(String resourceGroupName, String cloudHsmClusterName, String jobId); +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/CloudHsmClustersClient.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/CloudHsmClustersClient.java new file mode 100644 index 000000000000..fd5f3571a52a --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/CloudHsmClustersClient.java @@ -0,0 +1,555 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.BackupResultInner; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.CloudHsmClusterInner; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.RestoreResultInner; +import com.azure.resourcemanager.hardwaresecuritymodules.models.BackupRequestProperties; +import com.azure.resourcemanager.hardwaresecuritymodules.models.CloudHsmClusterPatchParameters; +import com.azure.resourcemanager.hardwaresecuritymodules.models.RestoreRequestProperties; + +/** + * An instance of this class provides access to all the operations defined in CloudHsmClustersClient. + */ +public interface CloudHsmClustersClient { + /** + * Create or Update a Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param body Parameters to create Cloud HSM Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of resource information with extended details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CloudHsmClusterInner> beginCreateOrUpdate(String resourceGroupName, + String cloudHsmClusterName, CloudHsmClusterInner body); + + /** + * Create or Update a Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param body Parameters to create Cloud HSM Cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of resource information with extended details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CloudHsmClusterInner> beginCreateOrUpdate(String resourceGroupName, + String cloudHsmClusterName, CloudHsmClusterInner body, Context context); + + /** + * Create or Update a Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param body Parameters to create Cloud HSM Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource information with extended details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CloudHsmClusterInner createOrUpdate(String resourceGroupName, String cloudHsmClusterName, + CloudHsmClusterInner body); + + /** + * Create or Update a Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param body Parameters to create Cloud HSM Cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource information with extended details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CloudHsmClusterInner createOrUpdate(String resourceGroupName, String cloudHsmClusterName, CloudHsmClusterInner body, + Context context); + + /** + * Update a Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param body Parameters to create Cloud HSM Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of resource information with extended details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CloudHsmClusterInner> beginUpdate(String resourceGroupName, + String cloudHsmClusterName, CloudHsmClusterPatchParameters body); + + /** + * Update a Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param body Parameters to create Cloud HSM Cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of resource information with extended details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CloudHsmClusterInner> beginUpdate(String resourceGroupName, + String cloudHsmClusterName, CloudHsmClusterPatchParameters body, Context context); + + /** + * Update a Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param body Parameters to create Cloud HSM Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource information with extended details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CloudHsmClusterInner update(String resourceGroupName, String cloudHsmClusterName, + CloudHsmClusterPatchParameters body); + + /** + * Update a Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param body Parameters to create Cloud HSM Cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource information with extended details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CloudHsmClusterInner update(String resourceGroupName, String cloudHsmClusterName, + CloudHsmClusterPatchParameters body, Context context); + + /** + * Gets the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified Cloud HSM Cluster along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String cloudHsmClusterName, + Context context); + + /** + * Gets the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified Cloud HSM Cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CloudHsmClusterInner getByResourceGroup(String resourceGroupName, String cloudHsmClusterName); + + /** + * Deletes the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String cloudHsmClusterName); + + /** + * Deletes the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String cloudHsmClusterName, + Context context); + + /** + * Deletes the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String cloudHsmClusterName); + + /** + * Deletes the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String cloudHsmClusterName, Context context); + + /** + * The List operation gets information about the Cloud HSM Clusters associated with the subscription and within the + * specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Cloud HSM Clusters as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * The List operation gets information about the Cloud HSM Clusters associated with the subscription and within the + * specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Cloud HSM Clusters as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, String skiptoken, + Context context); + + /** + * The List operation gets information about the Cloud HSM Clusters associated with the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Cloud HSM Clusters as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * The List operation gets information about the Cloud HSM Clusters associated with the subscription. + * + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Cloud HSM Clusters as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String skiptoken, Context context); + + /** + * Pre Backup operation to validate whether the customer can perform a backup on the Cloud HSM Cluster resource in + * the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of backup operation Result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, BackupResultInner> beginValidateBackupProperties(String resourceGroupName, + String cloudHsmClusterName); + + /** + * Pre Backup operation to validate whether the customer can perform a backup on the Cloud HSM Cluster resource in + * the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param backupRequestProperties Backup Operation Required properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of backup operation Result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, BackupResultInner> beginValidateBackupProperties(String resourceGroupName, + String cloudHsmClusterName, BackupRequestProperties backupRequestProperties, Context context); + + /** + * Pre Backup operation to validate whether the customer can perform a backup on the Cloud HSM Cluster resource in + * the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup operation Result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BackupResultInner validateBackupProperties(String resourceGroupName, String cloudHsmClusterName); + + /** + * Pre Backup operation to validate whether the customer can perform a backup on the Cloud HSM Cluster resource in + * the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param backupRequestProperties Backup Operation Required properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup operation Result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BackupResultInner validateBackupProperties(String resourceGroupName, String cloudHsmClusterName, + BackupRequestProperties backupRequestProperties, Context context); + + /** + * Create a backup of the Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of backup operation Result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, BackupResultInner> beginBackup(String resourceGroupName, + String cloudHsmClusterName); + + /** + * Create a backup of the Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param backupRequestProperties Azure storage Resource Uri. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of backup operation Result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, BackupResultInner> beginBackup(String resourceGroupName, + String cloudHsmClusterName, BackupRequestProperties backupRequestProperties, Context context); + + /** + * Create a backup of the Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup operation Result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BackupResultInner backup(String resourceGroupName, String cloudHsmClusterName); + + /** + * Create a backup of the Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param backupRequestProperties Azure storage Resource Uri. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup operation Result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BackupResultInner backup(String resourceGroupName, String cloudHsmClusterName, + BackupRequestProperties backupRequestProperties, Context context); + + /** + * Queued validating pre restore operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of restore operation properties. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, RestoreResultInner> + beginValidateRestoreProperties(String resourceGroupName, String cloudHsmClusterName); + + /** + * Queued validating pre restore operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param restoreRequestProperties Optional Parameters to validate prior performing a restore operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of restore operation properties. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, RestoreResultInner> beginValidateRestoreProperties( + String resourceGroupName, String cloudHsmClusterName, RestoreRequestProperties restoreRequestProperties, + Context context); + + /** + * Queued validating pre restore operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore operation properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RestoreResultInner validateRestoreProperties(String resourceGroupName, String cloudHsmClusterName); + + /** + * Queued validating pre restore operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param restoreRequestProperties Optional Parameters to validate prior performing a restore operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore operation properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RestoreResultInner validateRestoreProperties(String resourceGroupName, String cloudHsmClusterName, + RestoreRequestProperties restoreRequestProperties, Context context); + + /** + * Restores all key materials of a specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param restoreRequestProperties Restore Operation Required properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of restore operation properties. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, RestoreResultInner> beginRestore(String resourceGroupName, + String cloudHsmClusterName, RestoreRequestProperties restoreRequestProperties); + + /** + * Restores all key materials of a specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param restoreRequestProperties Restore Operation Required properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of restore operation properties. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, RestoreResultInner> beginRestore(String resourceGroupName, + String cloudHsmClusterName, RestoreRequestProperties restoreRequestProperties, Context context); + + /** + * Restores all key materials of a specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param restoreRequestProperties Restore Operation Required properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore operation properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RestoreResultInner restore(String resourceGroupName, String cloudHsmClusterName, + RestoreRequestProperties restoreRequestProperties); + + /** + * Restores all key materials of a specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param restoreRequestProperties Restore Operation Required properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore operation properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RestoreResultInner restore(String resourceGroupName, String cloudHsmClusterName, + RestoreRequestProperties restoreRequestProperties, Context context); +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/DedicatedHsmsClient.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/DedicatedHsmsClient.java index d183682ecdeb..22925598be75 100644 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/DedicatedHsmsClient.java +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/DedicatedHsmsClient.java @@ -22,7 +22,7 @@ public interface DedicatedHsmsClient { /** * Create or Update a dedicated HSM in the specified subscription. * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name Name of the dedicated Hsm. * @param parameters Parameters to create or update the dedicated hsm. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -38,7 +38,7 @@ SyncPoller, DedicatedHsmInner> beginCreateOrUpdate /** * Create or Update a dedicated HSM in the specified subscription. * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name Name of the dedicated Hsm. * @param parameters Parameters to create or update the dedicated hsm. * @param context The context to associate with this operation. @@ -55,7 +55,7 @@ SyncPoller, DedicatedHsmInner> beginCreateOrUpdate /** * Create or Update a dedicated HSM in the specified subscription. * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name Name of the dedicated Hsm. * @param parameters Parameters to create or update the dedicated hsm. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -70,7 +70,7 @@ SyncPoller, DedicatedHsmInner> beginCreateOrUpdate /** * Create or Update a dedicated HSM in the specified subscription. * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name Name of the dedicated Hsm. * @param parameters Parameters to create or update the dedicated hsm. * @param context The context to associate with this operation. @@ -87,8 +87,8 @@ DedicatedHsmInner createOrUpdate(String resourceGroupName, String name, Dedicate /** * Update a dedicated HSM in the specified subscription. * - * @param resourceGroupName The name of the Resource Group to which the server belongs. - * @param name Name of the dedicated HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @param parameters Parameters to patch the dedicated HSM. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.resourcemanager.hardwaresecuritymodules.models.ErrorException thrown if the request is rejected @@ -103,8 +103,8 @@ SyncPoller, DedicatedHsmInner> beginUpdate(String /** * Update a dedicated HSM in the specified subscription. * - * @param resourceGroupName The name of the Resource Group to which the server belongs. - * @param name Name of the dedicated HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @param parameters Parameters to patch the dedicated HSM. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -120,8 +120,8 @@ SyncPoller, DedicatedHsmInner> beginUpdate(String /** * Update a dedicated HSM in the specified subscription. * - * @param resourceGroupName The name of the Resource Group to which the server belongs. - * @param name Name of the dedicated HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @param parameters Parameters to patch the dedicated HSM. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.resourcemanager.hardwaresecuritymodules.models.ErrorException thrown if the request is rejected @@ -135,8 +135,8 @@ SyncPoller, DedicatedHsmInner> beginUpdate(String /** * Update a dedicated HSM in the specified subscription. * - * @param resourceGroupName The name of the Resource Group to which the server belongs. - * @param name Name of the dedicated HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @param parameters Parameters to patch the dedicated HSM. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -152,8 +152,8 @@ DedicatedHsmInner update(String resourceGroupName, String name, DedicatedHsmPatc /** * Deletes the specified Azure Dedicated HSM. * - * @param resourceGroupName The name of the Resource Group to which the dedicated HSM belongs. - * @param name The name of the dedicated HSM to delete. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.resourcemanager.hardwaresecuritymodules.models.ErrorException thrown if the request is rejected * by server. @@ -166,8 +166,8 @@ DedicatedHsmInner update(String resourceGroupName, String name, DedicatedHsmPatc /** * Deletes the specified Azure Dedicated HSM. * - * @param resourceGroupName The name of the Resource Group to which the dedicated HSM belongs. - * @param name The name of the dedicated HSM to delete. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.resourcemanager.hardwaresecuritymodules.models.ErrorException thrown if the request is rejected @@ -181,8 +181,8 @@ DedicatedHsmInner update(String resourceGroupName, String name, DedicatedHsmPatc /** * Deletes the specified Azure Dedicated HSM. * - * @param resourceGroupName The name of the Resource Group to which the dedicated HSM belongs. - * @param name The name of the dedicated HSM to delete. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.resourcemanager.hardwaresecuritymodules.models.ErrorException thrown if the request is rejected * by server. @@ -194,8 +194,8 @@ DedicatedHsmInner update(String resourceGroupName, String name, DedicatedHsmPatc /** * Deletes the specified Azure Dedicated HSM. * - * @param resourceGroupName The name of the Resource Group to which the dedicated HSM belongs. - * @param name The name of the dedicated HSM to delete. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.resourcemanager.hardwaresecuritymodules.models.ErrorException thrown if the request is rejected @@ -208,8 +208,8 @@ DedicatedHsmInner update(String resourceGroupName, String name, DedicatedHsmPatc /** * Gets the specified Azure dedicated HSM. * - * @param resourceGroupName The name of the Resource Group to which the dedicated hsm belongs. - * @param name The name of the dedicated HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.resourcemanager.hardwaresecuritymodules.models.ErrorException thrown if the request is rejected @@ -223,8 +223,8 @@ DedicatedHsmInner update(String resourceGroupName, String name, DedicatedHsmPatc /** * Gets the specified Azure dedicated HSM. * - * @param resourceGroupName The name of the Resource Group to which the dedicated hsm belongs. - * @param name The name of the dedicated HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.resourcemanager.hardwaresecuritymodules.models.ErrorException thrown if the request is rejected * by server. @@ -238,7 +238,7 @@ DedicatedHsmInner update(String resourceGroupName, String name, DedicatedHsmPatc * The List operation gets information about the dedicated hsms associated with the subscription and within the * specified resource group. * - * @param resourceGroupName The name of the Resource Group to which the dedicated HSM belongs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.resourcemanager.hardwaresecuritymodules.models.ErrorException thrown if the request is rejected * by server. @@ -252,7 +252,7 @@ DedicatedHsmInner update(String resourceGroupName, String name, DedicatedHsmPatc * The List operation gets information about the dedicated hsms associated with the subscription and within the * specified resource group. * - * @param resourceGroupName The name of the Resource Group to which the dedicated HSM belongs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param top Maximum number of results to return. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -296,8 +296,8 @@ DedicatedHsmInner update(String resourceGroupName, String name, DedicatedHsmPatc * 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. * - * @param resourceGroupName The name of the Resource Group to which the dedicated hsm belongs. - * @param name The name of the dedicated HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.resourcemanager.hardwaresecuritymodules.models.ErrorException thrown if the request is rejected * by server. @@ -316,8 +316,8 @@ PagedIterable listOutboundNetworkDependenciesE * 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. * - * @param resourceGroupName The name of the Resource Group to which the dedicated hsm belongs. - * @param name The name of the dedicated HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.resourcemanager.hardwaresecuritymodules.models.ErrorException thrown if the request is rejected diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/OperationsClient.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/OperationsClient.java index 79d782a25a91..332478729f32 100644 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/OperationsClient.java +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/OperationsClient.java @@ -8,33 +8,31 @@ import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; -import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.DedicatedHsmOperationInner; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.OperationInner; /** * An instance of this class provides access to all the operations defined in OperationsClient. */ public interface OperationsClient { /** - * Get a list of Dedicated HSM operations. + * Get a list of Hardware Security Modules operations. * - * @throws com.azure.resourcemanager.hardwaresecuritymodules.models.ErrorException thrown if the request is rejected - * by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of Dedicated HSM operations as paginated response with {@link PagedIterable}. + * @return a list of Hardware Security Modules operations as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(); + PagedIterable list(); /** - * Get a list of Dedicated HSM operations. + * Get a list of Hardware Security Modules operations. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.hardwaresecuritymodules.models.ErrorException thrown if the request is rejected - * by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of Dedicated HSM operations as paginated response with {@link PagedIterable}. + * @return a list of Hardware Security Modules operations as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(Context context); + PagedIterable list(Context context); } diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/PrivateEndpointConnectionsClient.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/PrivateEndpointConnectionsClient.java new file mode 100644 index 000000000000..0d485423766a --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/PrivateEndpointConnectionsClient.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.PrivateEndpointConnectionInner; + +/** + * An instance of this class provides access to all the operations defined in PrivateEndpointConnectionsClient. + */ +public interface PrivateEndpointConnectionsClient { + /** + * The List operation gets information about the private endpoint connections associated with the Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of private endpoint connections associated with the specified resource as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCloudHsmCluster(String resourceGroupName, + String cloudHsmClusterName); + + /** + * The List operation gets information about the private endpoint connections associated with the Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of private endpoint connections associated with the specified resource as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCloudHsmCluster(String resourceGroupName, + String cloudHsmClusterName, Context context); +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/models/BackupResultInner.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/models/BackupResultInner.java new file mode 100644 index 000000000000..740d3ccf06d1 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/models/BackupResultInner.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.hardwaresecuritymodules.models.BackupResultProperties; +import java.io.IOException; + +/** + * Backup operation Result. + */ +@Fluent +public final class BackupResultInner implements JsonSerializable { + /* + * Properties of the Cloud HSM Cluster + */ + private BackupResultProperties properties; + + /** + * Creates an instance of BackupResultInner class. + */ + public BackupResultInner() { + } + + /** + * Get the properties property: Properties of the Cloud HSM Cluster. + * + * @return the properties value. + */ + public BackupResultProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of the Cloud HSM Cluster. + * + * @param properties the properties value to set. + * @return the BackupResultInner object itself. + */ + public BackupResultInner withProperties(BackupResultProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BackupResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BackupResultInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the BackupResultInner. + */ + public static BackupResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BackupResultInner deserializedBackupResultInner = new BackupResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedBackupResultInner.properties = BackupResultProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedBackupResultInner; + }); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/models/CloudHsmClusterInner.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/models/CloudHsmClusterInner.java new file mode 100644 index 000000000000..c718aed2e554 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/models/CloudHsmClusterInner.java @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.hardwaresecuritymodules.models.CloudHsmClusterProperties; +import com.azure.resourcemanager.hardwaresecuritymodules.models.CloudHsmClusterResource; +import com.azure.resourcemanager.hardwaresecuritymodules.models.CloudHsmClusterSku; +import com.azure.resourcemanager.hardwaresecuritymodules.models.ManagedServiceIdentity; +import java.io.IOException; +import java.util.Map; + +/** + * Resource information with extended details. + */ +@Fluent +public final class CloudHsmClusterInner extends CloudHsmClusterResource { + /* + * Properties of the Cloud HSM Cluster + */ + private CloudHsmClusterProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of CloudHsmClusterInner class. + */ + public CloudHsmClusterInner() { + } + + /** + * Get the properties property: Properties of the Cloud HSM Cluster. + * + * @return the properties value. + */ + public CloudHsmClusterProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of the Cloud HSM Cluster. + * + * @param properties the properties value to set. + * @return the CloudHsmClusterInner object itself. + */ + public CloudHsmClusterInner withProperties(CloudHsmClusterProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public CloudHsmClusterInner withIdentity(ManagedServiceIdentity identity) { + super.withIdentity(identity); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public CloudHsmClusterInner withSku(CloudHsmClusterSku sku) { + super.withSku(sku); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public CloudHsmClusterInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public CloudHsmClusterInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (properties() != null) { + properties().validate(); + } + if (identity() != null) { + identity().validate(); + } + if (sku() != null) { + sku().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("identity", identity()); + jsonWriter.writeJsonField("sku", sku()); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CloudHsmClusterInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CloudHsmClusterInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CloudHsmClusterInner. + */ + public static CloudHsmClusterInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CloudHsmClusterInner deserializedCloudHsmClusterInner = new CloudHsmClusterInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedCloudHsmClusterInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedCloudHsmClusterInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCloudHsmClusterInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedCloudHsmClusterInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedCloudHsmClusterInner.withTags(tags); + } else if ("identity".equals(fieldName)) { + deserializedCloudHsmClusterInner.withIdentity(ManagedServiceIdentity.fromJson(reader)); + } else if ("sku".equals(fieldName)) { + deserializedCloudHsmClusterInner.withSku(CloudHsmClusterSku.fromJson(reader)); + } else if ("systemData".equals(fieldName)) { + deserializedCloudHsmClusterInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedCloudHsmClusterInner.properties = CloudHsmClusterProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCloudHsmClusterInner; + }); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/models/DedicatedHsmInner.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/models/DedicatedHsmInner.java index c157dc5e3c36..790b84b72c89 100644 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/models/DedicatedHsmInner.java +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/models/DedicatedHsmInner.java @@ -5,13 +5,13 @@ package com.azure.resourcemanager.hardwaresecuritymodules.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; import com.azure.core.management.SystemData; import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; import com.azure.resourcemanager.hardwaresecuritymodules.models.DedicatedHsmProperties; -import com.azure.resourcemanager.hardwaresecuritymodules.models.DedicatedHsmResource; import com.azure.resourcemanager.hardwaresecuritymodules.models.Sku; import java.io.IOException; import java.util.List; @@ -21,17 +21,27 @@ * Resource information with extended details. */ @Fluent -public final class DedicatedHsmInner extends DedicatedHsmResource { +public final class DedicatedHsmInner extends Resource { /* - * Metadata pertaining to creation and last modification of the resource + * SKU details */ - private SystemData systemData; + private Sku sku; + + /* + * The Dedicated Hsm zones. + */ + private List zones; /* * Properties of the dedicated HSM */ private DedicatedHsmProperties properties; + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + /* * The type of the resource. */ @@ -54,12 +64,43 @@ public DedicatedHsmInner() { } /** - * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * Get the sku property: SKU details. * - * @return the systemData value. + * @return the sku value. */ - public SystemData systemData() { - return this.systemData; + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: SKU details. + * + * @param sku the sku value to set. + * @return the DedicatedHsmInner object itself. + */ + public DedicatedHsmInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the zones property: The Dedicated Hsm zones. + * + * @return the zones value. + */ + public List zones() { + return this.zones; + } + + /** + * Set the zones property: The Dedicated Hsm zones. + * + * @param zones the zones value to set. + * @return the DedicatedHsmInner object itself. + */ + public DedicatedHsmInner withZones(List zones) { + this.zones = zones; + return this; } /** @@ -82,6 +123,15 @@ public DedicatedHsmInner withProperties(DedicatedHsmProperties properties) { return this; } + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + /** * Get the type property: The type of the resource. * @@ -112,24 +162,6 @@ public String id() { return this.id; } - /** - * {@inheritDoc} - */ - @Override - public DedicatedHsmInner withSku(Sku sku) { - super.withSku(sku); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public DedicatedHsmInner withZones(List zones) { - super.withZones(zones); - return this; - } - /** * {@inheritDoc} */ @@ -153,17 +185,19 @@ public DedicatedHsmInner withTags(Map tags) { * * @throws IllegalArgumentException thrown if the instance is not valid. */ - @Override public void validate() { + if (sku() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property sku in model DedicatedHsmInner")); + } else { + sku().validate(); + } if (properties() == null) { throw LOGGER.atError() .log(new IllegalArgumentException("Missing required property properties in model DedicatedHsmInner")); } else { properties().validate(); } - if (sku() != null) { - sku().validate(); - } } private static final ClientLogger LOGGER = new ClientLogger(DedicatedHsmInner.class); @@ -176,9 +210,9 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); jsonWriter.writeStringField("location", location()); jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); - jsonWriter.writeJsonField("sku", sku()); - jsonWriter.writeArrayField("zones", zones(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("sku", this.sku); jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeArrayField("zones", this.zones, (writer, element) -> writer.writeString(element)); return jsonWriter.writeEndObject(); } @@ -210,12 +244,12 @@ public static DedicatedHsmInner fromJson(JsonReader jsonReader) throws IOExcepti Map tags = reader.readMap(reader1 -> reader1.getString()); deserializedDedicatedHsmInner.withTags(tags); } else if ("sku".equals(fieldName)) { - deserializedDedicatedHsmInner.withSku(Sku.fromJson(reader)); - } else if ("zones".equals(fieldName)) { - List zones = reader.readArray(reader1 -> reader1.getString()); - deserializedDedicatedHsmInner.withZones(zones); + deserializedDedicatedHsmInner.sku = Sku.fromJson(reader); } else if ("properties".equals(fieldName)) { deserializedDedicatedHsmInner.properties = DedicatedHsmProperties.fromJson(reader); + } else if ("zones".equals(fieldName)) { + List zones = reader.readArray(reader1 -> reader1.getString()); + deserializedDedicatedHsmInner.zones = zones; } else if ("systemData".equals(fieldName)) { deserializedDedicatedHsmInner.systemData = SystemData.fromJson(reader); } else { diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/models/DedicatedHsmOperationInner.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/models/DedicatedHsmOperationInner.java deleted file mode 100644 index 817e6fb51ed0..000000000000 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/models/DedicatedHsmOperationInner.java +++ /dev/null @@ -1,169 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.hardwaresecuritymodules.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import com.azure.resourcemanager.hardwaresecuritymodules.models.DedicatedHsmOperationDisplay; -import java.io.IOException; - -/** - * REST API operation. - */ -@Fluent -public final class DedicatedHsmOperationInner implements JsonSerializable { - /* - * The name of the Dedicated HSM Resource Provider Operation. - */ - private String name; - - /* - * Gets or sets a value indicating whether it is a data plane action - */ - private Boolean isDataAction; - - /* - * The origin of the operation - */ - private String origin; - - /* - * The display string. - */ - private DedicatedHsmOperationDisplay display; - - /** - * Creates an instance of DedicatedHsmOperationInner class. - */ - public DedicatedHsmOperationInner() { - } - - /** - * Get the name property: The name of the Dedicated HSM Resource Provider Operation. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Set the name property: The name of the Dedicated HSM Resource Provider Operation. - * - * @param name the name value to set. - * @return the DedicatedHsmOperationInner object itself. - */ - public DedicatedHsmOperationInner withName(String name) { - this.name = name; - return this; - } - - /** - * Get the isDataAction property: Gets or sets a value indicating whether it is a data plane action. - * - * @return the isDataAction value. - */ - public Boolean isDataAction() { - return this.isDataAction; - } - - /** - * Get the origin property: The origin of the operation. - * - * @return the origin value. - */ - public String origin() { - return this.origin; - } - - /** - * Set the origin property: The origin of the operation. - * - * @param origin the origin value to set. - * @return the DedicatedHsmOperationInner object itself. - */ - public DedicatedHsmOperationInner withOrigin(String origin) { - this.origin = origin; - return this; - } - - /** - * Get the display property: The display string. - * - * @return the display value. - */ - public DedicatedHsmOperationDisplay display() { - return this.display; - } - - /** - * Set the display property: The display string. - * - * @param display the display value to set. - * @return the DedicatedHsmOperationInner object itself. - */ - public DedicatedHsmOperationInner withDisplay(DedicatedHsmOperationDisplay display) { - this.display = display; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (display() != null) { - display().validate(); - } - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - jsonWriter.writeStringField("origin", this.origin); - jsonWriter.writeJsonField("display", this.display); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of DedicatedHsmOperationInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of DedicatedHsmOperationInner if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IOException If an error occurs while reading the DedicatedHsmOperationInner. - */ - public static DedicatedHsmOperationInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - DedicatedHsmOperationInner deserializedDedicatedHsmOperationInner = new DedicatedHsmOperationInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - deserializedDedicatedHsmOperationInner.name = reader.getString(); - } else if ("isDataAction".equals(fieldName)) { - deserializedDedicatedHsmOperationInner.isDataAction = reader.getNullable(JsonReader::getBoolean); - } else if ("origin".equals(fieldName)) { - deserializedDedicatedHsmOperationInner.origin = reader.getString(); - } else if ("display".equals(fieldName)) { - deserializedDedicatedHsmOperationInner.display = DedicatedHsmOperationDisplay.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedDedicatedHsmOperationInner; - }); - } -} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/models/OperationInner.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/models/OperationInner.java new file mode 100644 index 000000000000..6650c4c33ab1 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/models/OperationInner.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.hardwaresecuritymodules.models.ActionType; +import com.azure.resourcemanager.hardwaresecuritymodules.models.OperationDisplay; +import com.azure.resourcemanager.hardwaresecuritymodules.models.Origin; +import java.io.IOException; + +/** + * REST API Operation + * + * Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Fluent +public final class OperationInner implements JsonSerializable { + /* + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + */ + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for + * ARM/control-plane operations. + */ + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + private OperationDisplay display; + + /* + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + * value is "user,system" + */ + private Origin origin; + + /* + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + private ActionType actionType; + + /** + * Creates an instance of OperationInner class. + */ + public OperationInner() { + } + + /** + * Get the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: Localized display information for this particular operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * Get the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + public ActionType actionType() { + return this.actionType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("display", this.display); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationInner. + */ + public static OperationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationInner deserializedOperationInner = new OperationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedOperationInner.name = reader.getString(); + } else if ("isDataAction".equals(fieldName)) { + deserializedOperationInner.isDataAction = reader.getNullable(JsonReader::getBoolean); + } else if ("display".equals(fieldName)) { + deserializedOperationInner.display = OperationDisplay.fromJson(reader); + } else if ("origin".equals(fieldName)) { + deserializedOperationInner.origin = Origin.fromString(reader.getString()); + } else if ("actionType".equals(fieldName)) { + deserializedOperationInner.actionType = ActionType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationInner; + }); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/models/PrivateEndpointConnectionInner.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/models/PrivateEndpointConnectionInner.java new file mode 100644 index 000000000000..5db903d58777 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/models/PrivateEndpointConnectionInner.java @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.hardwaresecuritymodules.models.PrivateEndpointConnectionProperties; +import java.io.IOException; + +/** + * The private endpoint connection resource. + */ +@Fluent +public final class PrivateEndpointConnectionInner extends ProxyResource { + /* + * Resource properties. + */ + private PrivateEndpointConnectionProperties properties; + + /* + * Modified whenever there is a change in the state of private endpoint connection. + */ + private String etag; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of PrivateEndpointConnectionInner class. + */ + public PrivateEndpointConnectionInner() { + } + + /** + * Get the properties property: Resource properties. + * + * @return the properties value. + */ + public PrivateEndpointConnectionProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Resource properties. + * + * @param properties the properties value to set. + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withProperties(PrivateEndpointConnectionProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the etag property: Modified whenever there is a change in the state of private endpoint connection. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: Modified whenever there is a change in the state of private endpoint connection. + * + * @param etag the etag value to set. + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeStringField("etag", this.etag); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateEndpointConnectionInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateEndpointConnectionInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PrivateEndpointConnectionInner. + */ + public static PrivateEndpointConnectionInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateEndpointConnectionInner deserializedPrivateEndpointConnectionInner + = new PrivateEndpointConnectionInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPrivateEndpointConnectionInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedPrivateEndpointConnectionInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedPrivateEndpointConnectionInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedPrivateEndpointConnectionInner.properties + = PrivateEndpointConnectionProperties.fromJson(reader); + } else if ("etag".equals(fieldName)) { + deserializedPrivateEndpointConnectionInner.etag = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedPrivateEndpointConnectionInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateEndpointConnectionInner; + }); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/models/PrivateLinkResourceInner.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/models/PrivateLinkResourceInner.java new file mode 100644 index 000000000000..e480642b2f21 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/models/PrivateLinkResourceInner.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.hardwaresecuritymodules.models.PrivateLinkResourceProperties; +import java.io.IOException; + +/** + * A private link resource. + */ +@Fluent +public final class PrivateLinkResourceInner extends ProxyResource { + /* + * Resource properties. + */ + private PrivateLinkResourceProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of PrivateLinkResourceInner class. + */ + public PrivateLinkResourceInner() { + } + + /** + * Get the properties property: Resource properties. + * + * @return the properties value. + */ + public PrivateLinkResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Resource properties. + * + * @param properties the properties value to set. + * @return the PrivateLinkResourceInner object itself. + */ + public PrivateLinkResourceInner withProperties(PrivateLinkResourceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateLinkResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateLinkResourceInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PrivateLinkResourceInner. + */ + public static PrivateLinkResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateLinkResourceInner deserializedPrivateLinkResourceInner = new PrivateLinkResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPrivateLinkResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedPrivateLinkResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedPrivateLinkResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedPrivateLinkResourceInner.properties = PrivateLinkResourceProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedPrivateLinkResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateLinkResourceInner; + }); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/models/RestoreResultInner.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/models/RestoreResultInner.java new file mode 100644 index 000000000000..8101c07165f0 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/fluent/models/RestoreResultInner.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.hardwaresecuritymodules.models.BackupRestoreBaseResultProperties; +import java.io.IOException; + +/** + * Restore operation properties. + */ +@Fluent +public final class RestoreResultInner implements JsonSerializable { + /* + * Backup and Restore operation common properties + */ + private BackupRestoreBaseResultProperties properties; + + /** + * Creates an instance of RestoreResultInner class. + */ + public RestoreResultInner() { + } + + /** + * Get the properties property: Backup and Restore operation common properties. + * + * @return the properties value. + */ + public BackupRestoreBaseResultProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Backup and Restore operation common properties. + * + * @param properties the properties value to set. + * @return the RestoreResultInner object itself. + */ + public RestoreResultInner withProperties(BackupRestoreBaseResultProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestoreResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestoreResultInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the RestoreResultInner. + */ + public static RestoreResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestoreResultInner deserializedRestoreResultInner = new RestoreResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedRestoreResultInner.properties = BackupRestoreBaseResultProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedRestoreResultInner; + }); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/AzureHsmResourceProviderBuilder.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/AzureHsmResourceProviderBuilder.java index b85c3c845e0c..c1dc1f47a7e9 100644 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/AzureHsmResourceProviderBuilder.java +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/AzureHsmResourceProviderBuilder.java @@ -20,12 +20,12 @@ @ServiceClientBuilder(serviceClients = { AzureHsmResourceProviderImpl.class }) public final class AzureHsmResourceProviderBuilder { /* - * The ID of the target subscription. + * The ID of the target subscription. The value must be an UUID. */ private String subscriptionId; /** - * Sets The ID of the target subscription. + * Sets The ID of the target subscription. The value must be an UUID. * * @param subscriptionId the subscriptionId value. * @return the AzureHsmResourceProviderBuilder. diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/AzureHsmResourceProviderImpl.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/AzureHsmResourceProviderImpl.java index 754754425742..2a7da9c0da3e 100644 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/AzureHsmResourceProviderImpl.java +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/AzureHsmResourceProviderImpl.java @@ -24,8 +24,14 @@ import com.azure.core.util.serializer.SerializerAdapter; import com.azure.core.util.serializer.SerializerEncoding; import com.azure.resourcemanager.hardwaresecuritymodules.fluent.AzureHsmResourceProvider; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.CloudHsmClusterBackupStatusClient; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.CloudHsmClusterPrivateEndpointConnectionsClient; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.CloudHsmClusterPrivateLinkResourcesClient; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.CloudHsmClusterRestoreStatusClient; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.CloudHsmClustersClient; import com.azure.resourcemanager.hardwaresecuritymodules.fluent.DedicatedHsmsClient; import com.azure.resourcemanager.hardwaresecuritymodules.fluent.OperationsClient; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.PrivateEndpointConnectionsClient; import java.io.IOException; import java.lang.reflect.Type; import java.nio.ByteBuffer; @@ -41,12 +47,12 @@ @ServiceClient(builder = AzureHsmResourceProviderBuilder.class) public final class AzureHsmResourceProviderImpl implements AzureHsmResourceProvider { /** - * The ID of the target subscription. + * The ID of the target subscription. The value must be an UUID. */ private final String subscriptionId; /** - * Gets The ID of the target subscription. + * Gets The ID of the target subscription. The value must be an UUID. * * @return the subscriptionId value. */ @@ -125,17 +131,87 @@ public Duration getDefaultPollInterval() { } /** - * The OperationsClient object to access its operations. + * The CloudHsmClustersClient object to access its operations. */ - private final OperationsClient operations; + private final CloudHsmClustersClient cloudHsmClusters; /** - * Gets the OperationsClient object to access its operations. + * Gets the CloudHsmClustersClient object to access its operations. * - * @return the OperationsClient object. + * @return the CloudHsmClustersClient object. */ - public OperationsClient getOperations() { - return this.operations; + public CloudHsmClustersClient getCloudHsmClusters() { + return this.cloudHsmClusters; + } + + /** + * The CloudHsmClusterPrivateLinkResourcesClient object to access its operations. + */ + private final CloudHsmClusterPrivateLinkResourcesClient cloudHsmClusterPrivateLinkResources; + + /** + * Gets the CloudHsmClusterPrivateLinkResourcesClient object to access its operations. + * + * @return the CloudHsmClusterPrivateLinkResourcesClient object. + */ + public CloudHsmClusterPrivateLinkResourcesClient getCloudHsmClusterPrivateLinkResources() { + return this.cloudHsmClusterPrivateLinkResources; + } + + /** + * The CloudHsmClusterPrivateEndpointConnectionsClient object to access its operations. + */ + private final CloudHsmClusterPrivateEndpointConnectionsClient cloudHsmClusterPrivateEndpointConnections; + + /** + * Gets the CloudHsmClusterPrivateEndpointConnectionsClient object to access its operations. + * + * @return the CloudHsmClusterPrivateEndpointConnectionsClient object. + */ + public CloudHsmClusterPrivateEndpointConnectionsClient getCloudHsmClusterPrivateEndpointConnections() { + return this.cloudHsmClusterPrivateEndpointConnections; + } + + /** + * The PrivateEndpointConnectionsClient object to access its operations. + */ + private final PrivateEndpointConnectionsClient privateEndpointConnections; + + /** + * Gets the PrivateEndpointConnectionsClient object to access its operations. + * + * @return the PrivateEndpointConnectionsClient object. + */ + public PrivateEndpointConnectionsClient getPrivateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** + * The CloudHsmClusterBackupStatusClient object to access its operations. + */ + private final CloudHsmClusterBackupStatusClient cloudHsmClusterBackupStatus; + + /** + * Gets the CloudHsmClusterBackupStatusClient object to access its operations. + * + * @return the CloudHsmClusterBackupStatusClient object. + */ + public CloudHsmClusterBackupStatusClient getCloudHsmClusterBackupStatus() { + return this.cloudHsmClusterBackupStatus; + } + + /** + * The CloudHsmClusterRestoreStatusClient object to access its operations. + */ + private final CloudHsmClusterRestoreStatusClient cloudHsmClusterRestoreStatus; + + /** + * Gets the CloudHsmClusterRestoreStatusClient object to access its operations. + * + * @return the CloudHsmClusterRestoreStatusClient object. + */ + public CloudHsmClusterRestoreStatusClient getCloudHsmClusterRestoreStatus() { + return this.cloudHsmClusterRestoreStatus; } /** @@ -152,6 +228,20 @@ public DedicatedHsmsClient getDedicatedHsms() { return this.dedicatedHsms; } + /** + * The OperationsClient object to access its operations. + */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + /** * Initializes an instance of AzureHsmResourceProvider client. * @@ -159,7 +249,7 @@ public DedicatedHsmsClient getDedicatedHsms() { * @param serializerAdapter The serializer to serialize an object into a string. * @param defaultPollInterval The default poll interval for long-running operation. * @param environment The Azure environment. - * @param subscriptionId The ID of the target subscription. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. * @param endpoint server parameter. */ AzureHsmResourceProviderImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, @@ -169,9 +259,15 @@ public DedicatedHsmsClient getDedicatedHsms() { this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2021-11-30"; - this.operations = new OperationsClientImpl(this); + this.apiVersion = "2024-06-30-preview"; + this.cloudHsmClusters = new CloudHsmClustersClientImpl(this); + this.cloudHsmClusterPrivateLinkResources = new CloudHsmClusterPrivateLinkResourcesClientImpl(this); + this.cloudHsmClusterPrivateEndpointConnections = new CloudHsmClusterPrivateEndpointConnectionsClientImpl(this); + this.privateEndpointConnections = new PrivateEndpointConnectionsClientImpl(this); + this.cloudHsmClusterBackupStatus = new CloudHsmClusterBackupStatusClientImpl(this); + this.cloudHsmClusterRestoreStatus = new CloudHsmClusterRestoreStatusClientImpl(this); this.dedicatedHsms = new DedicatedHsmsClientImpl(this); + this.operations = new OperationsClientImpl(this); } /** diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/BackupResultImpl.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/BackupResultImpl.java new file mode 100644 index 000000000000..bcb6071fe079 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/BackupResultImpl.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.implementation; + +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.BackupResultInner; +import com.azure.resourcemanager.hardwaresecuritymodules.models.BackupResult; +import com.azure.resourcemanager.hardwaresecuritymodules.models.BackupResultProperties; + +public final class BackupResultImpl implements BackupResult { + private BackupResultInner innerObject; + + private final com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager serviceManager; + + BackupResultImpl(BackupResultInner innerObject, + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public BackupResultProperties properties() { + return this.innerModel().properties(); + } + + public BackupResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/CloudHsmClusterBackupStatusClientImpl.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/CloudHsmClusterBackupStatusClientImpl.java new file mode 100644 index 000000000000..087d2c3798c7 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/CloudHsmClusterBackupStatusClientImpl.java @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.CloudHsmClusterBackupStatusClient; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.BackupResultInner; +import com.azure.resourcemanager.hardwaresecuritymodules.models.CloudHsmClusterBackupStatusGetResponse; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in CloudHsmClusterBackupStatusClient. + */ +public final class CloudHsmClusterBackupStatusClientImpl implements CloudHsmClusterBackupStatusClient { + /** + * The proxy service used to perform REST calls. + */ + private final CloudHsmClusterBackupStatusService service; + + /** + * The service client containing this operation class. + */ + private final AzureHsmResourceProviderImpl client; + + /** + * Initializes an instance of CloudHsmClusterBackupStatusClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CloudHsmClusterBackupStatusClientImpl(AzureHsmResourceProviderImpl client) { + this.service = RestProxy.create(CloudHsmClusterBackupStatusService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureHsmResourceProviderCloudHsmClusterBackupStatus to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureHsmResourceProv") + public interface CloudHsmClusterBackupStatusService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/backupOperationStatus/{jobId}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono get(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudHsmClusterName") String cloudHsmClusterName, @QueryParam("api-version") String apiVersion, + @PathParam("jobId") String jobId, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets the backup operation status of the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param jobId The id returned as part of the backup request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the backup operation status of the specified Cloud HSM Cluster on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getWithResponseAsync(String resourceGroupName, + String cloudHsmClusterName, String jobId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudHsmClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudHsmClusterName is required and cannot be null.")); + } + if (jobId == null) { + return Mono.error(new IllegalArgumentException("Parameter jobId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, cloudHsmClusterName, this.client.getApiVersion(), jobId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the backup operation status of the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param jobId The id returned as part of the backup request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the backup operation status of the specified Cloud HSM Cluster on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getWithResponseAsync(String resourceGroupName, + String cloudHsmClusterName, String jobId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudHsmClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudHsmClusterName is required and cannot be null.")); + } + if (jobId == null) { + return Mono.error(new IllegalArgumentException("Parameter jobId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + cloudHsmClusterName, this.client.getApiVersion(), jobId, accept, context); + } + + /** + * Gets the backup operation status of the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param jobId The id returned as part of the backup request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the backup operation status of the specified Cloud HSM Cluster on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String cloudHsmClusterName, String jobId) { + return getWithResponseAsync(resourceGroupName, cloudHsmClusterName, jobId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the backup operation status of the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param jobId The id returned as part of the backup request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the backup operation status of the specified Cloud HSM Cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CloudHsmClusterBackupStatusGetResponse getWithResponse(String resourceGroupName, String cloudHsmClusterName, + String jobId, Context context) { + return getWithResponseAsync(resourceGroupName, cloudHsmClusterName, jobId, context).block(); + } + + /** + * Gets the backup operation status of the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param jobId The id returned as part of the backup request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the backup operation status of the specified Cloud HSM Cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BackupResultInner get(String resourceGroupName, String cloudHsmClusterName, String jobId) { + return getWithResponse(resourceGroupName, cloudHsmClusterName, jobId, Context.NONE).getValue(); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/CloudHsmClusterBackupStatusImpl.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/CloudHsmClusterBackupStatusImpl.java new file mode 100644 index 000000000000..57c18645c134 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/CloudHsmClusterBackupStatusImpl.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.CloudHsmClusterBackupStatusClient; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.BackupResultInner; +import com.azure.resourcemanager.hardwaresecuritymodules.models.BackupResult; +import com.azure.resourcemanager.hardwaresecuritymodules.models.CloudHsmClusterBackupStatus; +import com.azure.resourcemanager.hardwaresecuritymodules.models.CloudHsmClusterBackupStatusGetResponse; + +public final class CloudHsmClusterBackupStatusImpl implements CloudHsmClusterBackupStatus { + private static final ClientLogger LOGGER = new ClientLogger(CloudHsmClusterBackupStatusImpl.class); + + private final CloudHsmClusterBackupStatusClient innerClient; + + private final com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager serviceManager; + + public CloudHsmClusterBackupStatusImpl(CloudHsmClusterBackupStatusClient innerClient, + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String cloudHsmClusterName, String jobId, + Context context) { + CloudHsmClusterBackupStatusGetResponse inner + = this.serviceClient().getWithResponse(resourceGroupName, cloudHsmClusterName, jobId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new BackupResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public BackupResult get(String resourceGroupName, String cloudHsmClusterName, String jobId) { + BackupResultInner inner = this.serviceClient().get(resourceGroupName, cloudHsmClusterName, jobId); + if (inner != null) { + return new BackupResultImpl(inner, this.manager()); + } else { + return null; + } + } + + private CloudHsmClusterBackupStatusClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/CloudHsmClusterImpl.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/CloudHsmClusterImpl.java new file mode 100644 index 000000000000..e789beddfcb5 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/CloudHsmClusterImpl.java @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.CloudHsmClusterInner; +import com.azure.resourcemanager.hardwaresecuritymodules.models.BackupRequestProperties; +import com.azure.resourcemanager.hardwaresecuritymodules.models.BackupResult; +import com.azure.resourcemanager.hardwaresecuritymodules.models.CloudHsmCluster; +import com.azure.resourcemanager.hardwaresecuritymodules.models.CloudHsmClusterPatchParameters; +import com.azure.resourcemanager.hardwaresecuritymodules.models.CloudHsmClusterProperties; +import com.azure.resourcemanager.hardwaresecuritymodules.models.CloudHsmClusterSku; +import com.azure.resourcemanager.hardwaresecuritymodules.models.ManagedServiceIdentity; +import com.azure.resourcemanager.hardwaresecuritymodules.models.RestoreRequestProperties; +import com.azure.resourcemanager.hardwaresecuritymodules.models.RestoreResult; +import java.util.Collections; +import java.util.Map; + +public final class CloudHsmClusterImpl implements CloudHsmCluster, CloudHsmCluster.Definition, CloudHsmCluster.Update { + private CloudHsmClusterInner innerObject; + + private final com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + public CloudHsmClusterSku sku() { + return this.innerModel().sku(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public CloudHsmClusterProperties properties() { + return this.innerModel().properties(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public CloudHsmClusterInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String cloudHsmClusterName; + + private CloudHsmClusterPatchParameters updateBody; + + public CloudHsmClusterImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public CloudHsmCluster create() { + this.innerObject = serviceManager.serviceClient() + .getCloudHsmClusters() + .createOrUpdate(resourceGroupName, cloudHsmClusterName, this.innerModel(), Context.NONE); + return this; + } + + public CloudHsmCluster create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getCloudHsmClusters() + .createOrUpdate(resourceGroupName, cloudHsmClusterName, this.innerModel(), context); + return this; + } + + CloudHsmClusterImpl(String name, + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager serviceManager) { + this.innerObject = new CloudHsmClusterInner(); + this.serviceManager = serviceManager; + this.cloudHsmClusterName = name; + } + + public CloudHsmClusterImpl update() { + this.updateBody = new CloudHsmClusterPatchParameters(); + return this; + } + + public CloudHsmCluster apply() { + this.innerObject = serviceManager.serviceClient() + .getCloudHsmClusters() + .update(resourceGroupName, cloudHsmClusterName, updateBody, Context.NONE); + return this; + } + + public CloudHsmCluster apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getCloudHsmClusters() + .update(resourceGroupName, cloudHsmClusterName, updateBody, context); + return this; + } + + CloudHsmClusterImpl(CloudHsmClusterInner innerObject, + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.cloudHsmClusterName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "cloudHsmClusters"); + } + + public CloudHsmCluster refresh() { + this.innerObject = serviceManager.serviceClient() + .getCloudHsmClusters() + .getByResourceGroupWithResponse(resourceGroupName, cloudHsmClusterName, Context.NONE) + .getValue(); + return this; + } + + public CloudHsmCluster refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getCloudHsmClusters() + .getByResourceGroupWithResponse(resourceGroupName, cloudHsmClusterName, context) + .getValue(); + return this; + } + + public BackupResult validateBackupProperties() { + return serviceManager.cloudHsmClusters().validateBackupProperties(resourceGroupName, cloudHsmClusterName); + } + + public BackupResult validateBackupProperties(BackupRequestProperties backupRequestProperties, Context context) { + return serviceManager.cloudHsmClusters() + .validateBackupProperties(resourceGroupName, cloudHsmClusterName, backupRequestProperties, context); + } + + public BackupResult backup() { + return serviceManager.cloudHsmClusters().backup(resourceGroupName, cloudHsmClusterName); + } + + public BackupResult backup(BackupRequestProperties backupRequestProperties, Context context) { + return serviceManager.cloudHsmClusters() + .backup(resourceGroupName, cloudHsmClusterName, backupRequestProperties, context); + } + + public RestoreResult validateRestoreProperties() { + return serviceManager.cloudHsmClusters().validateRestoreProperties(resourceGroupName, cloudHsmClusterName); + } + + public RestoreResult validateRestoreProperties(RestoreRequestProperties restoreRequestProperties, Context context) { + return serviceManager.cloudHsmClusters() + .validateRestoreProperties(resourceGroupName, cloudHsmClusterName, restoreRequestProperties, context); + } + + public RestoreResult restore(RestoreRequestProperties restoreRequestProperties) { + return serviceManager.cloudHsmClusters() + .restore(resourceGroupName, cloudHsmClusterName, restoreRequestProperties); + } + + public RestoreResult restore(RestoreRequestProperties restoreRequestProperties, Context context) { + return serviceManager.cloudHsmClusters() + .restore(resourceGroupName, cloudHsmClusterName, restoreRequestProperties, context); + } + + public CloudHsmClusterImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public CloudHsmClusterImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public CloudHsmClusterImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateBody.withTags(tags); + return this; + } + } + + public CloudHsmClusterImpl withIdentity(ManagedServiceIdentity identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateBody.withIdentity(identity); + return this; + } + } + + public CloudHsmClusterImpl withSku(CloudHsmClusterSku sku) { + this.innerModel().withSku(sku); + return this; + } + + public CloudHsmClusterImpl withProperties(CloudHsmClusterProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/CloudHsmClusterPrivateEndpointConnectionsClientImpl.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/CloudHsmClusterPrivateEndpointConnectionsClientImpl.java new file mode 100644 index 000000000000..07e72e533c46 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/CloudHsmClusterPrivateEndpointConnectionsClientImpl.java @@ -0,0 +1,644 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.CloudHsmClusterPrivateEndpointConnectionsClient; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.PrivateEndpointConnectionInner; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * CloudHsmClusterPrivateEndpointConnectionsClient. + */ +public final class CloudHsmClusterPrivateEndpointConnectionsClientImpl + implements CloudHsmClusterPrivateEndpointConnectionsClient { + /** + * The proxy service used to perform REST calls. + */ + private final CloudHsmClusterPrivateEndpointConnectionsService service; + + /** + * The service client containing this operation class. + */ + private final AzureHsmResourceProviderImpl client; + + /** + * Initializes an instance of CloudHsmClusterPrivateEndpointConnectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CloudHsmClusterPrivateEndpointConnectionsClientImpl(AzureHsmResourceProviderImpl client) { + this.service = RestProxy.create(CloudHsmClusterPrivateEndpointConnectionsService.class, + client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureHsmResourceProviderCloudHsmClusterPrivateEndpointConnections to + * be used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureHsmResourceProv") + public interface CloudHsmClusterPrivateEndpointConnectionsService { + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/privateEndpointConnections/{peConnectionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudHsmClusterName") String cloudHsmClusterName, @QueryParam("api-version") String apiVersion, + @PathParam("peConnectionName") String peConnectionName, + @BodyParam("application/json") PrivateEndpointConnectionInner properties, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/privateEndpointConnections/{peConnectionName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudHsmClusterName") String cloudHsmClusterName, @QueryParam("api-version") String apiVersion, + @PathParam("peConnectionName") String peConnectionName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/privateEndpointConnections/{peConnectionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudHsmClusterName") String cloudHsmClusterName, @QueryParam("api-version") String apiVersion, + @PathParam("peConnectionName") String peConnectionName, @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Creates or updates the private endpoint connection for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param peConnectionName Name of the private endpoint connection associated with the Cloud HSM Cluster. + * @param properties Parameters of the PrivateEndpointConnection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(String resourceGroupName, + String cloudHsmClusterName, String peConnectionName, PrivateEndpointConnectionInner properties) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudHsmClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudHsmClusterName is required and cannot be null.")); + } + if (peConnectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter peConnectionName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.create(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + cloudHsmClusterName, this.client.getApiVersion(), peConnectionName, properties, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates the private endpoint connection for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param peConnectionName Name of the private endpoint connection associated with the Cloud HSM Cluster. + * @param properties Parameters of the PrivateEndpointConnection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(String resourceGroupName, + String cloudHsmClusterName, String peConnectionName, PrivateEndpointConnectionInner properties, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudHsmClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudHsmClusterName is required and cannot be null.")); + } + if (peConnectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter peConnectionName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.create(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + cloudHsmClusterName, this.client.getApiVersion(), peConnectionName, properties, accept, context); + } + + /** + * Creates or updates the private endpoint connection for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param peConnectionName Name of the private endpoint connection associated with the Cloud HSM Cluster. + * @param properties Parameters of the PrivateEndpointConnection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String cloudHsmClusterName, + String peConnectionName, PrivateEndpointConnectionInner properties) { + return createWithResponseAsync(resourceGroupName, cloudHsmClusterName, peConnectionName, properties) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates the private endpoint connection for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param peConnectionName Name of the private endpoint connection associated with the Cloud HSM Cluster. + * @param properties Parameters of the PrivateEndpointConnection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(String resourceGroupName, + String cloudHsmClusterName, String peConnectionName, PrivateEndpointConnectionInner properties, + Context context) { + return createWithResponseAsync(resourceGroupName, cloudHsmClusterName, peConnectionName, properties, context) + .block(); + } + + /** + * Creates or updates the private endpoint connection for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param peConnectionName Name of the private endpoint connection associated with the Cloud HSM Cluster. + * @param properties Parameters of the PrivateEndpointConnection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner create(String resourceGroupName, String cloudHsmClusterName, + String peConnectionName, PrivateEndpointConnectionInner properties) { + return createWithResponse(resourceGroupName, cloudHsmClusterName, peConnectionName, properties, Context.NONE) + .getValue(); + } + + /** + * Deletes the private endpoint connection for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param peConnectionName Name of the private endpoint connection associated with the Cloud HSM Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String cloudHsmClusterName, String peConnectionName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudHsmClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudHsmClusterName is required and cannot be null.")); + } + if (peConnectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter peConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, cloudHsmClusterName, this.client.getApiVersion(), peConnectionName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the private endpoint connection for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param peConnectionName Name of the private endpoint connection associated with the Cloud HSM Cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String cloudHsmClusterName, String peConnectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudHsmClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudHsmClusterName is required and cannot be null.")); + } + if (peConnectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter peConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + cloudHsmClusterName, this.client.getApiVersion(), peConnectionName, accept, context); + } + + /** + * Deletes the private endpoint connection for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param peConnectionName Name of the private endpoint connection associated with the Cloud HSM Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String cloudHsmClusterName, + String peConnectionName) { + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, cloudHsmClusterName, peConnectionName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Deletes the private endpoint connection for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param peConnectionName Name of the private endpoint connection associated with the Cloud HSM Cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String cloudHsmClusterName, + String peConnectionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, cloudHsmClusterName, peConnectionName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Deletes the private endpoint connection for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param peConnectionName Name of the private endpoint connection associated with the Cloud HSM Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String cloudHsmClusterName, + String peConnectionName) { + return this.beginDeleteAsync(resourceGroupName, cloudHsmClusterName, peConnectionName).getSyncPoller(); + } + + /** + * Deletes the private endpoint connection for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param peConnectionName Name of the private endpoint connection associated with the Cloud HSM Cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String cloudHsmClusterName, + String peConnectionName, Context context) { + return this.beginDeleteAsync(resourceGroupName, cloudHsmClusterName, peConnectionName, context).getSyncPoller(); + } + + /** + * Deletes the private endpoint connection for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param peConnectionName Name of the private endpoint connection associated with the Cloud HSM Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String cloudHsmClusterName, String peConnectionName) { + return beginDeleteAsync(resourceGroupName, cloudHsmClusterName, peConnectionName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the private endpoint connection for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param peConnectionName Name of the private endpoint connection associated with the Cloud HSM Cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String cloudHsmClusterName, String peConnectionName, + Context context) { + return beginDeleteAsync(resourceGroupName, cloudHsmClusterName, peConnectionName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the private endpoint connection for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param peConnectionName Name of the private endpoint connection associated with the Cloud HSM Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String cloudHsmClusterName, String peConnectionName) { + deleteAsync(resourceGroupName, cloudHsmClusterName, peConnectionName).block(); + } + + /** + * Deletes the private endpoint connection for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param peConnectionName Name of the private endpoint connection associated with the Cloud HSM Cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String cloudHsmClusterName, String peConnectionName, Context context) { + deleteAsync(resourceGroupName, cloudHsmClusterName, peConnectionName, context).block(); + } + + /** + * Gets the private endpoint connection for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param peConnectionName Name of the private endpoint connection associated with the Cloud HSM Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection for the Cloud Hsm Cluster along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String cloudHsmClusterName, String peConnectionName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudHsmClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudHsmClusterName is required and cannot be null.")); + } + if (peConnectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter peConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, cloudHsmClusterName, this.client.getApiVersion(), peConnectionName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the private endpoint connection for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param peConnectionName Name of the private endpoint connection associated with the Cloud HSM Cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection for the Cloud Hsm Cluster along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String cloudHsmClusterName, String peConnectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudHsmClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudHsmClusterName is required and cannot be null.")); + } + if (peConnectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter peConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + cloudHsmClusterName, this.client.getApiVersion(), peConnectionName, accept, context); + } + + /** + * Gets the private endpoint connection for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param peConnectionName Name of the private endpoint connection associated with the Cloud HSM Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection for the Cloud Hsm Cluster on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String cloudHsmClusterName, + String peConnectionName) { + return getWithResponseAsync(resourceGroupName, cloudHsmClusterName, peConnectionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the private endpoint connection for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param peConnectionName Name of the private endpoint connection associated with the Cloud HSM Cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection for the Cloud Hsm Cluster along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, + String cloudHsmClusterName, String peConnectionName, Context context) { + return getWithResponseAsync(resourceGroupName, cloudHsmClusterName, peConnectionName, context).block(); + } + + /** + * Gets the private endpoint connection for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param peConnectionName Name of the private endpoint connection associated with the Cloud HSM Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection for the Cloud Hsm Cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner get(String resourceGroupName, String cloudHsmClusterName, + String peConnectionName) { + return getWithResponse(resourceGroupName, cloudHsmClusterName, peConnectionName, Context.NONE).getValue(); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/CloudHsmClusterPrivateEndpointConnectionsImpl.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/CloudHsmClusterPrivateEndpointConnectionsImpl.java new file mode 100644 index 000000000000..437088e6c8c1 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/CloudHsmClusterPrivateEndpointConnectionsImpl.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.CloudHsmClusterPrivateEndpointConnectionsClient; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.hardwaresecuritymodules.models.CloudHsmClusterPrivateEndpointConnections; +import com.azure.resourcemanager.hardwaresecuritymodules.models.PrivateEndpointConnection; + +public final class CloudHsmClusterPrivateEndpointConnectionsImpl implements CloudHsmClusterPrivateEndpointConnections { + private static final ClientLogger LOGGER = new ClientLogger(CloudHsmClusterPrivateEndpointConnectionsImpl.class); + + private final CloudHsmClusterPrivateEndpointConnectionsClient innerClient; + + private final com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager serviceManager; + + public CloudHsmClusterPrivateEndpointConnectionsImpl(CloudHsmClusterPrivateEndpointConnectionsClient innerClient, + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void delete(String resourceGroupName, String cloudHsmClusterName, String peConnectionName) { + this.serviceClient().delete(resourceGroupName, cloudHsmClusterName, peConnectionName); + } + + public void delete(String resourceGroupName, String cloudHsmClusterName, String peConnectionName, Context context) { + this.serviceClient().delete(resourceGroupName, cloudHsmClusterName, peConnectionName, context); + } + + public Response getWithResponse(String resourceGroupName, String cloudHsmClusterName, + String peConnectionName, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, cloudHsmClusterName, peConnectionName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new PrivateEndpointConnectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PrivateEndpointConnection get(String resourceGroupName, String cloudHsmClusterName, + String peConnectionName) { + PrivateEndpointConnectionInner inner + = this.serviceClient().get(resourceGroupName, cloudHsmClusterName, peConnectionName); + if (inner != null) { + return new PrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public PrivateEndpointConnection getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String cloudHsmClusterName = ResourceManagerUtils.getValueFromIdByName(id, "cloudHsmClusters"); + if (cloudHsmClusterName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'cloudHsmClusters'.", id))); + } + String peConnectionName = ResourceManagerUtils.getValueFromIdByName(id, "privateEndpointConnections"); + if (peConnectionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", id))); + } + return this.getWithResponse(resourceGroupName, cloudHsmClusterName, peConnectionName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String cloudHsmClusterName = ResourceManagerUtils.getValueFromIdByName(id, "cloudHsmClusters"); + if (cloudHsmClusterName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'cloudHsmClusters'.", id))); + } + String peConnectionName = ResourceManagerUtils.getValueFromIdByName(id, "privateEndpointConnections"); + if (peConnectionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", id))); + } + return this.getWithResponse(resourceGroupName, cloudHsmClusterName, peConnectionName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String cloudHsmClusterName = ResourceManagerUtils.getValueFromIdByName(id, "cloudHsmClusters"); + if (cloudHsmClusterName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'cloudHsmClusters'.", id))); + } + String peConnectionName = ResourceManagerUtils.getValueFromIdByName(id, "privateEndpointConnections"); + if (peConnectionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", id))); + } + this.delete(resourceGroupName, cloudHsmClusterName, peConnectionName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String cloudHsmClusterName = ResourceManagerUtils.getValueFromIdByName(id, "cloudHsmClusters"); + if (cloudHsmClusterName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'cloudHsmClusters'.", id))); + } + String peConnectionName = ResourceManagerUtils.getValueFromIdByName(id, "privateEndpointConnections"); + if (peConnectionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", id))); + } + this.delete(resourceGroupName, cloudHsmClusterName, peConnectionName, context); + } + + private CloudHsmClusterPrivateEndpointConnectionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager() { + return this.serviceManager; + } + + public PrivateEndpointConnectionImpl define(String name) { + return new PrivateEndpointConnectionImpl(name, this.manager()); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/CloudHsmClusterPrivateLinkResourcesClientImpl.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/CloudHsmClusterPrivateLinkResourcesClientImpl.java new file mode 100644 index 000000000000..15f561e72f51 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/CloudHsmClusterPrivateLinkResourcesClientImpl.java @@ -0,0 +1,298 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.CloudHsmClusterPrivateLinkResourcesClient; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.hardwaresecuritymodules.models.PrivateLinkResourceListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in CloudHsmClusterPrivateLinkResourcesClient. + */ +public final class CloudHsmClusterPrivateLinkResourcesClientImpl implements CloudHsmClusterPrivateLinkResourcesClient { + /** + * The proxy service used to perform REST calls. + */ + private final CloudHsmClusterPrivateLinkResourcesService service; + + /** + * The service client containing this operation class. + */ + private final AzureHsmResourceProviderImpl client; + + /** + * Initializes an instance of CloudHsmClusterPrivateLinkResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CloudHsmClusterPrivateLinkResourcesClientImpl(AzureHsmResourceProviderImpl client) { + this.service = RestProxy.create(CloudHsmClusterPrivateLinkResourcesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureHsmResourceProviderCloudHsmClusterPrivateLinkResources to be + * used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureHsmResourceProv") + public interface CloudHsmClusterPrivateLinkResourcesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/privateLinkResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCloudHsmCluster(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudHsmClusterName") String cloudHsmClusterName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCloudHsmClusterNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets the private link resources supported for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources supported for the Cloud Hsm Cluster along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCloudHsmClusterSinglePageAsync(String resourceGroupName, + String cloudHsmClusterName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudHsmClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudHsmClusterName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByCloudHsmCluster(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, cloudHsmClusterName, this.client.getApiVersion(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the private link resources supported for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources supported for the Cloud Hsm Cluster along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCloudHsmClusterSinglePageAsync(String resourceGroupName, + String cloudHsmClusterName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudHsmClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudHsmClusterName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByCloudHsmCluster(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + cloudHsmClusterName, this.client.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets the private link resources supported for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources supported for the Cloud Hsm Cluster as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByCloudHsmClusterAsync(String resourceGroupName, + String cloudHsmClusterName) { + return new PagedFlux<>(() -> listByCloudHsmClusterSinglePageAsync(resourceGroupName, cloudHsmClusterName), + nextLink -> listByCloudHsmClusterNextSinglePageAsync(nextLink)); + } + + /** + * Gets the private link resources supported for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources supported for the Cloud Hsm Cluster as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByCloudHsmClusterAsync(String resourceGroupName, + String cloudHsmClusterName, Context context) { + return new PagedFlux<>( + () -> listByCloudHsmClusterSinglePageAsync(resourceGroupName, cloudHsmClusterName, context), + nextLink -> listByCloudHsmClusterNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the private link resources supported for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources supported for the Cloud Hsm Cluster as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCloudHsmCluster(String resourceGroupName, + String cloudHsmClusterName) { + return new PagedIterable<>(listByCloudHsmClusterAsync(resourceGroupName, cloudHsmClusterName)); + } + + /** + * Gets the private link resources supported for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources supported for the Cloud Hsm Cluster as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCloudHsmCluster(String resourceGroupName, + String cloudHsmClusterName, Context context) { + return new PagedIterable<>(listByCloudHsmClusterAsync(resourceGroupName, cloudHsmClusterName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private link resources along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCloudHsmClusterNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByCloudHsmClusterNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private link resources along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCloudHsmClusterNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listByCloudHsmClusterNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/CloudHsmClusterPrivateLinkResourcesImpl.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/CloudHsmClusterPrivateLinkResourcesImpl.java new file mode 100644 index 000000000000..08f47c3b661c --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/CloudHsmClusterPrivateLinkResourcesImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.CloudHsmClusterPrivateLinkResourcesClient; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.hardwaresecuritymodules.models.CloudHsmClusterPrivateLinkResources; +import com.azure.resourcemanager.hardwaresecuritymodules.models.PrivateLinkResource; + +public final class CloudHsmClusterPrivateLinkResourcesImpl implements CloudHsmClusterPrivateLinkResources { + private static final ClientLogger LOGGER = new ClientLogger(CloudHsmClusterPrivateLinkResourcesImpl.class); + + private final CloudHsmClusterPrivateLinkResourcesClient innerClient; + + private final com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager serviceManager; + + public CloudHsmClusterPrivateLinkResourcesImpl(CloudHsmClusterPrivateLinkResourcesClient innerClient, + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByCloudHsmCluster(String resourceGroupName, + String cloudHsmClusterName) { + PagedIterable inner + = this.serviceClient().listByCloudHsmCluster(resourceGroupName, cloudHsmClusterName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByCloudHsmCluster(String resourceGroupName, + String cloudHsmClusterName, Context context) { + PagedIterable inner + = this.serviceClient().listByCloudHsmCluster(resourceGroupName, cloudHsmClusterName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); + } + + private CloudHsmClusterPrivateLinkResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/CloudHsmClusterRestoreStatusClientImpl.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/CloudHsmClusterRestoreStatusClientImpl.java new file mode 100644 index 000000000000..3b6d9806bc56 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/CloudHsmClusterRestoreStatusClientImpl.java @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.CloudHsmClusterRestoreStatusClient; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.RestoreResultInner; +import com.azure.resourcemanager.hardwaresecuritymodules.models.CloudHsmClusterRestoreStatusGetResponse; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in CloudHsmClusterRestoreStatusClient. + */ +public final class CloudHsmClusterRestoreStatusClientImpl implements CloudHsmClusterRestoreStatusClient { + /** + * The proxy service used to perform REST calls. + */ + private final CloudHsmClusterRestoreStatusService service; + + /** + * The service client containing this operation class. + */ + private final AzureHsmResourceProviderImpl client; + + /** + * Initializes an instance of CloudHsmClusterRestoreStatusClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CloudHsmClusterRestoreStatusClientImpl(AzureHsmResourceProviderImpl client) { + this.service = RestProxy.create(CloudHsmClusterRestoreStatusService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureHsmResourceProviderCloudHsmClusterRestoreStatus to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureHsmResourceProv") + public interface CloudHsmClusterRestoreStatusService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/restoreOperationStatus/{jobId}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono get(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudHsmClusterName") String cloudHsmClusterName, @QueryParam("api-version") String apiVersion, + @PathParam("jobId") String jobId, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets the restore operation status of the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param jobId The id returned as part of the backup request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the restore operation status of the specified Cloud HSM Cluster on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getWithResponseAsync(String resourceGroupName, + String cloudHsmClusterName, String jobId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudHsmClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudHsmClusterName is required and cannot be null.")); + } + if (jobId == null) { + return Mono.error(new IllegalArgumentException("Parameter jobId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, cloudHsmClusterName, this.client.getApiVersion(), jobId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the restore operation status of the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param jobId The id returned as part of the backup request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the restore operation status of the specified Cloud HSM Cluster on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getWithResponseAsync(String resourceGroupName, + String cloudHsmClusterName, String jobId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudHsmClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudHsmClusterName is required and cannot be null.")); + } + if (jobId == null) { + return Mono.error(new IllegalArgumentException("Parameter jobId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + cloudHsmClusterName, this.client.getApiVersion(), jobId, accept, context); + } + + /** + * Gets the restore operation status of the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param jobId The id returned as part of the backup request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the restore operation status of the specified Cloud HSM Cluster on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String cloudHsmClusterName, String jobId) { + return getWithResponseAsync(resourceGroupName, cloudHsmClusterName, jobId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the restore operation status of the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param jobId The id returned as part of the backup request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the restore operation status of the specified Cloud HSM Cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CloudHsmClusterRestoreStatusGetResponse getWithResponse(String resourceGroupName, String cloudHsmClusterName, + String jobId, Context context) { + return getWithResponseAsync(resourceGroupName, cloudHsmClusterName, jobId, context).block(); + } + + /** + * Gets the restore operation status of the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param jobId The id returned as part of the backup request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the restore operation status of the specified Cloud HSM Cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RestoreResultInner get(String resourceGroupName, String cloudHsmClusterName, String jobId) { + return getWithResponse(resourceGroupName, cloudHsmClusterName, jobId, Context.NONE).getValue(); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/CloudHsmClusterRestoreStatusImpl.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/CloudHsmClusterRestoreStatusImpl.java new file mode 100644 index 000000000000..681b37cce34b --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/CloudHsmClusterRestoreStatusImpl.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.CloudHsmClusterRestoreStatusClient; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.RestoreResultInner; +import com.azure.resourcemanager.hardwaresecuritymodules.models.CloudHsmClusterRestoreStatus; +import com.azure.resourcemanager.hardwaresecuritymodules.models.CloudHsmClusterRestoreStatusGetResponse; +import com.azure.resourcemanager.hardwaresecuritymodules.models.RestoreResult; + +public final class CloudHsmClusterRestoreStatusImpl implements CloudHsmClusterRestoreStatus { + private static final ClientLogger LOGGER = new ClientLogger(CloudHsmClusterRestoreStatusImpl.class); + + private final CloudHsmClusterRestoreStatusClient innerClient; + + private final com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager serviceManager; + + public CloudHsmClusterRestoreStatusImpl(CloudHsmClusterRestoreStatusClient innerClient, + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String cloudHsmClusterName, String jobId, + Context context) { + CloudHsmClusterRestoreStatusGetResponse inner + = this.serviceClient().getWithResponse(resourceGroupName, cloudHsmClusterName, jobId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new RestoreResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public RestoreResult get(String resourceGroupName, String cloudHsmClusterName, String jobId) { + RestoreResultInner inner = this.serviceClient().get(resourceGroupName, cloudHsmClusterName, jobId); + if (inner != null) { + return new RestoreResultImpl(inner, this.manager()); + } else { + return null; + } + } + + private CloudHsmClusterRestoreStatusClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/CloudHsmClustersClientImpl.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/CloudHsmClustersClientImpl.java new file mode 100644 index 000000000000..7aa88deffc13 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/CloudHsmClustersClientImpl.java @@ -0,0 +1,2542 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.CloudHsmClustersClient; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.BackupResultInner; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.CloudHsmClusterInner; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.RestoreResultInner; +import com.azure.resourcemanager.hardwaresecuritymodules.models.BackupRequestProperties; +import com.azure.resourcemanager.hardwaresecuritymodules.models.CloudHsmClusterListResult; +import com.azure.resourcemanager.hardwaresecuritymodules.models.CloudHsmClusterPatchParameters; +import com.azure.resourcemanager.hardwaresecuritymodules.models.RestoreRequestProperties; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in CloudHsmClustersClient. + */ +public final class CloudHsmClustersClientImpl implements CloudHsmClustersClient { + /** + * The proxy service used to perform REST calls. + */ + private final CloudHsmClustersService service; + + /** + * The service client containing this operation class. + */ + private final AzureHsmResourceProviderImpl client; + + /** + * Initializes an instance of CloudHsmClustersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CloudHsmClustersClientImpl(AzureHsmResourceProviderImpl client) { + this.service + = RestProxy.create(CloudHsmClustersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureHsmResourceProviderCloudHsmClusters to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureHsmResourceProv") + public interface CloudHsmClustersService { + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudHsmClusterName") String cloudHsmClusterName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CloudHsmClusterInner body, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudHsmClusterName") String cloudHsmClusterName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CloudHsmClusterPatchParameters body, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudHsmClusterName") String cloudHsmClusterName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudHsmClusterName") String cloudHsmClusterName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("$skiptoken") String skiptoken, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @QueryParam("$skiptoken") String skiptoken, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/validateBackupProperties") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> validateBackupProperties(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudHsmClusterName") String cloudHsmClusterName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") BackupRequestProperties backupRequestProperties, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/backup") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> backup(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudHsmClusterName") String cloudHsmClusterName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") BackupRequestProperties backupRequestProperties, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/validateRestoreProperties") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> validateRestoreProperties(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudHsmClusterName") String cloudHsmClusterName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") RestoreRequestProperties restoreRequestProperties, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/restore") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> restore(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudHsmClusterName") String cloudHsmClusterName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") RestoreRequestProperties restoreRequestProperties, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Create or Update a Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param body Parameters to create Cloud HSM Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource information with extended details along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String cloudHsmClusterName, CloudHsmClusterInner body) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudHsmClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudHsmClusterName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, cloudHsmClusterName, this.client.getApiVersion(), body, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or Update a Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param body Parameters to create Cloud HSM Cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource information with extended details along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String cloudHsmClusterName, CloudHsmClusterInner body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudHsmClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudHsmClusterName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + cloudHsmClusterName, this.client.getApiVersion(), body, accept, context); + } + + /** + * Create or Update a Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param body Parameters to create Cloud HSM Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of resource information with extended details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CloudHsmClusterInner> + beginCreateOrUpdateAsync(String resourceGroupName, String cloudHsmClusterName, CloudHsmClusterInner body) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, cloudHsmClusterName, body); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + CloudHsmClusterInner.class, CloudHsmClusterInner.class, this.client.getContext()); + } + + /** + * Create or Update a Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param body Parameters to create Cloud HSM Cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of resource information with extended details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CloudHsmClusterInner> beginCreateOrUpdateAsync( + String resourceGroupName, String cloudHsmClusterName, CloudHsmClusterInner body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, cloudHsmClusterName, body, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + CloudHsmClusterInner.class, CloudHsmClusterInner.class, context); + } + + /** + * Create or Update a Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param body Parameters to create Cloud HSM Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of resource information with extended details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CloudHsmClusterInner> + beginCreateOrUpdate(String resourceGroupName, String cloudHsmClusterName, CloudHsmClusterInner body) { + return this.beginCreateOrUpdateAsync(resourceGroupName, cloudHsmClusterName, body).getSyncPoller(); + } + + /** + * Create or Update a Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param body Parameters to create Cloud HSM Cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of resource information with extended details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CloudHsmClusterInner> beginCreateOrUpdate( + String resourceGroupName, String cloudHsmClusterName, CloudHsmClusterInner body, Context context) { + return this.beginCreateOrUpdateAsync(resourceGroupName, cloudHsmClusterName, body, context).getSyncPoller(); + } + + /** + * Create or Update a Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param body Parameters to create Cloud HSM Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource information with extended details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String cloudHsmClusterName, + CloudHsmClusterInner body) { + return beginCreateOrUpdateAsync(resourceGroupName, cloudHsmClusterName, body).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or Update a Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param body Parameters to create Cloud HSM Cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource information with extended details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String cloudHsmClusterName, + CloudHsmClusterInner body, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, cloudHsmClusterName, body, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or Update a Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param body Parameters to create Cloud HSM Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource information with extended details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CloudHsmClusterInner createOrUpdate(String resourceGroupName, String cloudHsmClusterName, + CloudHsmClusterInner body) { + return createOrUpdateAsync(resourceGroupName, cloudHsmClusterName, body).block(); + } + + /** + * Create or Update a Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param body Parameters to create Cloud HSM Cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource information with extended details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CloudHsmClusterInner createOrUpdate(String resourceGroupName, String cloudHsmClusterName, + CloudHsmClusterInner body, Context context) { + return createOrUpdateAsync(resourceGroupName, cloudHsmClusterName, body, context).block(); + } + + /** + * Update a Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param body Parameters to create Cloud HSM Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource information with extended details along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String cloudHsmClusterName, CloudHsmClusterPatchParameters body) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudHsmClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudHsmClusterName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, cloudHsmClusterName, this.client.getApiVersion(), body, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param body Parameters to create Cloud HSM Cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource information with extended details along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String cloudHsmClusterName, CloudHsmClusterPatchParameters body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudHsmClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudHsmClusterName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + cloudHsmClusterName, this.client.getApiVersion(), body, accept, context); + } + + /** + * Update a Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param body Parameters to create Cloud HSM Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of resource information with extended details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CloudHsmClusterInner> + beginUpdateAsync(String resourceGroupName, String cloudHsmClusterName, CloudHsmClusterPatchParameters body) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, cloudHsmClusterName, body); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + CloudHsmClusterInner.class, CloudHsmClusterInner.class, this.client.getContext()); + } + + /** + * Update a Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param body Parameters to create Cloud HSM Cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of resource information with extended details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CloudHsmClusterInner> beginUpdateAsync( + String resourceGroupName, String cloudHsmClusterName, CloudHsmClusterPatchParameters body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = updateWithResponseAsync(resourceGroupName, cloudHsmClusterName, body, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + CloudHsmClusterInner.class, CloudHsmClusterInner.class, context); + } + + /** + * Update a Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param body Parameters to create Cloud HSM Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of resource information with extended details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CloudHsmClusterInner> beginUpdate(String resourceGroupName, + String cloudHsmClusterName, CloudHsmClusterPatchParameters body) { + return this.beginUpdateAsync(resourceGroupName, cloudHsmClusterName, body).getSyncPoller(); + } + + /** + * Update a Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param body Parameters to create Cloud HSM Cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of resource information with extended details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CloudHsmClusterInner> beginUpdate(String resourceGroupName, + String cloudHsmClusterName, CloudHsmClusterPatchParameters body, Context context) { + return this.beginUpdateAsync(resourceGroupName, cloudHsmClusterName, body, context).getSyncPoller(); + } + + /** + * Update a Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param body Parameters to create Cloud HSM Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource information with extended details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String cloudHsmClusterName, + CloudHsmClusterPatchParameters body) { + return beginUpdateAsync(resourceGroupName, cloudHsmClusterName, body).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param body Parameters to create Cloud HSM Cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource information with extended details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String cloudHsmClusterName, + CloudHsmClusterPatchParameters body, Context context) { + return beginUpdateAsync(resourceGroupName, cloudHsmClusterName, body, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param body Parameters to create Cloud HSM Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource information with extended details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CloudHsmClusterInner update(String resourceGroupName, String cloudHsmClusterName, + CloudHsmClusterPatchParameters body) { + return updateAsync(resourceGroupName, cloudHsmClusterName, body).block(); + } + + /** + * Update a Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param body Parameters to create Cloud HSM Cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource information with extended details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CloudHsmClusterInner update(String resourceGroupName, String cloudHsmClusterName, + CloudHsmClusterPatchParameters body, Context context) { + return updateAsync(resourceGroupName, cloudHsmClusterName, body, context).block(); + } + + /** + * Gets the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified Cloud HSM Cluster along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String cloudHsmClusterName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudHsmClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudHsmClusterName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, cloudHsmClusterName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified Cloud HSM Cluster along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String cloudHsmClusterName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudHsmClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudHsmClusterName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + cloudHsmClusterName, this.client.getApiVersion(), accept, context); + } + + /** + * Gets the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified Cloud HSM Cluster on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String cloudHsmClusterName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, cloudHsmClusterName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified Cloud HSM Cluster along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String cloudHsmClusterName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, cloudHsmClusterName, context).block(); + } + + /** + * Gets the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified Cloud HSM Cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CloudHsmClusterInner getByResourceGroup(String resourceGroupName, String cloudHsmClusterName) { + return getByResourceGroupWithResponse(resourceGroupName, cloudHsmClusterName, Context.NONE).getValue(); + } + + /** + * Deletes the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String cloudHsmClusterName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudHsmClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudHsmClusterName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, cloudHsmClusterName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String cloudHsmClusterName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudHsmClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudHsmClusterName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + cloudHsmClusterName, this.client.getApiVersion(), accept, context); + } + + /** + * Deletes the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String cloudHsmClusterName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, cloudHsmClusterName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Deletes the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String cloudHsmClusterName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, cloudHsmClusterName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Deletes the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String cloudHsmClusterName) { + return this.beginDeleteAsync(resourceGroupName, cloudHsmClusterName).getSyncPoller(); + } + + /** + * Deletes the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String cloudHsmClusterName, + Context context) { + return this.beginDeleteAsync(resourceGroupName, cloudHsmClusterName, context).getSyncPoller(); + } + + /** + * Deletes the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String cloudHsmClusterName) { + return beginDeleteAsync(resourceGroupName, cloudHsmClusterName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String cloudHsmClusterName, Context context) { + return beginDeleteAsync(resourceGroupName, cloudHsmClusterName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String cloudHsmClusterName) { + deleteAsync(resourceGroupName, cloudHsmClusterName).block(); + } + + /** + * Deletes the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String cloudHsmClusterName, Context context) { + deleteAsync(resourceGroupName, cloudHsmClusterName, context).block(); + } + + /** + * The List operation gets information about the Cloud HSM Clusters associated with the subscription and within the + * specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Cloud HSM Clusters along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, + String skiptoken) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, skiptoken, this.client.getApiVersion(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The List operation gets information about the Cloud HSM Clusters associated with the subscription and within the + * specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Cloud HSM Clusters along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, + String skiptoken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + skiptoken, this.client.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * The List operation gets information about the Cloud HSM Clusters associated with the subscription and within the + * specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Cloud HSM Clusters as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, String skiptoken) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, skiptoken), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * The List operation gets information about the Cloud HSM Clusters associated with the subscription and within the + * specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Cloud HSM Clusters as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + final String skiptoken = null; + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, skiptoken), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * The List operation gets information about the Cloud HSM Clusters associated with the subscription and within the + * specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Cloud HSM Clusters as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, String skiptoken, + Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, skiptoken, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * The List operation gets information about the Cloud HSM Clusters associated with the subscription and within the + * specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Cloud HSM Clusters as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + final String skiptoken = null; + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, skiptoken)); + } + + /** + * The List operation gets information about the Cloud HSM Clusters associated with the subscription and within the + * specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Cloud HSM Clusters as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, String skiptoken, + Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, skiptoken, context)); + } + + /** + * The List operation gets information about the Cloud HSM Clusters associated with the subscription. + * + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Cloud HSM Clusters along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String skiptoken) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), skiptoken, + this.client.getApiVersion(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The List operation gets information about the Cloud HSM Clusters associated with the subscription. + * + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Cloud HSM Clusters along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String skiptoken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), skiptoken, this.client.getApiVersion(), + accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * The List operation gets information about the Cloud HSM Clusters associated with the subscription. + * + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Cloud HSM Clusters as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String skiptoken) { + return new PagedFlux<>(() -> listSinglePageAsync(skiptoken), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * The List operation gets information about the Cloud HSM Clusters associated with the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Cloud HSM Clusters as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String skiptoken = null; + return new PagedFlux<>(() -> listSinglePageAsync(skiptoken), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * The List operation gets information about the Cloud HSM Clusters associated with the subscription. + * + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Cloud HSM Clusters as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String skiptoken, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(skiptoken, context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * The List operation gets information about the Cloud HSM Clusters associated with the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Cloud HSM Clusters as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String skiptoken = null; + return new PagedIterable<>(listAsync(skiptoken)); + } + + /** + * The List operation gets information about the Cloud HSM Clusters associated with the subscription. + * + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Cloud HSM Clusters as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String skiptoken, Context context) { + return new PagedIterable<>(listAsync(skiptoken, context)); + } + + /** + * Pre Backup operation to validate whether the customer can perform a backup on the Cloud HSM Cluster resource in + * the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param backupRequestProperties Backup Operation Required properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup operation Result along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> validateBackupPropertiesWithResponseAsync(String resourceGroupName, + String cloudHsmClusterName, BackupRequestProperties backupRequestProperties) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudHsmClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudHsmClusterName is required and cannot be null.")); + } + if (backupRequestProperties != null) { + backupRequestProperties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.validateBackupProperties(this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, cloudHsmClusterName, this.client.getApiVersion(), + backupRequestProperties, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Pre Backup operation to validate whether the customer can perform a backup on the Cloud HSM Cluster resource in + * the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param backupRequestProperties Backup Operation Required properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup operation Result along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> validateBackupPropertiesWithResponseAsync(String resourceGroupName, + String cloudHsmClusterName, BackupRequestProperties backupRequestProperties, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudHsmClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudHsmClusterName is required and cannot be null.")); + } + if (backupRequestProperties != null) { + backupRequestProperties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.validateBackupProperties(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, cloudHsmClusterName, this.client.getApiVersion(), backupRequestProperties, accept, + context); + } + + /** + * Pre Backup operation to validate whether the customer can perform a backup on the Cloud HSM Cluster resource in + * the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param backupRequestProperties Backup Operation Required properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of backup operation Result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, BackupResultInner> beginValidateBackupPropertiesAsync( + String resourceGroupName, String cloudHsmClusterName, BackupRequestProperties backupRequestProperties) { + Mono>> mono = validateBackupPropertiesWithResponseAsync(resourceGroupName, + cloudHsmClusterName, backupRequestProperties); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + BackupResultInner.class, BackupResultInner.class, this.client.getContext()); + } + + /** + * Pre Backup operation to validate whether the customer can perform a backup on the Cloud HSM Cluster resource in + * the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of backup operation Result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, BackupResultInner> + beginValidateBackupPropertiesAsync(String resourceGroupName, String cloudHsmClusterName) { + final BackupRequestProperties backupRequestProperties = null; + Mono>> mono = validateBackupPropertiesWithResponseAsync(resourceGroupName, + cloudHsmClusterName, backupRequestProperties); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + BackupResultInner.class, BackupResultInner.class, this.client.getContext()); + } + + /** + * Pre Backup operation to validate whether the customer can perform a backup on the Cloud HSM Cluster resource in + * the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param backupRequestProperties Backup Operation Required properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of backup operation Result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, BackupResultInner> beginValidateBackupPropertiesAsync( + String resourceGroupName, String cloudHsmClusterName, BackupRequestProperties backupRequestProperties, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = validateBackupPropertiesWithResponseAsync(resourceGroupName, + cloudHsmClusterName, backupRequestProperties, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + BackupResultInner.class, BackupResultInner.class, context); + } + + /** + * Pre Backup operation to validate whether the customer can perform a backup on the Cloud HSM Cluster resource in + * the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of backup operation Result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, BackupResultInner> + beginValidateBackupProperties(String resourceGroupName, String cloudHsmClusterName) { + final BackupRequestProperties backupRequestProperties = null; + return this.beginValidateBackupPropertiesAsync(resourceGroupName, cloudHsmClusterName, backupRequestProperties) + .getSyncPoller(); + } + + /** + * Pre Backup operation to validate whether the customer can perform a backup on the Cloud HSM Cluster resource in + * the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param backupRequestProperties Backup Operation Required properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of backup operation Result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, BackupResultInner> beginValidateBackupProperties( + String resourceGroupName, String cloudHsmClusterName, BackupRequestProperties backupRequestProperties, + Context context) { + return this + .beginValidateBackupPropertiesAsync(resourceGroupName, cloudHsmClusterName, backupRequestProperties, + context) + .getSyncPoller(); + } + + /** + * Pre Backup operation to validate whether the customer can perform a backup on the Cloud HSM Cluster resource in + * the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param backupRequestProperties Backup Operation Required properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup operation Result on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono validateBackupPropertiesAsync(String resourceGroupName, String cloudHsmClusterName, + BackupRequestProperties backupRequestProperties) { + return beginValidateBackupPropertiesAsync(resourceGroupName, cloudHsmClusterName, backupRequestProperties) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Pre Backup operation to validate whether the customer can perform a backup on the Cloud HSM Cluster resource in + * the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup operation Result on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono validateBackupPropertiesAsync(String resourceGroupName, + String cloudHsmClusterName) { + final BackupRequestProperties backupRequestProperties = null; + return beginValidateBackupPropertiesAsync(resourceGroupName, cloudHsmClusterName, backupRequestProperties) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Pre Backup operation to validate whether the customer can perform a backup on the Cloud HSM Cluster resource in + * the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param backupRequestProperties Backup Operation Required properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup operation Result on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono validateBackupPropertiesAsync(String resourceGroupName, String cloudHsmClusterName, + BackupRequestProperties backupRequestProperties, Context context) { + return beginValidateBackupPropertiesAsync(resourceGroupName, cloudHsmClusterName, backupRequestProperties, + context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Pre Backup operation to validate whether the customer can perform a backup on the Cloud HSM Cluster resource in + * the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup operation Result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BackupResultInner validateBackupProperties(String resourceGroupName, String cloudHsmClusterName) { + final BackupRequestProperties backupRequestProperties = null; + return validateBackupPropertiesAsync(resourceGroupName, cloudHsmClusterName, backupRequestProperties).block(); + } + + /** + * Pre Backup operation to validate whether the customer can perform a backup on the Cloud HSM Cluster resource in + * the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param backupRequestProperties Backup Operation Required properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup operation Result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BackupResultInner validateBackupProperties(String resourceGroupName, String cloudHsmClusterName, + BackupRequestProperties backupRequestProperties, Context context) { + return validateBackupPropertiesAsync(resourceGroupName, cloudHsmClusterName, backupRequestProperties, context) + .block(); + } + + /** + * Create a backup of the Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param backupRequestProperties Azure storage Resource Uri. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup operation Result along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> backupWithResponseAsync(String resourceGroupName, + String cloudHsmClusterName, BackupRequestProperties backupRequestProperties) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudHsmClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudHsmClusterName is required and cannot be null.")); + } + if (backupRequestProperties != null) { + backupRequestProperties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.backup(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + cloudHsmClusterName, this.client.getApiVersion(), backupRequestProperties, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a backup of the Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param backupRequestProperties Azure storage Resource Uri. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup operation Result along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> backupWithResponseAsync(String resourceGroupName, + String cloudHsmClusterName, BackupRequestProperties backupRequestProperties, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudHsmClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudHsmClusterName is required and cannot be null.")); + } + if (backupRequestProperties != null) { + backupRequestProperties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.backup(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + cloudHsmClusterName, this.client.getApiVersion(), backupRequestProperties, accept, context); + } + + /** + * Create a backup of the Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param backupRequestProperties Azure storage Resource Uri. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of backup operation Result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, BackupResultInner> beginBackupAsync(String resourceGroupName, + String cloudHsmClusterName, BackupRequestProperties backupRequestProperties) { + Mono>> mono + = backupWithResponseAsync(resourceGroupName, cloudHsmClusterName, backupRequestProperties); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + BackupResultInner.class, BackupResultInner.class, this.client.getContext()); + } + + /** + * Create a backup of the Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of backup operation Result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, BackupResultInner> beginBackupAsync(String resourceGroupName, + String cloudHsmClusterName) { + final BackupRequestProperties backupRequestProperties = null; + Mono>> mono + = backupWithResponseAsync(resourceGroupName, cloudHsmClusterName, backupRequestProperties); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + BackupResultInner.class, BackupResultInner.class, this.client.getContext()); + } + + /** + * Create a backup of the Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param backupRequestProperties Azure storage Resource Uri. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of backup operation Result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, BackupResultInner> beginBackupAsync(String resourceGroupName, + String cloudHsmClusterName, BackupRequestProperties backupRequestProperties, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = backupWithResponseAsync(resourceGroupName, cloudHsmClusterName, backupRequestProperties, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + BackupResultInner.class, BackupResultInner.class, context); + } + + /** + * Create a backup of the Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of backup operation Result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, BackupResultInner> beginBackup(String resourceGroupName, + String cloudHsmClusterName) { + final BackupRequestProperties backupRequestProperties = null; + return this.beginBackupAsync(resourceGroupName, cloudHsmClusterName, backupRequestProperties).getSyncPoller(); + } + + /** + * Create a backup of the Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param backupRequestProperties Azure storage Resource Uri. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of backup operation Result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, BackupResultInner> beginBackup(String resourceGroupName, + String cloudHsmClusterName, BackupRequestProperties backupRequestProperties, Context context) { + return this.beginBackupAsync(resourceGroupName, cloudHsmClusterName, backupRequestProperties, context) + .getSyncPoller(); + } + + /** + * Create a backup of the Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param backupRequestProperties Azure storage Resource Uri. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup operation Result on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono backupAsync(String resourceGroupName, String cloudHsmClusterName, + BackupRequestProperties backupRequestProperties) { + return beginBackupAsync(resourceGroupName, cloudHsmClusterName, backupRequestProperties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a backup of the Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup operation Result on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono backupAsync(String resourceGroupName, String cloudHsmClusterName) { + final BackupRequestProperties backupRequestProperties = null; + return beginBackupAsync(resourceGroupName, cloudHsmClusterName, backupRequestProperties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a backup of the Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param backupRequestProperties Azure storage Resource Uri. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup operation Result on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono backupAsync(String resourceGroupName, String cloudHsmClusterName, + BackupRequestProperties backupRequestProperties, Context context) { + return beginBackupAsync(resourceGroupName, cloudHsmClusterName, backupRequestProperties, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a backup of the Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup operation Result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BackupResultInner backup(String resourceGroupName, String cloudHsmClusterName) { + final BackupRequestProperties backupRequestProperties = null; + return backupAsync(resourceGroupName, cloudHsmClusterName, backupRequestProperties).block(); + } + + /** + * Create a backup of the Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param backupRequestProperties Azure storage Resource Uri. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup operation Result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BackupResultInner backup(String resourceGroupName, String cloudHsmClusterName, + BackupRequestProperties backupRequestProperties, Context context) { + return backupAsync(resourceGroupName, cloudHsmClusterName, backupRequestProperties, context).block(); + } + + /** + * Queued validating pre restore operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param restoreRequestProperties Optional Parameters to validate prior performing a restore operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore operation properties along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> validateRestorePropertiesWithResponseAsync(String resourceGroupName, + String cloudHsmClusterName, RestoreRequestProperties restoreRequestProperties) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudHsmClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudHsmClusterName is required and cannot be null.")); + } + if (restoreRequestProperties != null) { + restoreRequestProperties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.validateRestoreProperties(this.client.getEndpoint(), + this.client.getSubscriptionId(), resourceGroupName, cloudHsmClusterName, this.client.getApiVersion(), + restoreRequestProperties, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Queued validating pre restore operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param restoreRequestProperties Optional Parameters to validate prior performing a restore operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore operation properties along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> validateRestorePropertiesWithResponseAsync(String resourceGroupName, + String cloudHsmClusterName, RestoreRequestProperties restoreRequestProperties, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudHsmClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudHsmClusterName is required and cannot be null.")); + } + if (restoreRequestProperties != null) { + restoreRequestProperties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.validateRestoreProperties(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, cloudHsmClusterName, this.client.getApiVersion(), restoreRequestProperties, accept, + context); + } + + /** + * Queued validating pre restore operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param restoreRequestProperties Optional Parameters to validate prior performing a restore operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of restore operation properties. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, RestoreResultInner> beginValidateRestorePropertiesAsync( + String resourceGroupName, String cloudHsmClusterName, RestoreRequestProperties restoreRequestProperties) { + Mono>> mono = validateRestorePropertiesWithResponseAsync(resourceGroupName, + cloudHsmClusterName, restoreRequestProperties); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + RestoreResultInner.class, RestoreResultInner.class, this.client.getContext()); + } + + /** + * Queued validating pre restore operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of restore operation properties. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, RestoreResultInner> + beginValidateRestorePropertiesAsync(String resourceGroupName, String cloudHsmClusterName) { + final RestoreRequestProperties restoreRequestProperties = null; + Mono>> mono = validateRestorePropertiesWithResponseAsync(resourceGroupName, + cloudHsmClusterName, restoreRequestProperties); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + RestoreResultInner.class, RestoreResultInner.class, this.client.getContext()); + } + + /** + * Queued validating pre restore operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param restoreRequestProperties Optional Parameters to validate prior performing a restore operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of restore operation properties. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, RestoreResultInner> beginValidateRestorePropertiesAsync( + String resourceGroupName, String cloudHsmClusterName, RestoreRequestProperties restoreRequestProperties, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = validateRestorePropertiesWithResponseAsync(resourceGroupName, + cloudHsmClusterName, restoreRequestProperties, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + RestoreResultInner.class, RestoreResultInner.class, context); + } + + /** + * Queued validating pre restore operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of restore operation properties. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, RestoreResultInner> + beginValidateRestoreProperties(String resourceGroupName, String cloudHsmClusterName) { + final RestoreRequestProperties restoreRequestProperties = null; + return this + .beginValidateRestorePropertiesAsync(resourceGroupName, cloudHsmClusterName, restoreRequestProperties) + .getSyncPoller(); + } + + /** + * Queued validating pre restore operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param restoreRequestProperties Optional Parameters to validate prior performing a restore operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of restore operation properties. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, RestoreResultInner> beginValidateRestoreProperties( + String resourceGroupName, String cloudHsmClusterName, RestoreRequestProperties restoreRequestProperties, + Context context) { + return this + .beginValidateRestorePropertiesAsync(resourceGroupName, cloudHsmClusterName, restoreRequestProperties, + context) + .getSyncPoller(); + } + + /** + * Queued validating pre restore operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param restoreRequestProperties Optional Parameters to validate prior performing a restore operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore operation properties on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono validateRestorePropertiesAsync(String resourceGroupName, + String cloudHsmClusterName, RestoreRequestProperties restoreRequestProperties) { + return beginValidateRestorePropertiesAsync(resourceGroupName, cloudHsmClusterName, restoreRequestProperties) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Queued validating pre restore operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore operation properties on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono validateRestorePropertiesAsync(String resourceGroupName, + String cloudHsmClusterName) { + final RestoreRequestProperties restoreRequestProperties = null; + return beginValidateRestorePropertiesAsync(resourceGroupName, cloudHsmClusterName, restoreRequestProperties) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Queued validating pre restore operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param restoreRequestProperties Optional Parameters to validate prior performing a restore operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore operation properties on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono validateRestorePropertiesAsync(String resourceGroupName, + String cloudHsmClusterName, RestoreRequestProperties restoreRequestProperties, Context context) { + return beginValidateRestorePropertiesAsync(resourceGroupName, cloudHsmClusterName, restoreRequestProperties, + context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Queued validating pre restore operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore operation properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RestoreResultInner validateRestoreProperties(String resourceGroupName, String cloudHsmClusterName) { + final RestoreRequestProperties restoreRequestProperties = null; + return validateRestorePropertiesAsync(resourceGroupName, cloudHsmClusterName, restoreRequestProperties).block(); + } + + /** + * Queued validating pre restore operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param restoreRequestProperties Optional Parameters to validate prior performing a restore operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore operation properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RestoreResultInner validateRestoreProperties(String resourceGroupName, String cloudHsmClusterName, + RestoreRequestProperties restoreRequestProperties, Context context) { + return validateRestorePropertiesAsync(resourceGroupName, cloudHsmClusterName, restoreRequestProperties, context) + .block(); + } + + /** + * Restores all key materials of a specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param restoreRequestProperties Restore Operation Required properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore operation properties along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> restoreWithResponseAsync(String resourceGroupName, + String cloudHsmClusterName, RestoreRequestProperties restoreRequestProperties) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudHsmClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudHsmClusterName is required and cannot be null.")); + } + if (restoreRequestProperties == null) { + return Mono.error( + new IllegalArgumentException("Parameter restoreRequestProperties is required and cannot be null.")); + } else { + restoreRequestProperties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.restore(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, cloudHsmClusterName, this.client.getApiVersion(), restoreRequestProperties, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Restores all key materials of a specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param restoreRequestProperties Restore Operation Required properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore operation properties along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> restoreWithResponseAsync(String resourceGroupName, + String cloudHsmClusterName, RestoreRequestProperties restoreRequestProperties, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudHsmClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudHsmClusterName is required and cannot be null.")); + } + if (restoreRequestProperties == null) { + return Mono.error( + new IllegalArgumentException("Parameter restoreRequestProperties is required and cannot be null.")); + } else { + restoreRequestProperties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.restore(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + cloudHsmClusterName, this.client.getApiVersion(), restoreRequestProperties, accept, context); + } + + /** + * Restores all key materials of a specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param restoreRequestProperties Restore Operation Required properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of restore operation properties. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, RestoreResultInner> beginRestoreAsync(String resourceGroupName, + String cloudHsmClusterName, RestoreRequestProperties restoreRequestProperties) { + Mono>> mono + = restoreWithResponseAsync(resourceGroupName, cloudHsmClusterName, restoreRequestProperties); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + RestoreResultInner.class, RestoreResultInner.class, this.client.getContext()); + } + + /** + * Restores all key materials of a specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param restoreRequestProperties Restore Operation Required properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of restore operation properties. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, RestoreResultInner> beginRestoreAsync(String resourceGroupName, + String cloudHsmClusterName, RestoreRequestProperties restoreRequestProperties, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = restoreWithResponseAsync(resourceGroupName, cloudHsmClusterName, restoreRequestProperties, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + RestoreResultInner.class, RestoreResultInner.class, context); + } + + /** + * Restores all key materials of a specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param restoreRequestProperties Restore Operation Required properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of restore operation properties. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, RestoreResultInner> beginRestore(String resourceGroupName, + String cloudHsmClusterName, RestoreRequestProperties restoreRequestProperties) { + return this.beginRestoreAsync(resourceGroupName, cloudHsmClusterName, restoreRequestProperties).getSyncPoller(); + } + + /** + * Restores all key materials of a specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param restoreRequestProperties Restore Operation Required properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of restore operation properties. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, RestoreResultInner> beginRestore(String resourceGroupName, + String cloudHsmClusterName, RestoreRequestProperties restoreRequestProperties, Context context) { + return this.beginRestoreAsync(resourceGroupName, cloudHsmClusterName, restoreRequestProperties, context) + .getSyncPoller(); + } + + /** + * Restores all key materials of a specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param restoreRequestProperties Restore Operation Required properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore operation properties on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono restoreAsync(String resourceGroupName, String cloudHsmClusterName, + RestoreRequestProperties restoreRequestProperties) { + return beginRestoreAsync(resourceGroupName, cloudHsmClusterName, restoreRequestProperties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Restores all key materials of a specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param restoreRequestProperties Restore Operation Required properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore operation properties on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono restoreAsync(String resourceGroupName, String cloudHsmClusterName, + RestoreRequestProperties restoreRequestProperties, Context context) { + return beginRestoreAsync(resourceGroupName, cloudHsmClusterName, restoreRequestProperties, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Restores all key materials of a specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param restoreRequestProperties Restore Operation Required properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore operation properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RestoreResultInner restore(String resourceGroupName, String cloudHsmClusterName, + RestoreRequestProperties restoreRequestProperties) { + return restoreAsync(resourceGroupName, cloudHsmClusterName, restoreRequestProperties).block(); + } + + /** + * Restores all key materials of a specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param restoreRequestProperties Restore Operation Required properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore operation properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RestoreResultInner restore(String resourceGroupName, String cloudHsmClusterName, + RestoreRequestProperties restoreRequestProperties, Context context) { + return restoreAsync(resourceGroupName, cloudHsmClusterName, restoreRequestProperties, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Cloud HSM Clusters along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Cloud HSM Clusters along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Cloud HSM Clusters along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Cloud HSM Clusters along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/CloudHsmClustersImpl.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/CloudHsmClustersImpl.java new file mode 100644 index 000000000000..5276598e0a70 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/CloudHsmClustersImpl.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.CloudHsmClustersClient; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.BackupResultInner; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.CloudHsmClusterInner; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.RestoreResultInner; +import com.azure.resourcemanager.hardwaresecuritymodules.models.BackupRequestProperties; +import com.azure.resourcemanager.hardwaresecuritymodules.models.BackupResult; +import com.azure.resourcemanager.hardwaresecuritymodules.models.CloudHsmCluster; +import com.azure.resourcemanager.hardwaresecuritymodules.models.CloudHsmClusters; +import com.azure.resourcemanager.hardwaresecuritymodules.models.RestoreRequestProperties; +import com.azure.resourcemanager.hardwaresecuritymodules.models.RestoreResult; + +public final class CloudHsmClustersImpl implements CloudHsmClusters { + private static final ClientLogger LOGGER = new ClientLogger(CloudHsmClustersImpl.class); + + private final CloudHsmClustersClient innerClient; + + private final com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager serviceManager; + + public CloudHsmClustersImpl(CloudHsmClustersClient innerClient, + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, + String cloudHsmClusterName, Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, cloudHsmClusterName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new CloudHsmClusterImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CloudHsmCluster getByResourceGroup(String resourceGroupName, String cloudHsmClusterName) { + CloudHsmClusterInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, cloudHsmClusterName); + if (inner != null) { + return new CloudHsmClusterImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String cloudHsmClusterName) { + this.serviceClient().delete(resourceGroupName, cloudHsmClusterName); + } + + public void delete(String resourceGroupName, String cloudHsmClusterName, Context context) { + this.serviceClient().delete(resourceGroupName, cloudHsmClusterName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new CloudHsmClusterImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, String skiptoken, + Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, skiptoken, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new CloudHsmClusterImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new CloudHsmClusterImpl(inner1, this.manager())); + } + + public PagedIterable list(String skiptoken, Context context) { + PagedIterable inner = this.serviceClient().list(skiptoken, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new CloudHsmClusterImpl(inner1, this.manager())); + } + + public BackupResult validateBackupProperties(String resourceGroupName, String cloudHsmClusterName) { + BackupResultInner inner = this.serviceClient().validateBackupProperties(resourceGroupName, cloudHsmClusterName); + if (inner != null) { + return new BackupResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public BackupResult validateBackupProperties(String resourceGroupName, String cloudHsmClusterName, + BackupRequestProperties backupRequestProperties, Context context) { + BackupResultInner inner = this.serviceClient() + .validateBackupProperties(resourceGroupName, cloudHsmClusterName, backupRequestProperties, context); + if (inner != null) { + return new BackupResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public BackupResult backup(String resourceGroupName, String cloudHsmClusterName) { + BackupResultInner inner = this.serviceClient().backup(resourceGroupName, cloudHsmClusterName); + if (inner != null) { + return new BackupResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public BackupResult backup(String resourceGroupName, String cloudHsmClusterName, + BackupRequestProperties backupRequestProperties, Context context) { + BackupResultInner inner + = this.serviceClient().backup(resourceGroupName, cloudHsmClusterName, backupRequestProperties, context); + if (inner != null) { + return new BackupResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public RestoreResult validateRestoreProperties(String resourceGroupName, String cloudHsmClusterName) { + RestoreResultInner inner + = this.serviceClient().validateRestoreProperties(resourceGroupName, cloudHsmClusterName); + if (inner != null) { + return new RestoreResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public RestoreResult validateRestoreProperties(String resourceGroupName, String cloudHsmClusterName, + RestoreRequestProperties restoreRequestProperties, Context context) { + RestoreResultInner inner = this.serviceClient() + .validateRestoreProperties(resourceGroupName, cloudHsmClusterName, restoreRequestProperties, context); + if (inner != null) { + return new RestoreResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public RestoreResult restore(String resourceGroupName, String cloudHsmClusterName, + RestoreRequestProperties restoreRequestProperties) { + RestoreResultInner inner + = this.serviceClient().restore(resourceGroupName, cloudHsmClusterName, restoreRequestProperties); + if (inner != null) { + return new RestoreResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public RestoreResult restore(String resourceGroupName, String cloudHsmClusterName, + RestoreRequestProperties restoreRequestProperties, Context context) { + RestoreResultInner inner + = this.serviceClient().restore(resourceGroupName, cloudHsmClusterName, restoreRequestProperties, context); + if (inner != null) { + return new RestoreResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public CloudHsmCluster getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String cloudHsmClusterName = ResourceManagerUtils.getValueFromIdByName(id, "cloudHsmClusters"); + if (cloudHsmClusterName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'cloudHsmClusters'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, cloudHsmClusterName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String cloudHsmClusterName = ResourceManagerUtils.getValueFromIdByName(id, "cloudHsmClusters"); + if (cloudHsmClusterName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'cloudHsmClusters'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, cloudHsmClusterName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String cloudHsmClusterName = ResourceManagerUtils.getValueFromIdByName(id, "cloudHsmClusters"); + if (cloudHsmClusterName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'cloudHsmClusters'.", id))); + } + this.delete(resourceGroupName, cloudHsmClusterName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String cloudHsmClusterName = ResourceManagerUtils.getValueFromIdByName(id, "cloudHsmClusters"); + if (cloudHsmClusterName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'cloudHsmClusters'.", id))); + } + this.delete(resourceGroupName, cloudHsmClusterName, context); + } + + private CloudHsmClustersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager() { + return this.serviceManager; + } + + public CloudHsmClusterImpl define(String name) { + return new CloudHsmClusterImpl(name, this.manager()); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/DedicatedHsmImpl.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/DedicatedHsmImpl.java index 1faabcd391b2..20faa3a50329 100644 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/DedicatedHsmImpl.java +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/DedicatedHsmImpl.java @@ -59,14 +59,14 @@ public List zones() { } } - public SystemData systemData() { - return this.innerModel().systemData(); - } - public DedicatedHsmProperties properties() { return this.innerModel().properties(); } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public Region region() { return Region.fromName(this.regionName()); } @@ -172,6 +172,11 @@ public DedicatedHsmImpl withRegion(String location) { return this; } + public DedicatedHsmImpl withSku(Sku sku) { + this.innerModel().withSku(sku); + return this; + } + public DedicatedHsmImpl withProperties(DedicatedHsmProperties properties) { this.innerModel().withProperties(properties); return this; @@ -187,11 +192,6 @@ public DedicatedHsmImpl withTags(Map tags) { } } - public DedicatedHsmImpl withSku(Sku sku) { - this.innerModel().withSku(sku); - return this; - } - public DedicatedHsmImpl withZones(List zones) { this.innerModel().withZones(zones); return this; diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/DedicatedHsmsClientImpl.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/DedicatedHsmsClientImpl.java index 7e882424a846..08005104f453 100644 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/DedicatedHsmsClientImpl.java +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/DedicatedHsmsClientImpl.java @@ -86,7 +86,7 @@ Mono>> createOrUpdate(@HostParam("$host") String endpo @Headers({ "Content-Type: application/json" }) @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}") - @ExpectedResponses({ 200 }) + @ExpectedResponses({ 200, 202 }) @UnexpectedResponseExceptionType(ErrorException.class) Mono>> update(@HostParam("$host") String endpoint, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("name") String name, @@ -96,7 +96,7 @@ Mono>> update(@HostParam("$host") String endpoint, @Headers({ "Content-Type: application/json" }) @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/dedicatedHSMs/{name}") - @ExpectedResponses({ 200, 202, 204 }) + @ExpectedResponses({ 202, 204 }) @UnexpectedResponseExceptionType(ErrorException.class) Mono>> delete(@HostParam("$host") String endpoint, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("name") String name, @@ -166,7 +166,7 @@ Mono> listOutboundNetworkDepende /** * Create or Update a dedicated HSM in the specified subscription. * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name Name of the dedicated Hsm. * @param parameters Parameters to create or update the dedicated hsm. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -208,7 +208,7 @@ private Mono>> createOrUpdateWithResponseAsync(String /** * Create or Update a dedicated HSM in the specified subscription. * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name Name of the dedicated Hsm. * @param parameters Parameters to create or update the dedicated hsm. * @param context The context to associate with this operation. @@ -250,7 +250,7 @@ private Mono>> createOrUpdateWithResponseAsync(String /** * Create or Update a dedicated HSM in the specified subscription. * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name Name of the dedicated Hsm. * @param parameters Parameters to create or update the dedicated hsm. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -269,7 +269,7 @@ private Mono>> createOrUpdateWithResponseAsync(String /** * Create or Update a dedicated HSM in the specified subscription. * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name Name of the dedicated Hsm. * @param parameters Parameters to create or update the dedicated hsm. * @param context The context to associate with this operation. @@ -291,7 +291,7 @@ private Mono>> createOrUpdateWithResponseAsync(String /** * Create or Update a dedicated HSM in the specified subscription. * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name Name of the dedicated Hsm. * @param parameters Parameters to create or update the dedicated hsm. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -308,7 +308,7 @@ public SyncPoller, DedicatedHsmInner> beginCreateO /** * Create or Update a dedicated HSM in the specified subscription. * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name Name of the dedicated Hsm. * @param parameters Parameters to create or update the dedicated hsm. * @param context The context to associate with this operation. @@ -326,7 +326,7 @@ public SyncPoller, DedicatedHsmInner> beginCreateO /** * Create or Update a dedicated HSM in the specified subscription. * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name Name of the dedicated Hsm. * @param parameters Parameters to create or update the dedicated hsm. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -344,7 +344,7 @@ private Mono createOrUpdateAsync(String resourceGroupName, St /** * Create or Update a dedicated HSM in the specified subscription. * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name Name of the dedicated Hsm. * @param parameters Parameters to create or update the dedicated hsm. * @param context The context to associate with this operation. @@ -363,7 +363,7 @@ private Mono createOrUpdateAsync(String resourceGroupName, St /** * Create or Update a dedicated HSM in the specified subscription. * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name Name of the dedicated Hsm. * @param parameters Parameters to create or update the dedicated hsm. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -379,7 +379,7 @@ public DedicatedHsmInner createOrUpdate(String resourceGroupName, String name, D /** * Create or Update a dedicated HSM in the specified subscription. * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name Name of the dedicated Hsm. * @param parameters Parameters to create or update the dedicated hsm. * @param context The context to associate with this operation. @@ -397,8 +397,8 @@ public DedicatedHsmInner createOrUpdate(String resourceGroupName, String name, D /** * Update a dedicated HSM in the specified subscription. * - * @param resourceGroupName The name of the Resource Group to which the server belongs. - * @param name Name of the dedicated HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @param parameters Parameters to patch the dedicated HSM. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorException thrown if the request is rejected by server. @@ -439,8 +439,8 @@ private Mono>> updateWithResponseAsync(String resource /** * Update a dedicated HSM in the specified subscription. * - * @param resourceGroupName The name of the Resource Group to which the server belongs. - * @param name Name of the dedicated HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @param parameters Parameters to patch the dedicated HSM. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -481,8 +481,8 @@ private Mono>> updateWithResponseAsync(String resource /** * Update a dedicated HSM in the specified subscription. * - * @param resourceGroupName The name of the Resource Group to which the server belongs. - * @param name Name of the dedicated HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @param parameters Parameters to patch the dedicated HSM. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorException thrown if the request is rejected by server. @@ -500,8 +500,8 @@ private PollerFlux, DedicatedHsmInner> beginUpdate /** * Update a dedicated HSM in the specified subscription. * - * @param resourceGroupName The name of the Resource Group to which the server belongs. - * @param name Name of the dedicated HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @param parameters Parameters to patch the dedicated HSM. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -521,8 +521,8 @@ private PollerFlux, DedicatedHsmInner> beginUpdate /** * Update a dedicated HSM in the specified subscription. * - * @param resourceGroupName The name of the Resource Group to which the server belongs. - * @param name Name of the dedicated HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @param parameters Parameters to patch the dedicated HSM. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorException thrown if the request is rejected by server. @@ -538,8 +538,8 @@ public SyncPoller, DedicatedHsmInner> beginUpdate( /** * Update a dedicated HSM in the specified subscription. * - * @param resourceGroupName The name of the Resource Group to which the server belongs. - * @param name Name of the dedicated HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @param parameters Parameters to patch the dedicated HSM. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -556,8 +556,8 @@ public SyncPoller, DedicatedHsmInner> beginUpdate( /** * Update a dedicated HSM in the specified subscription. * - * @param resourceGroupName The name of the Resource Group to which the server belongs. - * @param name Name of the dedicated HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @param parameters Parameters to patch the dedicated HSM. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorException thrown if the request is rejected by server. @@ -574,8 +574,8 @@ private Mono updateAsync(String resourceGroupName, String nam /** * Update a dedicated HSM in the specified subscription. * - * @param resourceGroupName The name of the Resource Group to which the server belongs. - * @param name Name of the dedicated HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @param parameters Parameters to patch the dedicated HSM. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -593,8 +593,8 @@ private Mono updateAsync(String resourceGroupName, String nam /** * Update a dedicated HSM in the specified subscription. * - * @param resourceGroupName The name of the Resource Group to which the server belongs. - * @param name Name of the dedicated HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @param parameters Parameters to patch the dedicated HSM. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorException thrown if the request is rejected by server. @@ -609,8 +609,8 @@ public DedicatedHsmInner update(String resourceGroupName, String name, Dedicated /** * Update a dedicated HSM in the specified subscription. * - * @param resourceGroupName The name of the Resource Group to which the server belongs. - * @param name Name of the dedicated HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @param parameters Parameters to patch the dedicated HSM. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -627,8 +627,8 @@ public DedicatedHsmInner update(String resourceGroupName, String name, Dedicated /** * Deletes the specified Azure Dedicated HSM. * - * @param resourceGroupName The name of the Resource Group to which the dedicated HSM belongs. - * @param name The name of the dedicated HSM to delete. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -661,8 +661,8 @@ private Mono>> deleteWithResponseAsync(String resource /** * Deletes the specified Azure Dedicated HSM. * - * @param resourceGroupName The name of the Resource Group to which the dedicated HSM belongs. - * @param name The name of the dedicated HSM to delete. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorException thrown if the request is rejected by server. @@ -696,8 +696,8 @@ private Mono>> deleteWithResponseAsync(String resource /** * Deletes the specified Azure Dedicated HSM. * - * @param resourceGroupName The name of the Resource Group to which the dedicated HSM belongs. - * @param name The name of the dedicated HSM to delete. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -713,8 +713,8 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup /** * Deletes the specified Azure Dedicated HSM. * - * @param resourceGroupName The name of the Resource Group to which the dedicated HSM belongs. - * @param name The name of the dedicated HSM to delete. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorException thrown if the request is rejected by server. @@ -733,8 +733,8 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup /** * Deletes the specified Azure Dedicated HSM. * - * @param resourceGroupName The name of the Resource Group to which the dedicated HSM belongs. - * @param name The name of the dedicated HSM to delete. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -748,8 +748,8 @@ public SyncPoller, Void> beginDelete(String resourceGroupName, /** * Deletes the specified Azure Dedicated HSM. * - * @param resourceGroupName The name of the Resource Group to which the dedicated HSM belongs. - * @param name The name of the dedicated HSM to delete. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorException thrown if the request is rejected by server. @@ -764,8 +764,8 @@ public SyncPoller, Void> beginDelete(String resourceGroupName, /** * Deletes the specified Azure Dedicated HSM. * - * @param resourceGroupName The name of the Resource Group to which the dedicated HSM belongs. - * @param name The name of the dedicated HSM to delete. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -779,8 +779,8 @@ private Mono deleteAsync(String resourceGroupName, String name) { /** * Deletes the specified Azure Dedicated HSM. * - * @param resourceGroupName The name of the Resource Group to which the dedicated HSM belongs. - * @param name The name of the dedicated HSM to delete. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorException thrown if the request is rejected by server. @@ -795,8 +795,8 @@ private Mono deleteAsync(String resourceGroupName, String name, Context co /** * Deletes the specified Azure Dedicated HSM. * - * @param resourceGroupName The name of the Resource Group to which the dedicated HSM belongs. - * @param name The name of the dedicated HSM to delete. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -809,8 +809,8 @@ public void delete(String resourceGroupName, String name) { /** * Deletes the specified Azure Dedicated HSM. * - * @param resourceGroupName The name of the Resource Group to which the dedicated HSM belongs. - * @param name The name of the dedicated HSM to delete. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorException thrown if the request is rejected by server. @@ -824,8 +824,8 @@ public void delete(String resourceGroupName, String name, Context context) { /** * Gets the specified Azure dedicated HSM. * - * @param resourceGroupName The name of the Resource Group to which the dedicated hsm belongs. - * @param name The name of the dedicated HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -859,8 +859,8 @@ private Mono> getByResourceGroupWithResponseAsync(St /** * Gets the specified Azure dedicated HSM. * - * @param resourceGroupName The name of the Resource Group to which the dedicated hsm belongs. - * @param name The name of the dedicated HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorException thrown if the request is rejected by server. @@ -894,8 +894,8 @@ private Mono> getByResourceGroupWithResponseAsync(St /** * Gets the specified Azure dedicated HSM. * - * @param resourceGroupName The name of the Resource Group to which the dedicated hsm belongs. - * @param name The name of the dedicated HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -910,8 +910,8 @@ private Mono getByResourceGroupAsync(String resourceGroupName /** * Gets the specified Azure dedicated HSM. * - * @param resourceGroupName The name of the Resource Group to which the dedicated hsm belongs. - * @param name The name of the dedicated HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorException thrown if the request is rejected by server. @@ -927,8 +927,8 @@ public Response getByResourceGroupWithResponse(String resourc /** * Gets the specified Azure dedicated HSM. * - * @param resourceGroupName The name of the Resource Group to which the dedicated hsm belongs. - * @param name The name of the dedicated HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -943,7 +943,7 @@ public DedicatedHsmInner getByResourceGroup(String resourceGroupName, String nam * The List operation gets information about the dedicated hsms associated with the subscription and within the * specified resource group. * - * @param resourceGroupName The name of the Resource Group to which the dedicated HSM belongs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param top Maximum number of results to return. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorException thrown if the request is rejected by server. @@ -978,7 +978,7 @@ private Mono> listByResourceGroupSinglePageAsyn * The List operation gets information about the dedicated hsms associated with the subscription and within the * specified resource group. * - * @param resourceGroupName The name of the Resource Group to which the dedicated HSM belongs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param top Maximum number of results to return. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1014,7 +1014,7 @@ private Mono> listByResourceGroupSinglePageAsyn * The List operation gets information about the dedicated hsms associated with the subscription and within the * specified resource group. * - * @param resourceGroupName The name of the Resource Group to which the dedicated HSM belongs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param top Maximum number of results to return. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorException thrown if the request is rejected by server. @@ -1031,7 +1031,7 @@ private PagedFlux listByResourceGroupAsync(String resourceGro * The List operation gets information about the dedicated hsms associated with the subscription and within the * specified resource group. * - * @param resourceGroupName The name of the Resource Group to which the dedicated HSM belongs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1048,7 +1048,7 @@ private PagedFlux listByResourceGroupAsync(String resourceGro * The List operation gets information about the dedicated hsms associated with the subscription and within the * specified resource group. * - * @param resourceGroupName The name of the Resource Group to which the dedicated HSM belongs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param top Maximum number of results to return. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1067,7 +1067,7 @@ private PagedFlux listByResourceGroupAsync(String resourceGro * The List operation gets information about the dedicated hsms associated with the subscription and within the * specified resource group. * - * @param resourceGroupName The name of the Resource Group to which the dedicated HSM belongs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1083,7 +1083,7 @@ public PagedIterable listByResourceGroup(String resourceGroup * The List operation gets information about the dedicated hsms associated with the subscription and within the * specified resource group. * - * @param resourceGroupName The name of the Resource Group to which the dedicated HSM belongs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param top Maximum number of results to return. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1234,8 +1234,8 @@ public PagedIterable list(Integer top, Context context) { * 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. * - * @param resourceGroupName The name of the Resource Group to which the dedicated hsm belongs. - * @param name The name of the dedicated HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1276,8 +1276,8 @@ public PagedIterable list(Integer top, Context context) { * 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. * - * @param resourceGroupName The name of the Resource Group to which the dedicated hsm belongs. - * @param name The name of the dedicated HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorException thrown if the request is rejected by server. @@ -1320,8 +1320,8 @@ public PagedIterable list(Integer top, Context context) { * 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. * - * @param resourceGroupName The name of the Resource Group to which the dedicated hsm belongs. - * @param name The name of the dedicated HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1342,8 +1342,8 @@ public PagedIterable list(Integer top, Context context) { * 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. * - * @param resourceGroupName The name of the Resource Group to which the dedicated hsm belongs. - * @param name The name of the dedicated HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorException thrown if the request is rejected by server. @@ -1366,8 +1366,8 @@ public PagedIterable list(Integer top, Context context) { * 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. * - * @param resourceGroupName The name of the Resource Group to which the dedicated hsm belongs. - * @param name The name of the dedicated HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1387,8 +1387,8 @@ public PagedIterable list(Integer top, Context context) { * 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. * - * @param resourceGroupName The name of the Resource Group to which the dedicated hsm belongs. - * @param name The name of the dedicated HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorException thrown if the request is rejected by server. diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/DedicatedHsmOperationImpl.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/OperationImpl.java similarity index 68% rename from sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/DedicatedHsmOperationImpl.java rename to sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/OperationImpl.java index 93cc49a44ac5..7c7a85143b9d 100644 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/DedicatedHsmOperationImpl.java +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/OperationImpl.java @@ -4,16 +4,18 @@ package com.azure.resourcemanager.hardwaresecuritymodules.implementation; -import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.DedicatedHsmOperationInner; -import com.azure.resourcemanager.hardwaresecuritymodules.models.DedicatedHsmOperation; -import com.azure.resourcemanager.hardwaresecuritymodules.models.DedicatedHsmOperationDisplay; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.OperationInner; +import com.azure.resourcemanager.hardwaresecuritymodules.models.ActionType; +import com.azure.resourcemanager.hardwaresecuritymodules.models.Operation; +import com.azure.resourcemanager.hardwaresecuritymodules.models.OperationDisplay; +import com.azure.resourcemanager.hardwaresecuritymodules.models.Origin; -public final class DedicatedHsmOperationImpl implements DedicatedHsmOperation { - private DedicatedHsmOperationInner innerObject; +public final class OperationImpl implements Operation { + private OperationInner innerObject; private final com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager serviceManager; - DedicatedHsmOperationImpl(DedicatedHsmOperationInner innerObject, + OperationImpl(OperationInner innerObject, com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; @@ -27,15 +29,19 @@ public Boolean isDataAction() { return this.innerModel().isDataAction(); } - public String origin() { + public OperationDisplay display() { + return this.innerModel().display(); + } + + public Origin origin() { return this.innerModel().origin(); } - public DedicatedHsmOperationDisplay display() { - return this.innerModel().display(); + public ActionType actionType() { + return this.innerModel().actionType(); } - public DedicatedHsmOperationInner innerModel() { + public OperationInner innerModel() { return this.innerObject; } diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/OperationsClientImpl.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/OperationsClientImpl.java index 72bc25eff936..ee96b422e7dc 100644 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/OperationsClientImpl.java +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/OperationsClientImpl.java @@ -21,12 +21,12 @@ import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.hardwaresecuritymodules.fluent.OperationsClient; -import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.DedicatedHsmOperationInner; -import com.azure.resourcemanager.hardwaresecuritymodules.models.DedicatedHsmOperationListResult; -import com.azure.resourcemanager.hardwaresecuritymodules.models.ErrorException; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.OperationInner; +import com.azure.resourcemanager.hardwaresecuritymodules.models.OperationListResult; import reactor.core.publisher.Mono; /** @@ -64,21 +64,21 @@ public interface OperationsService { @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.HardwareSecurityModules/operations") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ErrorException.class) - Mono> list(@HostParam("$host") String endpoint, + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); } /** - * Get a list of Dedicated HSM operations. + * Get a list of Hardware Security Modules operations. * - * @throws ErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of Dedicated HSM operations along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a list of Hardware Security Modules operations along with {@link PagedResponse} on successful completion + * of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync() { + private Mono> listSinglePageAsync() { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -87,23 +87,23 @@ private Mono> listSinglePageAsync() { return FluxUtil .withContext( context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), null, null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Get a list of Dedicated HSM operations. + * Get a list of Hardware Security Modules operations. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of Dedicated HSM operations along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a list of Hardware Security Modules operations along with {@link PagedResponse} on successful completion + * of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(Context context) { + private Mono> listSinglePageAsync(Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -116,54 +116,54 @@ private Mono> listSinglePageAsync(Cont } /** - * Get a list of Dedicated HSM operations. + * Get a list of Hardware Security Modules operations. * - * @throws ErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of Dedicated HSM operations as paginated response with {@link PagedFlux}. + * @return a list of Hardware Security Modules operations as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { + private PagedFlux listAsync() { return new PagedFlux<>(() -> listSinglePageAsync()); } /** - * Get a list of Dedicated HSM operations. + * Get a list of Hardware Security Modules operations. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of Dedicated HSM operations as paginated response with {@link PagedFlux}. + * @return a list of Hardware Security Modules operations as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { + private PagedFlux listAsync(Context context) { return new PagedFlux<>(() -> listSinglePageAsync(context)); } /** - * Get a list of Dedicated HSM operations. + * Get a list of Hardware Security Modules operations. * - * @throws ErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of Dedicated HSM operations as paginated response with {@link PagedIterable}. + * @return a list of Hardware Security Modules operations as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list() { + public PagedIterable list() { return new PagedIterable<>(listAsync()); } /** - * Get a list of Dedicated HSM operations. + * Get a list of Hardware Security Modules operations. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of Dedicated HSM operations as paginated response with {@link PagedIterable}. + * @return a list of Hardware Security Modules operations as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(Context context) { + public PagedIterable list(Context context) { return new PagedIterable<>(listAsync(context)); } } diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/OperationsImpl.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/OperationsImpl.java index 341b97a24c31..a14942ebe73b 100644 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/OperationsImpl.java +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/OperationsImpl.java @@ -8,8 +8,8 @@ import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.hardwaresecuritymodules.fluent.OperationsClient; -import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.DedicatedHsmOperationInner; -import com.azure.resourcemanager.hardwaresecuritymodules.models.DedicatedHsmOperation; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.OperationInner; +import com.azure.resourcemanager.hardwaresecuritymodules.models.Operation; import com.azure.resourcemanager.hardwaresecuritymodules.models.Operations; public final class OperationsImpl implements Operations { @@ -25,14 +25,14 @@ public OperationsImpl(OperationsClient innerClient, this.serviceManager = serviceManager; } - public PagedIterable list() { - PagedIterable inner = this.serviceClient().list(); - return ResourceManagerUtils.mapPage(inner, inner1 -> new DedicatedHsmOperationImpl(inner1, this.manager())); + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); } - public PagedIterable list(Context context) { - PagedIterable inner = this.serviceClient().list(context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new DedicatedHsmOperationImpl(inner1, this.manager())); + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); } private OperationsClient serviceClient() { diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/PrivateEndpointConnectionImpl.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/PrivateEndpointConnectionImpl.java new file mode 100644 index 000000000000..83d1c731e84a --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/PrivateEndpointConnectionImpl.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.hardwaresecuritymodules.models.PrivateEndpointConnection; +import com.azure.resourcemanager.hardwaresecuritymodules.models.PrivateEndpointConnectionProperties; + +public final class PrivateEndpointConnectionImpl + implements PrivateEndpointConnection, PrivateEndpointConnection.Definition { + private PrivateEndpointConnectionInner innerObject; + + private final com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager serviceManager; + + PrivateEndpointConnectionImpl(PrivateEndpointConnectionInner innerObject, + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public PrivateEndpointConnectionProperties properties() { + return this.innerModel().properties(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public PrivateEndpointConnectionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String cloudHsmClusterName; + + private String peConnectionName; + + public PrivateEndpointConnectionImpl withExistingCloudHsmCluster(String resourceGroupName, + String cloudHsmClusterName) { + this.resourceGroupName = resourceGroupName; + this.cloudHsmClusterName = cloudHsmClusterName; + return this; + } + + public PrivateEndpointConnection create() { + this.innerObject = serviceManager.serviceClient() + .getCloudHsmClusterPrivateEndpointConnections() + .createWithResponse(resourceGroupName, cloudHsmClusterName, peConnectionName, this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public PrivateEndpointConnection create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getCloudHsmClusterPrivateEndpointConnections() + .createWithResponse(resourceGroupName, cloudHsmClusterName, peConnectionName, this.innerModel(), context) + .getValue(); + return this; + } + + PrivateEndpointConnectionImpl(String name, + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager serviceManager) { + this.innerObject = new PrivateEndpointConnectionInner(); + this.serviceManager = serviceManager; + this.peConnectionName = name; + } + + public PrivateEndpointConnection refresh() { + this.innerObject = serviceManager.serviceClient() + .getCloudHsmClusterPrivateEndpointConnections() + .getWithResponse(resourceGroupName, cloudHsmClusterName, peConnectionName, Context.NONE) + .getValue(); + return this; + } + + public PrivateEndpointConnection refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getCloudHsmClusterPrivateEndpointConnections() + .getWithResponse(resourceGroupName, cloudHsmClusterName, peConnectionName, context) + .getValue(); + return this; + } + + public PrivateEndpointConnectionImpl withProperties(PrivateEndpointConnectionProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public PrivateEndpointConnectionImpl withEtag(String etag) { + this.innerModel().withEtag(etag); + return this; + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/PrivateEndpointConnectionsClientImpl.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/PrivateEndpointConnectionsClientImpl.java new file mode 100644 index 000000000000..5267107b7dc6 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/PrivateEndpointConnectionsClientImpl.java @@ -0,0 +1,299 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.hardwaresecuritymodules.models.PrivateEndpointConnectionListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in PrivateEndpointConnectionsClient. + */ +public final class PrivateEndpointConnectionsClientImpl implements PrivateEndpointConnectionsClient { + /** + * The proxy service used to perform REST calls. + */ + private final PrivateEndpointConnectionsService service; + + /** + * The service client containing this operation class. + */ + private final AzureHsmResourceProviderImpl client; + + /** + * Initializes an instance of PrivateEndpointConnectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateEndpointConnectionsClientImpl(AzureHsmResourceProviderImpl client) { + this.service = RestProxy.create(PrivateEndpointConnectionsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureHsmResourceProviderPrivateEndpointConnections to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureHsmResourceProv") + public interface PrivateEndpointConnectionsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HardwareSecurityModules/cloudHsmClusters/{cloudHsmClusterName}/privateEndpointConnections") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCloudHsmCluster(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudHsmClusterName") String cloudHsmClusterName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCloudHsmClusterNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * The List operation gets information about the private endpoint connections associated with the Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of private endpoint connections associated with the specified resource along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByCloudHsmClusterSinglePageAsync(String resourceGroupName, String cloudHsmClusterName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudHsmClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudHsmClusterName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByCloudHsmCluster(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, cloudHsmClusterName, this.client.getApiVersion(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The List operation gets information about the private endpoint connections associated with the Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of private endpoint connections associated with the specified resource along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByCloudHsmClusterSinglePageAsync(String resourceGroupName, String cloudHsmClusterName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudHsmClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter cloudHsmClusterName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByCloudHsmCluster(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + cloudHsmClusterName, this.client.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * The List operation gets information about the private endpoint connections associated with the Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of private endpoint connections associated with the specified resource as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByCloudHsmClusterAsync(String resourceGroupName, + String cloudHsmClusterName) { + return new PagedFlux<>(() -> listByCloudHsmClusterSinglePageAsync(resourceGroupName, cloudHsmClusterName), + nextLink -> listByCloudHsmClusterNextSinglePageAsync(nextLink)); + } + + /** + * The List operation gets information about the private endpoint connections associated with the Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of private endpoint connections associated with the specified resource as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByCloudHsmClusterAsync(String resourceGroupName, + String cloudHsmClusterName, Context context) { + return new PagedFlux<>( + () -> listByCloudHsmClusterSinglePageAsync(resourceGroupName, cloudHsmClusterName, context), + nextLink -> listByCloudHsmClusterNextSinglePageAsync(nextLink, context)); + } + + /** + * The List operation gets information about the private endpoint connections associated with the Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of private endpoint connections associated with the specified resource as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCloudHsmCluster(String resourceGroupName, + String cloudHsmClusterName) { + return new PagedIterable<>(listByCloudHsmClusterAsync(resourceGroupName, cloudHsmClusterName)); + } + + /** + * The List operation gets information about the private endpoint connections associated with the Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of private endpoint connections associated with the specified resource as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCloudHsmCluster(String resourceGroupName, + String cloudHsmClusterName, Context context) { + return new PagedIterable<>(listByCloudHsmClusterAsync(resourceGroupName, cloudHsmClusterName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of private endpoint connections associated with the specified resource along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByCloudHsmClusterNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByCloudHsmClusterNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of private endpoint connections associated with the specified resource along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByCloudHsmClusterNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listByCloudHsmClusterNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/PrivateEndpointConnectionsImpl.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/PrivateEndpointConnectionsImpl.java new file mode 100644 index 000000000000..e344897dd68f --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/PrivateEndpointConnectionsImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.hardwaresecuritymodules.models.PrivateEndpointConnection; +import com.azure.resourcemanager.hardwaresecuritymodules.models.PrivateEndpointConnections; + +public final class PrivateEndpointConnectionsImpl implements PrivateEndpointConnections { + private static final ClientLogger LOGGER = new ClientLogger(PrivateEndpointConnectionsImpl.class); + + private final PrivateEndpointConnectionsClient innerClient; + + private final com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager serviceManager; + + public PrivateEndpointConnectionsImpl(PrivateEndpointConnectionsClient innerClient, + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByCloudHsmCluster(String resourceGroupName, + String cloudHsmClusterName) { + PagedIterable inner + = this.serviceClient().listByCloudHsmCluster(resourceGroupName, cloudHsmClusterName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())); + } + + public PagedIterable listByCloudHsmCluster(String resourceGroupName, + String cloudHsmClusterName, Context context) { + PagedIterable inner + = this.serviceClient().listByCloudHsmCluster(resourceGroupName, cloudHsmClusterName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())); + } + + private PrivateEndpointConnectionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/PrivateLinkResourceImpl.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/PrivateLinkResourceImpl.java new file mode 100644 index 000000000000..272a7876a25d --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/PrivateLinkResourceImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.hardwaresecuritymodules.models.PrivateLinkResource; +import com.azure.resourcemanager.hardwaresecuritymodules.models.PrivateLinkResourceProperties; + +public final class PrivateLinkResourceImpl implements PrivateLinkResource { + private PrivateLinkResourceInner innerObject; + + private final com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager serviceManager; + + PrivateLinkResourceImpl(PrivateLinkResourceInner innerObject, + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public PrivateLinkResourceProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public PrivateLinkResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/RestoreResultImpl.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/RestoreResultImpl.java new file mode 100644 index 000000000000..180a3f80a2c9 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/implementation/RestoreResultImpl.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.implementation; + +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.RestoreResultInner; +import com.azure.resourcemanager.hardwaresecuritymodules.models.BackupRestoreBaseResultProperties; +import com.azure.resourcemanager.hardwaresecuritymodules.models.RestoreResult; + +public final class RestoreResultImpl implements RestoreResult { + private RestoreResultInner innerObject; + + private final com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager serviceManager; + + RestoreResultImpl(RestoreResultInner innerObject, + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public BackupRestoreBaseResultProperties properties() { + return this.innerModel().properties(); + } + + public RestoreResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/ActionType.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/ActionType.java new file mode 100644 index 000000000000..a8d7ba8cef9a --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/ActionType.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ +public final class ActionType extends ExpandableStringEnum { + /** + * Static value Internal for ActionType. + */ + public static final ActionType INTERNAL = fromString("Internal"); + + /** + * Creates a new instance of ActionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActionType() { + } + + /** + * Creates or finds a ActionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActionType. + */ + public static ActionType fromString(String name) { + return fromString(name, ActionType.class); + } + + /** + * Gets known ActionType values. + * + * @return known ActionType values. + */ + public static Collection values() { + return values(ActionType.class); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/ActivationState.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/ActivationState.java new file mode 100644 index 000000000000..e28686e469ce --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/ActivationState.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * State of security domain activation. + */ +public final class ActivationState extends ExpandableStringEnum { + /** + * Static value NotDefined for ActivationState. + */ + public static final ActivationState NOT_DEFINED = fromString("NotDefined"); + + /** + * Static value NotActivated for ActivationState. + */ + public static final ActivationState NOT_ACTIVATED = fromString("NotActivated"); + + /** + * Static value Active for ActivationState. + */ + public static final ActivationState ACTIVE = fromString("Active"); + + /** + * Static value Failed for ActivationState. + */ + public static final ActivationState FAILED = fromString("Failed"); + + /** + * Static value Unknown for ActivationState. + */ + public static final ActivationState UNKNOWN = fromString("Unknown"); + + /** + * Creates a new instance of ActivationState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActivationState() { + } + + /** + * Creates or finds a ActivationState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActivationState. + */ + public static ActivationState fromString(String name) { + return fromString(name, ActivationState.class); + } + + /** + * Gets known ActivationState values. + * + * @return known ActivationState values. + */ + public static Collection values() { + return values(ActivationState.class); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/ApiEntityReference.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/ApiEntityReference.java index 24d8d8ce3cb1..4c54aef196de 100644 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/ApiEntityReference.java +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/ApiEntityReference.java @@ -17,9 +17,9 @@ @Fluent public final class ApiEntityReference implements JsonSerializable { /* - * The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + * The Azure resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... */ - private String id; + private String resourceId; /** * Creates an instance of ApiEntityReference class. @@ -28,24 +28,24 @@ public ApiEntityReference() { } /** - * Get the id property: The ARM resource id in the form of + * Get the resourceId property: The Azure resource id in the form of * /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... * - * @return the id value. + * @return the resourceId value. */ - public String id() { - return this.id; + public String resourceId() { + return this.resourceId; } /** - * Set the id property: The ARM resource id in the form of + * Set the resourceId property: The Azure resource id in the form of * /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... * - * @param id the id value to set. + * @param resourceId the resourceId value to set. * @return the ApiEntityReference object itself. */ - public ApiEntityReference withId(String id) { - this.id = id; + public ApiEntityReference withResourceId(String resourceId) { + this.resourceId = resourceId; return this; } @@ -63,7 +63,7 @@ public void validate() { @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); - jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("resourceId", this.resourceId); return jsonWriter.writeEndObject(); } @@ -82,8 +82,8 @@ public static ApiEntityReference fromJson(JsonReader jsonReader) throws IOExcept String fieldName = reader.getFieldName(); reader.nextToken(); - if ("id".equals(fieldName)) { - deserializedApiEntityReference.id = reader.getString(); + if ("resourceId".equals(fieldName)) { + deserializedApiEntityReference.resourceId = reader.getString(); } else { reader.skipChildren(); } diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/AutoGeneratedDomainNameLabelScope.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/AutoGeneratedDomainNameLabelScope.java new file mode 100644 index 000000000000..5e48ab3222a8 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/AutoGeneratedDomainNameLabelScope.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The Cloud HSM Cluster's auto-generated Domain Name Label Scope. + */ +public final class AutoGeneratedDomainNameLabelScope extends ExpandableStringEnum { + /** + * Static value TenantReuse for AutoGeneratedDomainNameLabelScope. + */ + public static final AutoGeneratedDomainNameLabelScope TENANT_REUSE = fromString("TenantReuse"); + + /** + * Static value SubscriptionReuse for AutoGeneratedDomainNameLabelScope. + */ + public static final AutoGeneratedDomainNameLabelScope SUBSCRIPTION_REUSE = fromString("SubscriptionReuse"); + + /** + * Static value ResourceGroupReuse for AutoGeneratedDomainNameLabelScope. + */ + public static final AutoGeneratedDomainNameLabelScope RESOURCE_GROUP_REUSE = fromString("ResourceGroupReuse"); + + /** + * Static value NoReuse for AutoGeneratedDomainNameLabelScope. + */ + public static final AutoGeneratedDomainNameLabelScope NO_REUSE = fromString("NoReuse"); + + /** + * Creates a new instance of AutoGeneratedDomainNameLabelScope value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AutoGeneratedDomainNameLabelScope() { + } + + /** + * Creates or finds a AutoGeneratedDomainNameLabelScope from its string representation. + * + * @param name a name to look for. + * @return the corresponding AutoGeneratedDomainNameLabelScope. + */ + public static AutoGeneratedDomainNameLabelScope fromString(String name) { + return fromString(name, AutoGeneratedDomainNameLabelScope.class); + } + + /** + * Gets known AutoGeneratedDomainNameLabelScope values. + * + * @return known AutoGeneratedDomainNameLabelScope values. + */ + public static Collection values() { + return values(AutoGeneratedDomainNameLabelScope.class); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/BackupRequestProperties.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/BackupRequestProperties.java new file mode 100644 index 000000000000..29df907a194e --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/BackupRequestProperties.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Backup properties. + */ +@Fluent +public final class BackupRequestProperties extends BackupRestoreRequestBaseProperties { + /** + * Creates an instance of BackupRequestProperties class. + */ + public BackupRequestProperties() { + } + + /** + * {@inheritDoc} + */ + @Override + public BackupRequestProperties withAzureStorageBlobContainerUri(String azureStorageBlobContainerUri) { + super.withAzureStorageBlobContainerUri(azureStorageBlobContainerUri); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public BackupRequestProperties withToken(String token) { + super.withToken(token); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (azureStorageBlobContainerUri() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property azureStorageBlobContainerUri in model BackupRequestProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(BackupRequestProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("azureStorageBlobContainerUri", azureStorageBlobContainerUri()); + jsonWriter.writeStringField("token", token()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BackupRequestProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BackupRequestProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BackupRequestProperties. + */ + public static BackupRequestProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BackupRequestProperties deserializedBackupRequestProperties = new BackupRequestProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("azureStorageBlobContainerUri".equals(fieldName)) { + deserializedBackupRequestProperties.withAzureStorageBlobContainerUri(reader.getString()); + } else if ("token".equals(fieldName)) { + deserializedBackupRequestProperties.withToken(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedBackupRequestProperties; + }); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/BackupRestoreBaseResultProperties.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/BackupRestoreBaseResultProperties.java new file mode 100644 index 000000000000..201401d5de78 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/BackupRestoreBaseResultProperties.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * Backup and Restore operation common properties. + */ +@Fluent +public class BackupRestoreBaseResultProperties implements JsonSerializable { + /* + * Status of the backup/restore operation + */ + private BackupRestoreOperationStatus status; + + /* + * The status details of backup/restore operation + */ + private String statusDetails; + + /* + * Error encountered, if any, during the backup/restore operation. + */ + private ManagementError error; + + /* + * The start time of the backup/restore operation in UTC + */ + private OffsetDateTime startTime; + + /* + * The end time of the backup/restore operation in UTC + */ + private OffsetDateTime endTime; + + /* + * Identifier for the backup/restore operation. + */ + private String jobId; + + /** + * Creates an instance of BackupRestoreBaseResultProperties class. + */ + public BackupRestoreBaseResultProperties() { + } + + /** + * Get the status property: Status of the backup/restore operation. + * + * @return the status value. + */ + public BackupRestoreOperationStatus status() { + return this.status; + } + + /** + * Set the status property: Status of the backup/restore operation. + * + * @param status the status value to set. + * @return the BackupRestoreBaseResultProperties object itself. + */ + BackupRestoreBaseResultProperties withStatus(BackupRestoreOperationStatus status) { + this.status = status; + return this; + } + + /** + * Get the statusDetails property: The status details of backup/restore operation. + * + * @return the statusDetails value. + */ + public String statusDetails() { + return this.statusDetails; + } + + /** + * Set the statusDetails property: The status details of backup/restore operation. + * + * @param statusDetails the statusDetails value to set. + * @return the BackupRestoreBaseResultProperties object itself. + */ + public BackupRestoreBaseResultProperties withStatusDetails(String statusDetails) { + this.statusDetails = statusDetails; + return this; + } + + /** + * Get the error property: Error encountered, if any, during the backup/restore operation. + * + * @return the error value. + */ + public ManagementError error() { + return this.error; + } + + /** + * Set the error property: Error encountered, if any, during the backup/restore operation. + * + * @param error the error value to set. + * @return the BackupRestoreBaseResultProperties object itself. + */ + public BackupRestoreBaseResultProperties withError(ManagementError error) { + this.error = error; + return this; + } + + /** + * Get the startTime property: The start time of the backup/restore operation in UTC. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime property: The start time of the backup/restore operation in UTC. + * + * @param startTime the startTime value to set. + * @return the BackupRestoreBaseResultProperties object itself. + */ + BackupRestoreBaseResultProperties withStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the endTime property: The end time of the backup/restore operation in UTC. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Set the endTime property: The end time of the backup/restore operation in UTC. + * + * @param endTime the endTime value to set. + * @return the BackupRestoreBaseResultProperties object itself. + */ + BackupRestoreBaseResultProperties withEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get the jobId property: Identifier for the backup/restore operation. + * + * @return the jobId value. + */ + public String jobId() { + return this.jobId; + } + + /** + * Set the jobId property: Identifier for the backup/restore operation. + * + * @param jobId the jobId value to set. + * @return the BackupRestoreBaseResultProperties object itself. + */ + public BackupRestoreBaseResultProperties withJobId(String jobId) { + this.jobId = jobId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("statusDetails", this.statusDetails); + jsonWriter.writeJsonField("error", this.error); + jsonWriter.writeStringField("jobId", this.jobId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BackupRestoreBaseResultProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BackupRestoreBaseResultProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the BackupRestoreBaseResultProperties. + */ + public static BackupRestoreBaseResultProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BackupRestoreBaseResultProperties deserializedBackupRestoreBaseResultProperties + = new BackupRestoreBaseResultProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("status".equals(fieldName)) { + deserializedBackupRestoreBaseResultProperties.status + = BackupRestoreOperationStatus.fromString(reader.getString()); + } else if ("statusDetails".equals(fieldName)) { + deserializedBackupRestoreBaseResultProperties.statusDetails = reader.getString(); + } else if ("error".equals(fieldName)) { + deserializedBackupRestoreBaseResultProperties.error = ManagementError.fromJson(reader); + } else if ("startTime".equals(fieldName)) { + deserializedBackupRestoreBaseResultProperties.startTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("endTime".equals(fieldName)) { + deserializedBackupRestoreBaseResultProperties.endTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("jobId".equals(fieldName)) { + deserializedBackupRestoreBaseResultProperties.jobId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedBackupRestoreBaseResultProperties; + }); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/BackupRestoreOperationStatus.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/BackupRestoreOperationStatus.java new file mode 100644 index 000000000000..e6d7a409c9cf --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/BackupRestoreOperationStatus.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Status of the backup/restore operation. + */ +public final class BackupRestoreOperationStatus extends ExpandableStringEnum { + /** + * Static value InProgress for BackupRestoreOperationStatus. + */ + public static final BackupRestoreOperationStatus IN_PROGRESS = fromString("InProgress"); + + /** + * Static value Succeeded for BackupRestoreOperationStatus. + */ + public static final BackupRestoreOperationStatus SUCCEEDED = fromString("Succeeded"); + + /** + * Static value Failed for BackupRestoreOperationStatus. + */ + public static final BackupRestoreOperationStatus FAILED = fromString("Failed"); + + /** + * Static value Cancelled for BackupRestoreOperationStatus. + */ + public static final BackupRestoreOperationStatus CANCELLED = fromString("Cancelled"); + + /** + * Creates a new instance of BackupRestoreOperationStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public BackupRestoreOperationStatus() { + } + + /** + * Creates or finds a BackupRestoreOperationStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding BackupRestoreOperationStatus. + */ + public static BackupRestoreOperationStatus fromString(String name) { + return fromString(name, BackupRestoreOperationStatus.class); + } + + /** + * Gets known BackupRestoreOperationStatus values. + * + * @return known BackupRestoreOperationStatus values. + */ + public static Collection values() { + return values(BackupRestoreOperationStatus.class); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/BackupRestoreRequestBaseProperties.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/BackupRestoreRequestBaseProperties.java new file mode 100644 index 000000000000..552435a9719a --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/BackupRestoreRequestBaseProperties.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Backup and Restore Common properties. + */ +@Fluent +public class BackupRestoreRequestBaseProperties implements JsonSerializable { + /* + * The Azure blob storage container Uri which contains the backup + */ + private String azureStorageBlobContainerUri; + + /* + * The SAS token pointing to an Azure blob storage container. This property is reserved for Azure Backup Service. + */ + private String token; + + /** + * Creates an instance of BackupRestoreRequestBaseProperties class. + */ + public BackupRestoreRequestBaseProperties() { + } + + /** + * Get the azureStorageBlobContainerUri property: The Azure blob storage container Uri which contains the backup. + * + * @return the azureStorageBlobContainerUri value. + */ + public String azureStorageBlobContainerUri() { + return this.azureStorageBlobContainerUri; + } + + /** + * Set the azureStorageBlobContainerUri property: The Azure blob storage container Uri which contains the backup. + * + * @param azureStorageBlobContainerUri the azureStorageBlobContainerUri value to set. + * @return the BackupRestoreRequestBaseProperties object itself. + */ + public BackupRestoreRequestBaseProperties withAzureStorageBlobContainerUri(String azureStorageBlobContainerUri) { + this.azureStorageBlobContainerUri = azureStorageBlobContainerUri; + return this; + } + + /** + * Get the token property: The SAS token pointing to an Azure blob storage container. This property is reserved for + * Azure Backup Service. + * + * @return the token value. + */ + public String token() { + return this.token; + } + + /** + * Set the token property: The SAS token pointing to an Azure blob storage container. This property is reserved for + * Azure Backup Service. + * + * @param token the token value to set. + * @return the BackupRestoreRequestBaseProperties object itself. + */ + public BackupRestoreRequestBaseProperties withToken(String token) { + this.token = token; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (azureStorageBlobContainerUri() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property azureStorageBlobContainerUri in model BackupRestoreRequestBaseProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(BackupRestoreRequestBaseProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("azureStorageBlobContainerUri", this.azureStorageBlobContainerUri); + jsonWriter.writeStringField("token", this.token); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BackupRestoreRequestBaseProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BackupRestoreRequestBaseProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BackupRestoreRequestBaseProperties. + */ + public static BackupRestoreRequestBaseProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BackupRestoreRequestBaseProperties deserializedBackupRestoreRequestBaseProperties + = new BackupRestoreRequestBaseProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("azureStorageBlobContainerUri".equals(fieldName)) { + deserializedBackupRestoreRequestBaseProperties.azureStorageBlobContainerUri = reader.getString(); + } else if ("token".equals(fieldName)) { + deserializedBackupRestoreRequestBaseProperties.token = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedBackupRestoreRequestBaseProperties; + }); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/BackupResult.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/BackupResult.java new file mode 100644 index 000000000000..306e293fa0d4 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/BackupResult.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.BackupResultInner; + +/** + * An immutable client-side representation of BackupResult. + */ +public interface BackupResult { + /** + * Gets the properties property: Properties of the Cloud HSM Cluster. + * + * @return the properties value. + */ + BackupResultProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.BackupResultInner object. + * + * @return the inner object. + */ + BackupResultInner innerModel(); +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/BackupResultProperties.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/BackupResultProperties.java new file mode 100644 index 000000000000..b22ff69bb30a --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/BackupResultProperties.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * Properties of the Cloud HSM Cluster. + */ +@Fluent +public final class BackupResultProperties extends BackupRestoreBaseResultProperties { + /* + * The Azure blob storage container Uri which contains the backup + */ + private String azureStorageBlobContainerUri; + + /* + * The ID of the backup. + */ + private String backupId; + + /* + * The end time of the backup/restore operation in UTC + */ + private OffsetDateTime endTime; + + /* + * The start time of the backup/restore operation in UTC + */ + private OffsetDateTime startTime; + + /* + * Status of the backup/restore operation + */ + private BackupRestoreOperationStatus status; + + /** + * Creates an instance of BackupResultProperties class. + */ + public BackupResultProperties() { + } + + /** + * Get the azureStorageBlobContainerUri property: The Azure blob storage container Uri which contains the backup. + * + * @return the azureStorageBlobContainerUri value. + */ + public String azureStorageBlobContainerUri() { + return this.azureStorageBlobContainerUri; + } + + /** + * Set the azureStorageBlobContainerUri property: The Azure blob storage container Uri which contains the backup. + * + * @param azureStorageBlobContainerUri the azureStorageBlobContainerUri value to set. + * @return the BackupResultProperties object itself. + */ + public BackupResultProperties withAzureStorageBlobContainerUri(String azureStorageBlobContainerUri) { + this.azureStorageBlobContainerUri = azureStorageBlobContainerUri; + return this; + } + + /** + * Get the backupId property: The ID of the backup. + * + * @return the backupId value. + */ + public String backupId() { + return this.backupId; + } + + /** + * Set the backupId property: The ID of the backup. + * + * @param backupId the backupId value to set. + * @return the BackupResultProperties object itself. + */ + public BackupResultProperties withBackupId(String backupId) { + this.backupId = backupId; + return this; + } + + /** + * Get the endTime property: The end time of the backup/restore operation in UTC. + * + * @return the endTime value. + */ + @Override + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Get the startTime property: The start time of the backup/restore operation in UTC. + * + * @return the startTime value. + */ + @Override + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the status property: Status of the backup/restore operation. + * + * @return the status value. + */ + @Override + public BackupRestoreOperationStatus status() { + return this.status; + } + + /** + * {@inheritDoc} + */ + @Override + public BackupResultProperties withStatusDetails(String statusDetails) { + super.withStatusDetails(statusDetails); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public BackupResultProperties withError(ManagementError error) { + super.withError(error); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public BackupResultProperties withJobId(String jobId) { + super.withJobId(jobId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("statusDetails", statusDetails()); + jsonWriter.writeJsonField("error", error()); + jsonWriter.writeStringField("jobId", jobId()); + jsonWriter.writeStringField("azureStorageBlobContainerUri", this.azureStorageBlobContainerUri); + jsonWriter.writeStringField("backupId", this.backupId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BackupResultProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BackupResultProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the BackupResultProperties. + */ + public static BackupResultProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BackupResultProperties deserializedBackupResultProperties = new BackupResultProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("status".equals(fieldName)) { + deserializedBackupResultProperties.status + = BackupRestoreOperationStatus.fromString(reader.getString()); + } else if ("statusDetails".equals(fieldName)) { + deserializedBackupResultProperties.withStatusDetails(reader.getString()); + } else if ("error".equals(fieldName)) { + deserializedBackupResultProperties.withError(ManagementError.fromJson(reader)); + } else if ("startTime".equals(fieldName)) { + deserializedBackupResultProperties.startTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("endTime".equals(fieldName)) { + deserializedBackupResultProperties.endTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("jobId".equals(fieldName)) { + deserializedBackupResultProperties.withJobId(reader.getString()); + } else if ("azureStorageBlobContainerUri".equals(fieldName)) { + deserializedBackupResultProperties.azureStorageBlobContainerUri = reader.getString(); + } else if ("backupId".equals(fieldName)) { + deserializedBackupResultProperties.backupId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedBackupResultProperties; + }); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmCluster.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmCluster.java new file mode 100644 index 000000000000..f6a0b06caf1e --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmCluster.java @@ -0,0 +1,396 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.CloudHsmClusterInner; +import java.util.Map; + +/** + * An immutable client-side representation of CloudHsmCluster. + */ +public interface CloudHsmCluster { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the identity property: Managed service identity (system assigned and/or user assigned identities). + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + + /** + * Gets the sku property: SKU details. + * + * @return the sku value. + */ + CloudHsmClusterSku sku(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the properties property: Properties of the Cloud HSM Cluster. + * + * @return the properties value. + */ + CloudHsmClusterProperties properties(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.CloudHsmClusterInner object. + * + * @return the inner object. + */ + CloudHsmClusterInner innerModel(); + + /** + * The entirety of the CloudHsmCluster definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The CloudHsmCluster definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the CloudHsmCluster definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the CloudHsmCluster definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + + /** + * The stage of the CloudHsmCluster definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the CloudHsmCluster definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithIdentity, DefinitionStages.WithSku, + DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + CloudHsmCluster create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + CloudHsmCluster create(Context context); + } + + /** + * The stage of the CloudHsmCluster definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the CloudHsmCluster definition allowing to specify identity. + */ + interface WithIdentity { + /** + * Specifies the identity property: Managed service identity (system assigned and/or user assigned + * identities). + * + * @param identity Managed service identity (system assigned and/or user assigned identities). + * @return the next definition stage. + */ + WithCreate withIdentity(ManagedServiceIdentity identity); + } + + /** + * The stage of the CloudHsmCluster definition allowing to specify sku. + */ + interface WithSku { + /** + * Specifies the sku property: SKU details. + * + * @param sku SKU details. + * @return the next definition stage. + */ + WithCreate withSku(CloudHsmClusterSku sku); + } + + /** + * The stage of the CloudHsmCluster definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: Properties of the Cloud HSM Cluster. + * + * @param properties Properties of the Cloud HSM Cluster. + * @return the next definition stage. + */ + WithCreate withProperties(CloudHsmClusterProperties properties); + } + } + + /** + * Begins update for the CloudHsmCluster resource. + * + * @return the stage of resource update. + */ + CloudHsmCluster.Update update(); + + /** + * The template for CloudHsmCluster update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithIdentity { + /** + * Executes the update request. + * + * @return the updated resource. + */ + CloudHsmCluster apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + CloudHsmCluster apply(Context context); + } + + /** + * The CloudHsmCluster update stages. + */ + interface UpdateStages { + /** + * The stage of the CloudHsmCluster update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: The Cloud HSM Cluster's tags. + * + * @param tags The Cloud HSM Cluster's tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the CloudHsmCluster update allowing to specify identity. + */ + interface WithIdentity { + /** + * Specifies the identity property: Managed service identity (system assigned and/or user assigned + * identities). + * + * @param identity Managed service identity (system assigned and/or user assigned identities). + * @return the next definition stage. + */ + Update withIdentity(ManagedServiceIdentity identity); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + CloudHsmCluster refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + CloudHsmCluster refresh(Context context); + + /** + * Pre Backup operation to validate whether the customer can perform a backup on the Cloud HSM Cluster resource in + * the specified subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup operation Result. + */ + BackupResult validateBackupProperties(); + + /** + * Pre Backup operation to validate whether the customer can perform a backup on the Cloud HSM Cluster resource in + * the specified subscription. + * + * @param backupRequestProperties Backup Operation Required properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup operation Result. + */ + BackupResult validateBackupProperties(BackupRequestProperties backupRequestProperties, Context context); + + /** + * Create a backup of the Cloud HSM Cluster in the specified subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup operation Result. + */ + BackupResult backup(); + + /** + * Create a backup of the Cloud HSM Cluster in the specified subscription. + * + * @param backupRequestProperties Azure storage Resource Uri. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup operation Result. + */ + BackupResult backup(BackupRequestProperties backupRequestProperties, Context context); + + /** + * Queued validating pre restore operation. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore operation properties. + */ + RestoreResult validateRestoreProperties(); + + /** + * Queued validating pre restore operation. + * + * @param restoreRequestProperties Optional Parameters to validate prior performing a restore operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore operation properties. + */ + RestoreResult validateRestoreProperties(RestoreRequestProperties restoreRequestProperties, Context context); + + /** + * Restores all key materials of a specified Cloud HSM Cluster. + * + * @param restoreRequestProperties Restore Operation Required properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore operation properties. + */ + RestoreResult restore(RestoreRequestProperties restoreRequestProperties); + + /** + * Restores all key materials of a specified Cloud HSM Cluster. + * + * @param restoreRequestProperties Restore Operation Required properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore operation properties. + */ + RestoreResult restore(RestoreRequestProperties restoreRequestProperties, Context context); +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterBackupStatus.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterBackupStatus.java new file mode 100644 index 000000000000..3ef8e5b791ba --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterBackupStatus.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of CloudHsmClusterBackupStatus. + */ +public interface CloudHsmClusterBackupStatus { + /** + * Gets the backup operation status of the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param jobId The id returned as part of the backup request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the backup operation status of the specified Cloud HSM Cluster. + */ + Response getWithResponse(String resourceGroupName, String cloudHsmClusterName, String jobId, + Context context); + + /** + * Gets the backup operation status of the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param jobId The id returned as part of the backup request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the backup operation status of the specified Cloud HSM Cluster. + */ + BackupResult get(String resourceGroupName, String cloudHsmClusterName, String jobId); +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterBackupStatusGetHeaders.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterBackupStatusGetHeaders.java new file mode 100644 index 000000000000..26d46bf27c3d --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterBackupStatusGetHeaders.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; + +/** + * The CloudHsmClusterBackupStatusGetHeaders model. + */ +@Fluent +public final class CloudHsmClusterBackupStatusGetHeaders { + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The Location property. + */ + private String location; + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of CloudHsmClusterBackupStatusGetHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public CloudHsmClusterBackupStatusGetHeaders(HttpHeaders rawHeaders) { + this.xMsRequestId = rawHeaders.getValue(HttpHeaderName.X_MS_REQUEST_ID); + this.location = rawHeaders.getValue(HttpHeaderName.LOCATION); + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String xMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the CloudHsmClusterBackupStatusGetHeaders object itself. + */ + public CloudHsmClusterBackupStatusGetHeaders withXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the location property: The Location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Location property. + * + * @param location the location value to set. + * @return the CloudHsmClusterBackupStatusGetHeaders object itself. + */ + public CloudHsmClusterBackupStatusGetHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterBackupStatusGetResponse.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterBackupStatusGetResponse.java new file mode 100644 index 000000000000..898571897a08 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterBackupStatusGetResponse.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.BackupResultInner; + +/** + * Contains all response data for the get operation. + */ +public final class CloudHsmClusterBackupStatusGetResponse + extends ResponseBase { + /** + * Creates an instance of CloudHsmClusterBackupStatusGetResponse. + * + * @param request the request which resulted in this CloudHsmClusterBackupStatusGetResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public CloudHsmClusterBackupStatusGetResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, + BackupResultInner value, CloudHsmClusterBackupStatusGetHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** + * Gets the deserialized response body. + * + * @return the deserialized response body. + */ + @Override + public BackupResultInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterListResult.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterListResult.java new file mode 100644 index 000000000000..87ff29820b84 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterListResult.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.CloudHsmClusterInner; +import java.io.IOException; +import java.util.List; + +/** + * List of Cloud HSM Clusters. + */ +@Fluent +public final class CloudHsmClusterListResult implements JsonSerializable { + /* + * The list of Cloud HSM Clusters. + */ + private List value; + + /* + * The URL to get the next set of Cloud HSM Clusters. + */ + private String nextLink; + + /** + * Creates an instance of CloudHsmClusterListResult class. + */ + public CloudHsmClusterListResult() { + } + + /** + * Get the value property: The list of Cloud HSM Clusters. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of Cloud HSM Clusters. + * + * @param value the value value to set. + * @return the CloudHsmClusterListResult object itself. + */ + public CloudHsmClusterListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to get the next set of Cloud HSM Clusters. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URL to get the next set of Cloud HSM Clusters. + * + * @param nextLink the nextLink value to set. + * @return the CloudHsmClusterListResult object itself. + */ + public CloudHsmClusterListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CloudHsmClusterListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CloudHsmClusterListResult if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CloudHsmClusterListResult. + */ + public static CloudHsmClusterListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CloudHsmClusterListResult deserializedCloudHsmClusterListResult = new CloudHsmClusterListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> CloudHsmClusterInner.fromJson(reader1)); + deserializedCloudHsmClusterListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedCloudHsmClusterListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCloudHsmClusterListResult; + }); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterPatchParameters.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterPatchParameters.java new file mode 100644 index 000000000000..d6f8d0ce50de --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterPatchParameters.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Patchable properties of the Cloud HSM Cluster. + */ +@Fluent +public final class CloudHsmClusterPatchParameters implements JsonSerializable { + /* + * The Cloud HSM Cluster's tags + */ + private Map tags; + + /* + * Managed service identity (system assigned and/or user assigned identities) + */ + private ManagedServiceIdentity identity; + + /** + * Creates an instance of CloudHsmClusterPatchParameters class. + */ + public CloudHsmClusterPatchParameters() { + } + + /** + * Get the tags property: The Cloud HSM Cluster's tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: The Cloud HSM Cluster's tags. + * + * @param tags the tags value to set. + * @return the CloudHsmClusterPatchParameters object itself. + */ + public CloudHsmClusterPatchParameters withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the identity property: Managed service identity (system assigned and/or user assigned identities). + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: Managed service identity (system assigned and/or user assigned identities). + * + * @param identity the identity value to set. + * @return the CloudHsmClusterPatchParameters object itself. + */ + public CloudHsmClusterPatchParameters withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("identity", this.identity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CloudHsmClusterPatchParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CloudHsmClusterPatchParameters if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CloudHsmClusterPatchParameters. + */ + public static CloudHsmClusterPatchParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CloudHsmClusterPatchParameters deserializedCloudHsmClusterPatchParameters + = new CloudHsmClusterPatchParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedCloudHsmClusterPatchParameters.tags = tags; + } else if ("identity".equals(fieldName)) { + deserializedCloudHsmClusterPatchParameters.identity = ManagedServiceIdentity.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCloudHsmClusterPatchParameters; + }); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterPrivateEndpointConnections.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterPrivateEndpointConnections.java new file mode 100644 index 000000000000..f15a22464e28 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterPrivateEndpointConnections.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of CloudHsmClusterPrivateEndpointConnections. + */ +public interface CloudHsmClusterPrivateEndpointConnections { + /** + * Deletes the private endpoint connection for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param peConnectionName Name of the private endpoint connection associated with the Cloud HSM Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String cloudHsmClusterName, String peConnectionName); + + /** + * Deletes the private endpoint connection for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param peConnectionName Name of the private endpoint connection associated with the Cloud HSM Cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String cloudHsmClusterName, String peConnectionName, Context context); + + /** + * Gets the private endpoint connection for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param peConnectionName Name of the private endpoint connection associated with the Cloud HSM Cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection for the Cloud Hsm Cluster along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String cloudHsmClusterName, + String peConnectionName, Context context); + + /** + * Gets the private endpoint connection for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param peConnectionName Name of the private endpoint connection associated with the Cloud HSM Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection for the Cloud Hsm Cluster. + */ + PrivateEndpointConnection get(String resourceGroupName, String cloudHsmClusterName, String peConnectionName); + + /** + * Gets the private endpoint connection for the Cloud Hsm Cluster. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection for the Cloud Hsm Cluster along with {@link Response}. + */ + PrivateEndpointConnection getById(String id); + + /** + * Gets the private endpoint connection for the Cloud Hsm Cluster. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private endpoint connection for the Cloud Hsm Cluster along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the private endpoint connection for the Cloud Hsm Cluster. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the private endpoint connection for the Cloud Hsm Cluster. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new PrivateEndpointConnection resource. + * + * @param name resource name. + * @return the first stage of the new PrivateEndpointConnection definition. + */ + PrivateEndpointConnection.DefinitionStages.Blank define(String name); +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterPrivateLinkResources.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterPrivateLinkResources.java new file mode 100644 index 000000000000..db72884b751a --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterPrivateLinkResources.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of CloudHsmClusterPrivateLinkResources. + */ +public interface CloudHsmClusterPrivateLinkResources { + /** + * Gets the private link resources supported for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources supported for the Cloud Hsm Cluster as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByCloudHsmCluster(String resourceGroupName, String cloudHsmClusterName); + + /** + * Gets the private link resources supported for the Cloud Hsm Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources supported for the Cloud Hsm Cluster as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByCloudHsmCluster(String resourceGroupName, String cloudHsmClusterName, + Context context); +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterProperties.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterProperties.java new file mode 100644 index 000000000000..1195f26ad2e1 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterProperties.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.PrivateEndpointConnectionInner; +import java.io.IOException; +import java.util.List; + +/** + * Properties of a Cloud HSM Cluster. + */ +@Fluent +public final class CloudHsmClusterProperties implements JsonSerializable { + /* + * State of security domain activation + */ + private ActivationState activationState; + + /* + * The Cloud HSM Cluster's auto-generated Domain Name Label Scope + */ + private AutoGeneratedDomainNameLabelScope autoGeneratedDomainNameLabelScope; + + /* + * An array of Cloud HSM Cluster's HSMs + */ + private List hsms; + + /* + * List of private endpoint connection resources + */ + private List privateEndpointConnections; + + /* + * The Cloud HSM Cluster's provisioningState + */ + private ProvisioningState provisioningState; + + /* + * The Cloud HSM Cluster public network access + */ + private PublicNetworkAccess publicNetworkAccess; + + /* + * Cloud HSM Cluster status message + */ + private String statusMessage; + + /** + * Creates an instance of CloudHsmClusterProperties class. + */ + public CloudHsmClusterProperties() { + } + + /** + * Get the activationState property: State of security domain activation. + * + * @return the activationState value. + */ + public ActivationState activationState() { + return this.activationState; + } + + /** + * Get the autoGeneratedDomainNameLabelScope property: The Cloud HSM Cluster's auto-generated Domain Name Label + * Scope. + * + * @return the autoGeneratedDomainNameLabelScope value. + */ + public AutoGeneratedDomainNameLabelScope autoGeneratedDomainNameLabelScope() { + return this.autoGeneratedDomainNameLabelScope; + } + + /** + * Set the autoGeneratedDomainNameLabelScope property: The Cloud HSM Cluster's auto-generated Domain Name Label + * Scope. + * + * @param autoGeneratedDomainNameLabelScope the autoGeneratedDomainNameLabelScope value to set. + * @return the CloudHsmClusterProperties object itself. + */ + public CloudHsmClusterProperties + withAutoGeneratedDomainNameLabelScope(AutoGeneratedDomainNameLabelScope autoGeneratedDomainNameLabelScope) { + this.autoGeneratedDomainNameLabelScope = autoGeneratedDomainNameLabelScope; + return this; + } + + /** + * Get the hsms property: An array of Cloud HSM Cluster's HSMs. + * + * @return the hsms value. + */ + public List hsms() { + return this.hsms; + } + + /** + * Get the privateEndpointConnections property: List of private endpoint connection resources. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** + * Get the provisioningState property: The Cloud HSM Cluster's provisioningState. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the publicNetworkAccess property: The Cloud HSM Cluster public network access. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * Set the publicNetworkAccess property: The Cloud HSM Cluster public network access. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the CloudHsmClusterProperties object itself. + */ + public CloudHsmClusterProperties withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; + return this; + } + + /** + * Get the statusMessage property: Cloud HSM Cluster status message. + * + * @return the statusMessage value. + */ + public String statusMessage() { + return this.statusMessage; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (hsms() != null) { + hsms().forEach(e -> e.validate()); + } + if (privateEndpointConnections() != null) { + privateEndpointConnections().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("autoGeneratedDomainNameLabelScope", + this.autoGeneratedDomainNameLabelScope == null ? null : this.autoGeneratedDomainNameLabelScope.toString()); + jsonWriter.writeStringField("publicNetworkAccess", + this.publicNetworkAccess == null ? null : this.publicNetworkAccess.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CloudHsmClusterProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CloudHsmClusterProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CloudHsmClusterProperties. + */ + public static CloudHsmClusterProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CloudHsmClusterProperties deserializedCloudHsmClusterProperties = new CloudHsmClusterProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("activationState".equals(fieldName)) { + deserializedCloudHsmClusterProperties.activationState + = ActivationState.fromString(reader.getString()); + } else if ("autoGeneratedDomainNameLabelScope".equals(fieldName)) { + deserializedCloudHsmClusterProperties.autoGeneratedDomainNameLabelScope + = AutoGeneratedDomainNameLabelScope.fromString(reader.getString()); + } else if ("hsms".equals(fieldName)) { + List hsms = reader.readArray(reader1 -> CloudHsmProperties.fromJson(reader1)); + deserializedCloudHsmClusterProperties.hsms = hsms; + } else if ("privateEndpointConnections".equals(fieldName)) { + List privateEndpointConnections + = reader.readArray(reader1 -> PrivateEndpointConnectionInner.fromJson(reader1)); + deserializedCloudHsmClusterProperties.privateEndpointConnections = privateEndpointConnections; + } else if ("provisioningState".equals(fieldName)) { + deserializedCloudHsmClusterProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("publicNetworkAccess".equals(fieldName)) { + deserializedCloudHsmClusterProperties.publicNetworkAccess + = PublicNetworkAccess.fromString(reader.getString()); + } else if ("statusMessage".equals(fieldName)) { + deserializedCloudHsmClusterProperties.statusMessage = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCloudHsmClusterProperties; + }); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/DedicatedHsmResource.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterResource.java similarity index 51% rename from sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/DedicatedHsmResource.java rename to sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterResource.java index 5dcf3d61f85b..72f4cbf0313a 100644 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/DedicatedHsmResource.java +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterResource.java @@ -6,27 +6,32 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; import java.io.IOException; -import java.util.List; import java.util.Map; /** - * Dedicated HSM resource. + * Cloud HSM Cluster Resource. */ @Fluent -public class DedicatedHsmResource extends Resource { +public class CloudHsmClusterResource extends Resource { + /* + * Managed service identity (system assigned and/or user assigned identities) + */ + private ManagedServiceIdentity identity; + /* * SKU details */ - private Sku sku; + private CloudHsmClusterSku sku; /* - * The Dedicated Hsm zones. + * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ - private List zones; + private SystemData systemData; /* * The type of the resource. @@ -44,9 +49,29 @@ public class DedicatedHsmResource extends Resource { private String id; /** - * Creates an instance of DedicatedHsmResource class. + * Creates an instance of CloudHsmClusterResource class. + */ + public CloudHsmClusterResource() { + } + + /** + * Get the identity property: Managed service identity (system assigned and/or user assigned identities). + * + * @return the identity value. */ - public DedicatedHsmResource() { + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: Managed service identity (system assigned and/or user assigned identities). + * + * @param identity the identity value to set. + * @return the CloudHsmClusterResource object itself. + */ + public CloudHsmClusterResource withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; } /** @@ -54,7 +79,7 @@ public DedicatedHsmResource() { * * @return the sku value. */ - public Sku sku() { + public CloudHsmClusterSku sku() { return this.sku; } @@ -62,30 +87,30 @@ public Sku sku() { * Set the sku property: SKU details. * * @param sku the sku value to set. - * @return the DedicatedHsmResource object itself. + * @return the CloudHsmClusterResource object itself. */ - public DedicatedHsmResource withSku(Sku sku) { + public CloudHsmClusterResource withSku(CloudHsmClusterSku sku) { this.sku = sku; return this; } /** - * Get the zones property: The Dedicated Hsm zones. + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * - * @return the zones value. + * @return the systemData value. */ - public List zones() { - return this.zones; + public SystemData systemData() { + return this.systemData; } /** - * Set the zones property: The Dedicated Hsm zones. + * Set the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * - * @param zones the zones value to set. - * @return the DedicatedHsmResource object itself. + * @param systemData the systemData value to set. + * @return the CloudHsmClusterResource object itself. */ - public DedicatedHsmResource withZones(List zones) { - this.zones = zones; + CloudHsmClusterResource withSystemData(SystemData systemData) { + this.systemData = systemData; return this; } @@ -123,7 +148,7 @@ public String id() { * {@inheritDoc} */ @Override - public DedicatedHsmResource withLocation(String location) { + public CloudHsmClusterResource withLocation(String location) { super.withLocation(location); return this; } @@ -132,7 +157,7 @@ public DedicatedHsmResource withLocation(String location) { * {@inheritDoc} */ @Override - public DedicatedHsmResource withTags(Map tags) { + public CloudHsmClusterResource withTags(Map tags) { super.withTags(tags); return this; } @@ -143,6 +168,9 @@ public DedicatedHsmResource withTags(Map tags) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (identity() != null) { + identity().validate(); + } if (sku() != null) { sku().validate(); } @@ -156,49 +184,50 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); jsonWriter.writeStringField("location", location()); jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("identity", this.identity); jsonWriter.writeJsonField("sku", this.sku); - jsonWriter.writeArrayField("zones", this.zones, (writer, element) -> writer.writeString(element)); return jsonWriter.writeEndObject(); } /** - * Reads an instance of DedicatedHsmResource from the JsonReader. + * Reads an instance of CloudHsmClusterResource from the JsonReader. * * @param jsonReader The JsonReader being read. - * @return An instance of DedicatedHsmResource if the JsonReader was pointing to an instance of it, or null if it + * @return An instance of CloudHsmClusterResource if the JsonReader was pointing to an instance of it, or null if it * was pointing to JSON null. * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the DedicatedHsmResource. + * @throws IOException If an error occurs while reading the CloudHsmClusterResource. */ - public static DedicatedHsmResource fromJson(JsonReader jsonReader) throws IOException { + public static CloudHsmClusterResource fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { - DedicatedHsmResource deserializedDedicatedHsmResource = new DedicatedHsmResource(); + CloudHsmClusterResource deserializedCloudHsmClusterResource = new CloudHsmClusterResource(); while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); if ("id".equals(fieldName)) { - deserializedDedicatedHsmResource.id = reader.getString(); + deserializedCloudHsmClusterResource.id = reader.getString(); } else if ("name".equals(fieldName)) { - deserializedDedicatedHsmResource.name = reader.getString(); + deserializedCloudHsmClusterResource.name = reader.getString(); } else if ("type".equals(fieldName)) { - deserializedDedicatedHsmResource.type = reader.getString(); + deserializedCloudHsmClusterResource.type = reader.getString(); } else if ("location".equals(fieldName)) { - deserializedDedicatedHsmResource.withLocation(reader.getString()); + deserializedCloudHsmClusterResource.withLocation(reader.getString()); } else if ("tags".equals(fieldName)) { Map tags = reader.readMap(reader1 -> reader1.getString()); - deserializedDedicatedHsmResource.withTags(tags); + deserializedCloudHsmClusterResource.withTags(tags); + } else if ("identity".equals(fieldName)) { + deserializedCloudHsmClusterResource.identity = ManagedServiceIdentity.fromJson(reader); } else if ("sku".equals(fieldName)) { - deserializedDedicatedHsmResource.sku = Sku.fromJson(reader); - } else if ("zones".equals(fieldName)) { - List zones = reader.readArray(reader1 -> reader1.getString()); - deserializedDedicatedHsmResource.zones = zones; + deserializedCloudHsmClusterResource.sku = CloudHsmClusterSku.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedCloudHsmClusterResource.systemData = SystemData.fromJson(reader); } else { reader.skipChildren(); } } - return deserializedDedicatedHsmResource; + return deserializedCloudHsmClusterResource; }); } } diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterRestoreStatus.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterRestoreStatus.java new file mode 100644 index 000000000000..dfd71dd3a52f --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterRestoreStatus.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of CloudHsmClusterRestoreStatus. + */ +public interface CloudHsmClusterRestoreStatus { + /** + * Gets the restore operation status of the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param jobId The id returned as part of the backup request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the restore operation status of the specified Cloud HSM Cluster. + */ + Response getWithResponse(String resourceGroupName, String cloudHsmClusterName, String jobId, + Context context); + + /** + * Gets the restore operation status of the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param jobId The id returned as part of the backup request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the restore operation status of the specified Cloud HSM Cluster. + */ + RestoreResult get(String resourceGroupName, String cloudHsmClusterName, String jobId); +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterRestoreStatusGetHeaders.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterRestoreStatusGetHeaders.java new file mode 100644 index 000000000000..53b986bea472 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterRestoreStatusGetHeaders.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; + +/** + * The CloudHsmClusterRestoreStatusGetHeaders model. + */ +@Fluent +public final class CloudHsmClusterRestoreStatusGetHeaders { + /* + * The x-ms-request-id property. + */ + private String xMsRequestId; + + /* + * The Location property. + */ + private String location; + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of CloudHsmClusterRestoreStatusGetHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public CloudHsmClusterRestoreStatusGetHeaders(HttpHeaders rawHeaders) { + this.xMsRequestId = rawHeaders.getValue(HttpHeaderName.X_MS_REQUEST_ID); + this.location = rawHeaders.getValue(HttpHeaderName.LOCATION); + } + + /** + * Get the xMsRequestId property: The x-ms-request-id property. + * + * @return the xMsRequestId value. + */ + public String xMsRequestId() { + return this.xMsRequestId; + } + + /** + * Set the xMsRequestId property: The x-ms-request-id property. + * + * @param xMsRequestId the xMsRequestId value to set. + * @return the CloudHsmClusterRestoreStatusGetHeaders object itself. + */ + public CloudHsmClusterRestoreStatusGetHeaders withXMsRequestId(String xMsRequestId) { + this.xMsRequestId = xMsRequestId; + return this; + } + + /** + * Get the location property: The Location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Location property. + * + * @param location the location value to set. + * @return the CloudHsmClusterRestoreStatusGetHeaders object itself. + */ + public CloudHsmClusterRestoreStatusGetHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterRestoreStatusGetResponse.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterRestoreStatusGetResponse.java new file mode 100644 index 000000000000..bca2c2194bca --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterRestoreStatusGetResponse.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.RestoreResultInner; + +/** + * Contains all response data for the get operation. + */ +public final class CloudHsmClusterRestoreStatusGetResponse + extends ResponseBase { + /** + * Creates an instance of CloudHsmClusterRestoreStatusGetResponse. + * + * @param request the request which resulted in this CloudHsmClusterRestoreStatusGetResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public CloudHsmClusterRestoreStatusGetResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, + RestoreResultInner value, CloudHsmClusterRestoreStatusGetHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** + * Gets the deserialized response body. + * + * @return the deserialized response body. + */ + @Override + public RestoreResultInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterSku.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterSku.java new file mode 100644 index 000000000000..9d6dfd9300a6 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterSku.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Cloud Hsm Cluster SKU information. + */ +@Fluent +public final class CloudHsmClusterSku implements JsonSerializable { + /* + * Sku family of the Cloud HSM Cluster + */ + private CloudHsmClusterSkuFamily family = CloudHsmClusterSkuFamily.B; + + /* + * Sku name of the Cloud HSM Cluster + */ + private CloudHsmClusterSkuName name; + + /* + * Sku capacity + */ + private Integer capacity; + + /** + * Creates an instance of CloudHsmClusterSku class. + */ + public CloudHsmClusterSku() { + } + + /** + * Get the family property: Sku family of the Cloud HSM Cluster. + * + * @return the family value. + */ + public CloudHsmClusterSkuFamily family() { + return this.family; + } + + /** + * Set the family property: Sku family of the Cloud HSM Cluster. + * + * @param family the family value to set. + * @return the CloudHsmClusterSku object itself. + */ + public CloudHsmClusterSku withFamily(CloudHsmClusterSkuFamily family) { + this.family = family; + return this; + } + + /** + * Get the name property: Sku name of the Cloud HSM Cluster. + * + * @return the name value. + */ + public CloudHsmClusterSkuName name() { + return this.name; + } + + /** + * Set the name property: Sku name of the Cloud HSM Cluster. + * + * @param name the name value to set. + * @return the CloudHsmClusterSku object itself. + */ + public CloudHsmClusterSku withName(CloudHsmClusterSkuName name) { + this.name = name; + return this; + } + + /** + * Get the capacity property: Sku capacity. + * + * @return the capacity value. + */ + public Integer capacity() { + return this.capacity; + } + + /** + * Set the capacity property: Sku capacity. + * + * @param capacity the capacity value to set. + * @return the CloudHsmClusterSku object itself. + */ + public CloudHsmClusterSku withCapacity(Integer capacity) { + this.capacity = capacity; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (family() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property family in model CloudHsmClusterSku")); + } + if (name() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property name in model CloudHsmClusterSku")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CloudHsmClusterSku.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("family", this.family == null ? null : this.family.toString()); + jsonWriter.writeStringField("name", this.name == null ? null : this.name.toString()); + jsonWriter.writeNumberField("capacity", this.capacity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CloudHsmClusterSku from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CloudHsmClusterSku if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CloudHsmClusterSku. + */ + public static CloudHsmClusterSku fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CloudHsmClusterSku deserializedCloudHsmClusterSku = new CloudHsmClusterSku(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("family".equals(fieldName)) { + deserializedCloudHsmClusterSku.family = CloudHsmClusterSkuFamily.fromString(reader.getString()); + } else if ("name".equals(fieldName)) { + deserializedCloudHsmClusterSku.name = CloudHsmClusterSkuName.fromString(reader.getString()); + } else if ("capacity".equals(fieldName)) { + deserializedCloudHsmClusterSku.capacity = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedCloudHsmClusterSku; + }); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterSkuFamily.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterSkuFamily.java new file mode 100644 index 000000000000..4afce55d60d8 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterSkuFamily.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Sku family of the Cloud HSM Cluster. + */ +public final class CloudHsmClusterSkuFamily extends ExpandableStringEnum { + /** + * Static value B for CloudHsmClusterSkuFamily. + */ + public static final CloudHsmClusterSkuFamily B = fromString("B"); + + /** + * Creates a new instance of CloudHsmClusterSkuFamily value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public CloudHsmClusterSkuFamily() { + } + + /** + * Creates or finds a CloudHsmClusterSkuFamily from its string representation. + * + * @param name a name to look for. + * @return the corresponding CloudHsmClusterSkuFamily. + */ + public static CloudHsmClusterSkuFamily fromString(String name) { + return fromString(name, CloudHsmClusterSkuFamily.class); + } + + /** + * Gets known CloudHsmClusterSkuFamily values. + * + * @return known CloudHsmClusterSkuFamily values. + */ + public static Collection values() { + return values(CloudHsmClusterSkuFamily.class); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterSkuName.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterSkuName.java new file mode 100644 index 000000000000..ae55df435d17 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusterSkuName.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +/** + * Sku name of the Cloud HSM Cluster. + */ +public enum CloudHsmClusterSkuName { + /** + * Enum value Standard_B1. + */ + STANDARD_B1("Standard_B1"), + + /** + * Enum value Standard B10. + */ + STANDARD_B10("Standard B10"); + + /** + * The actual serialized value for a CloudHsmClusterSkuName instance. + */ + private final String value; + + CloudHsmClusterSkuName(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a CloudHsmClusterSkuName instance. + * + * @param value the serialized value to parse. + * @return the parsed CloudHsmClusterSkuName object, or null if unable to parse. + */ + public static CloudHsmClusterSkuName fromString(String value) { + if (value == null) { + return null; + } + CloudHsmClusterSkuName[] items = CloudHsmClusterSkuName.values(); + for (CloudHsmClusterSkuName item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusters.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusters.java new file mode 100644 index 000000000000..dd100406091f --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmClusters.java @@ -0,0 +1,286 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of CloudHsmClusters. + */ +public interface CloudHsmClusters { + /** + * Gets the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified Cloud HSM Cluster along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String cloudHsmClusterName, + Context context); + + /** + * Gets the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified Cloud HSM Cluster. + */ + CloudHsmCluster getByResourceGroup(String resourceGroupName, String cloudHsmClusterName); + + /** + * Deletes the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String cloudHsmClusterName); + + /** + * Deletes the specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String cloudHsmClusterName, Context context); + + /** + * The List operation gets information about the Cloud HSM Clusters associated with the subscription and within the + * specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Cloud HSM Clusters as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * The List operation gets information about the Cloud HSM Clusters associated with the subscription and within the + * specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Cloud HSM Clusters as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, String skiptoken, Context context); + + /** + * The List operation gets information about the Cloud HSM Clusters associated with the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Cloud HSM Clusters as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * The List operation gets information about the Cloud HSM Clusters associated with the subscription. + * + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Cloud HSM Clusters as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String skiptoken, Context context); + + /** + * Pre Backup operation to validate whether the customer can perform a backup on the Cloud HSM Cluster resource in + * the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup operation Result. + */ + BackupResult validateBackupProperties(String resourceGroupName, String cloudHsmClusterName); + + /** + * Pre Backup operation to validate whether the customer can perform a backup on the Cloud HSM Cluster resource in + * the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param backupRequestProperties Backup Operation Required properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup operation Result. + */ + BackupResult validateBackupProperties(String resourceGroupName, String cloudHsmClusterName, + BackupRequestProperties backupRequestProperties, Context context); + + /** + * Create a backup of the Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup operation Result. + */ + BackupResult backup(String resourceGroupName, String cloudHsmClusterName); + + /** + * Create a backup of the Cloud HSM Cluster in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param backupRequestProperties Azure storage Resource Uri. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return backup operation Result. + */ + BackupResult backup(String resourceGroupName, String cloudHsmClusterName, + BackupRequestProperties backupRequestProperties, Context context); + + /** + * Queued validating pre restore operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore operation properties. + */ + RestoreResult validateRestoreProperties(String resourceGroupName, String cloudHsmClusterName); + + /** + * Queued validating pre restore operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param restoreRequestProperties Optional Parameters to validate prior performing a restore operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore operation properties. + */ + RestoreResult validateRestoreProperties(String resourceGroupName, String cloudHsmClusterName, + RestoreRequestProperties restoreRequestProperties, Context context); + + /** + * Restores all key materials of a specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param restoreRequestProperties Restore Operation Required properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore operation properties. + */ + RestoreResult restore(String resourceGroupName, String cloudHsmClusterName, + RestoreRequestProperties restoreRequestProperties); + + /** + * Restores all key materials of a specified Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param restoreRequestProperties Restore Operation Required properties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return restore operation properties. + */ + RestoreResult restore(String resourceGroupName, String cloudHsmClusterName, + RestoreRequestProperties restoreRequestProperties, Context context); + + /** + * Gets the specified Cloud HSM Cluster. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified Cloud HSM Cluster along with {@link Response}. + */ + CloudHsmCluster getById(String id); + + /** + * Gets the specified Cloud HSM Cluster. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified Cloud HSM Cluster along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the specified Cloud HSM Cluster. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the specified Cloud HSM Cluster. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new CloudHsmCluster resource. + * + * @param name resource name. + * @return the first stage of the new CloudHsmCluster definition. + */ + CloudHsmCluster.DefinitionStages.Blank define(String name); +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmProperties.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmProperties.java new file mode 100644 index 000000000000..dc9c85662207 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/CloudHsmProperties.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Cloud HSM Properties. + */ +@Fluent +public final class CloudHsmProperties implements JsonSerializable { + /* + * FQDN of the Cloud HSM + */ + private String fqdn; + + /* + * The Cloud HSM State. Values are: Deploying, ConfiguringSlb, Starting, Starting, Failed, Failed, Deleting, + * DeletingSlbEntry, InitialProvisioning, Updating + */ + private String state; + + /* + * The Cloud HSM State message + */ + private String stateMessage; + + /** + * Creates an instance of CloudHsmProperties class. + */ + public CloudHsmProperties() { + } + + /** + * Get the fqdn property: FQDN of the Cloud HSM. + * + * @return the fqdn value. + */ + public String fqdn() { + return this.fqdn; + } + + /** + * Set the fqdn property: FQDN of the Cloud HSM. + * + * @param fqdn the fqdn value to set. + * @return the CloudHsmProperties object itself. + */ + public CloudHsmProperties withFqdn(String fqdn) { + this.fqdn = fqdn; + return this; + } + + /** + * Get the state property: The Cloud HSM State. Values are: Deploying, ConfiguringSlb, Starting, Starting, Failed, + * Failed, Deleting, DeletingSlbEntry, InitialProvisioning, Updating. + * + * @return the state value. + */ + public String state() { + return this.state; + } + + /** + * Set the state property: The Cloud HSM State. Values are: Deploying, ConfiguringSlb, Starting, Starting, Failed, + * Failed, Deleting, DeletingSlbEntry, InitialProvisioning, Updating. + * + * @param state the state value to set. + * @return the CloudHsmProperties object itself. + */ + public CloudHsmProperties withState(String state) { + this.state = state; + return this; + } + + /** + * Get the stateMessage property: The Cloud HSM State message. + * + * @return the stateMessage value. + */ + public String stateMessage() { + return this.stateMessage; + } + + /** + * Set the stateMessage property: The Cloud HSM State message. + * + * @param stateMessage the stateMessage value to set. + * @return the CloudHsmProperties object itself. + */ + public CloudHsmProperties withStateMessage(String stateMessage) { + this.stateMessage = stateMessage; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("fqdn", this.fqdn); + jsonWriter.writeStringField("state", this.state); + jsonWriter.writeStringField("stateMessage", this.stateMessage); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CloudHsmProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CloudHsmProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the CloudHsmProperties. + */ + public static CloudHsmProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CloudHsmProperties deserializedCloudHsmProperties = new CloudHsmProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("fqdn".equals(fieldName)) { + deserializedCloudHsmProperties.fqdn = reader.getString(); + } else if ("state".equals(fieldName)) { + deserializedCloudHsmProperties.state = reader.getString(); + } else if ("stateMessage".equals(fieldName)) { + deserializedCloudHsmProperties.stateMessage = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCloudHsmProperties; + }); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/DedicatedHsm.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/DedicatedHsm.java index 0e2902709de4..943c44fc99fe 100644 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/DedicatedHsm.java +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/DedicatedHsm.java @@ -65,18 +65,18 @@ public interface DedicatedHsm { List zones(); /** - * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * Gets the properties property: Properties of the dedicated HSM. * - * @return the systemData value. + * @return the properties value. */ - SystemData systemData(); + DedicatedHsmProperties properties(); /** - * Gets the properties property: Properties of the dedicated HSM. + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * - * @return the properties value. + * @return the systemData value. */ - DedicatedHsmProperties properties(); + SystemData systemData(); /** * Gets the region of the resource. @@ -109,8 +109,9 @@ public interface DedicatedHsm { /** * The entirety of the DedicatedHsm definition. */ - interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, - DefinitionStages.WithResourceGroup, DefinitionStages.WithProperties, DefinitionStages.WithCreate { + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithLocation, DefinitionStages.WithResourceGroup, + DefinitionStages.WithSku, DefinitionStages.WithProperties, DefinitionStages.WithCreate { } /** @@ -151,10 +152,23 @@ interface WithResourceGroup { /** * Specifies resourceGroupName. * - * @param resourceGroupName The name of the Resource Group to which the resource belongs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithSku withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the DedicatedHsm definition allowing to specify sku. + */ + interface WithSku { + /** + * Specifies the sku property: SKU details. + * + * @param sku SKU details. * @return the next definition stage. */ - WithProperties withExistingResourceGroup(String resourceGroupName); + WithProperties withSku(Sku sku); } /** @@ -174,7 +188,7 @@ interface WithProperties { * The stage of the DedicatedHsm definition which contains all the minimum required properties for the resource * to be created, but also allows for any other optional properties to be specified. */ - interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithSku, DefinitionStages.WithZones { + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithZones { /** * Executes the create request. * @@ -204,19 +218,6 @@ interface WithTags { WithCreate withTags(Map tags); } - /** - * The stage of the DedicatedHsm definition allowing to specify sku. - */ - interface WithSku { - /** - * Specifies the sku property: SKU details. - * - * @param sku SKU details. - * @return the next definition stage. - */ - WithCreate withSku(Sku sku); - } - /** * The stage of the DedicatedHsm definition allowing to specify zones. */ diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/DedicatedHsmOperation.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/DedicatedHsmOperation.java deleted file mode 100644 index 8a91615715d1..000000000000 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/DedicatedHsmOperation.java +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.hardwaresecuritymodules.models; - -import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.DedicatedHsmOperationInner; - -/** - * An immutable client-side representation of DedicatedHsmOperation. - */ -public interface DedicatedHsmOperation { - /** - * Gets the name property: The name of the Dedicated HSM Resource Provider Operation. - * - * @return the name value. - */ - String name(); - - /** - * Gets the isDataAction property: Gets or sets a value indicating whether it is a data plane action. - * - * @return the isDataAction value. - */ - Boolean isDataAction(); - - /** - * Gets the origin property: The origin of the operation. - * - * @return the origin value. - */ - String origin(); - - /** - * Gets the display property: The display string. - * - * @return the display value. - */ - DedicatedHsmOperationDisplay display(); - - /** - * Gets the inner com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.DedicatedHsmOperationInner object. - * - * @return the inner object. - */ - DedicatedHsmOperationInner innerModel(); -} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/DedicatedHsmOperationDisplay.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/DedicatedHsmOperationDisplay.java deleted file mode 100644 index fdb777fadb3f..000000000000 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/DedicatedHsmOperationDisplay.java +++ /dev/null @@ -1,177 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.hardwaresecuritymodules.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The display string. - */ -@Fluent -public final class DedicatedHsmOperationDisplay implements JsonSerializable { - /* - * The Resource Provider of the operation - */ - private String provider; - - /* - * Resource on which the operation is performed. - */ - private String resource; - - /* - * Operation type: Read, write, delete, etc. - */ - private String operation; - - /* - * The object that represents the operation. - */ - private String description; - - /** - * Creates an instance of DedicatedHsmOperationDisplay class. - */ - public DedicatedHsmOperationDisplay() { - } - - /** - * Get the provider property: The Resource Provider of the operation. - * - * @return the provider value. - */ - public String provider() { - return this.provider; - } - - /** - * Set the provider property: The Resource Provider of the operation. - * - * @param provider the provider value to set. - * @return the DedicatedHsmOperationDisplay object itself. - */ - public DedicatedHsmOperationDisplay withProvider(String provider) { - this.provider = provider; - return this; - } - - /** - * Get the resource property: Resource on which the operation is performed. - * - * @return the resource value. - */ - public String resource() { - return this.resource; - } - - /** - * Set the resource property: Resource on which the operation is performed. - * - * @param resource the resource value to set. - * @return the DedicatedHsmOperationDisplay object itself. - */ - public DedicatedHsmOperationDisplay withResource(String resource) { - this.resource = resource; - return this; - } - - /** - * Get the operation property: Operation type: Read, write, delete, etc. - * - * @return the operation value. - */ - public String operation() { - return this.operation; - } - - /** - * Set the operation property: Operation type: Read, write, delete, etc. - * - * @param operation the operation value to set. - * @return the DedicatedHsmOperationDisplay object itself. - */ - public DedicatedHsmOperationDisplay withOperation(String operation) { - this.operation = operation; - return this; - } - - /** - * Get the description property: The object that represents the operation. - * - * @return the description value. - */ - public String description() { - return this.description; - } - - /** - * Set the description property: The object that represents the operation. - * - * @param description the description value to set. - * @return the DedicatedHsmOperationDisplay object itself. - */ - public DedicatedHsmOperationDisplay withDescription(String description) { - this.description = description; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("provider", this.provider); - jsonWriter.writeStringField("resource", this.resource); - jsonWriter.writeStringField("operation", this.operation); - jsonWriter.writeStringField("description", this.description); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of DedicatedHsmOperationDisplay from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of DedicatedHsmOperationDisplay if the JsonReader was pointing to an instance of it, or null - * if it was pointing to JSON null. - * @throws IOException If an error occurs while reading the DedicatedHsmOperationDisplay. - */ - public static DedicatedHsmOperationDisplay fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - DedicatedHsmOperationDisplay deserializedDedicatedHsmOperationDisplay = new DedicatedHsmOperationDisplay(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("provider".equals(fieldName)) { - deserializedDedicatedHsmOperationDisplay.provider = reader.getString(); - } else if ("resource".equals(fieldName)) { - deserializedDedicatedHsmOperationDisplay.resource = reader.getString(); - } else if ("operation".equals(fieldName)) { - deserializedDedicatedHsmOperationDisplay.operation = reader.getString(); - } else if ("description".equals(fieldName)) { - deserializedDedicatedHsmOperationDisplay.description = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedDedicatedHsmOperationDisplay; - }); - } -} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/DedicatedHsmOperationListResult.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/DedicatedHsmOperationListResult.java deleted file mode 100644 index b27d68eab281..000000000000 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/DedicatedHsmOperationListResult.java +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.hardwaresecuritymodules.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.DedicatedHsmOperationInner; -import java.io.IOException; -import java.util.List; - -/** - * Result of the request to list Dedicated HSM Provider operations. It contains a list of operations. - */ -@Fluent -public final class DedicatedHsmOperationListResult implements JsonSerializable { - /* - * List of Dedicated HSM Resource Provider operations. - */ - private List value; - - /** - * Creates an instance of DedicatedHsmOperationListResult class. - */ - public DedicatedHsmOperationListResult() { - } - - /** - * Get the value property: List of Dedicated HSM Resource Provider operations. - * - * @return the value value. - */ - public List value() { - return this.value; - } - - /** - * Set the value property: List of Dedicated HSM Resource Provider operations. - * - * @param value the value value to set. - * @return the DedicatedHsmOperationListResult object itself. - */ - public DedicatedHsmOperationListResult withValue(List value) { - this.value = value; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (value() != null) { - value().forEach(e -> e.validate()); - } - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of DedicatedHsmOperationListResult from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of DedicatedHsmOperationListResult if the JsonReader was pointing to an instance of it, or - * null if it was pointing to JSON null. - * @throws IOException If an error occurs while reading the DedicatedHsmOperationListResult. - */ - public static DedicatedHsmOperationListResult fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - DedicatedHsmOperationListResult deserializedDedicatedHsmOperationListResult - = new DedicatedHsmOperationListResult(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - List value - = reader.readArray(reader1 -> DedicatedHsmOperationInner.fromJson(reader1)); - deserializedDedicatedHsmOperationListResult.value = value; - } else { - reader.skipChildren(); - } - } - - return deserializedDedicatedHsmOperationListResult; - }); - } -} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/DedicatedHsms.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/DedicatedHsms.java index e946c0af6cfc..750a3a4c53ba 100644 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/DedicatedHsms.java +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/DedicatedHsms.java @@ -15,8 +15,8 @@ public interface DedicatedHsms { /** * Deletes the specified Azure Dedicated HSM. * - * @param resourceGroupName The name of the Resource Group to which the dedicated HSM belongs. - * @param name The name of the dedicated HSM to delete. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.resourcemanager.hardwaresecuritymodules.models.ErrorException thrown if the request is rejected * by server. @@ -27,8 +27,8 @@ public interface DedicatedHsms { /** * Deletes the specified Azure Dedicated HSM. * - * @param resourceGroupName The name of the Resource Group to which the dedicated HSM belongs. - * @param name The name of the dedicated HSM to delete. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.resourcemanager.hardwaresecuritymodules.models.ErrorException thrown if the request is rejected @@ -40,8 +40,8 @@ public interface DedicatedHsms { /** * Gets the specified Azure dedicated HSM. * - * @param resourceGroupName The name of the Resource Group to which the dedicated hsm belongs. - * @param name The name of the dedicated HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.resourcemanager.hardwaresecuritymodules.models.ErrorException thrown if the request is rejected @@ -54,8 +54,8 @@ public interface DedicatedHsms { /** * Gets the specified Azure dedicated HSM. * - * @param resourceGroupName The name of the Resource Group to which the dedicated hsm belongs. - * @param name The name of the dedicated HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.resourcemanager.hardwaresecuritymodules.models.ErrorException thrown if the request is rejected * by server. @@ -68,7 +68,7 @@ public interface DedicatedHsms { * The List operation gets information about the dedicated hsms associated with the subscription and within the * specified resource group. * - * @param resourceGroupName The name of the Resource Group to which the dedicated HSM belongs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.resourcemanager.hardwaresecuritymodules.models.ErrorException thrown if the request is rejected * by server. @@ -81,7 +81,7 @@ public interface DedicatedHsms { * The List operation gets information about the dedicated hsms associated with the subscription and within the * specified resource group. * - * @param resourceGroupName The name of the Resource Group to which the dedicated HSM belongs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param top Maximum number of results to return. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -122,8 +122,8 @@ public interface DedicatedHsms { * 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. * - * @param resourceGroupName The name of the Resource Group to which the dedicated hsm belongs. - * @param name The name of the dedicated HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.resourcemanager.hardwaresecuritymodules.models.ErrorException thrown if the request is rejected * by server. @@ -141,8 +141,8 @@ PagedIterable listOutboundNetworkDependenciesEndpoi * 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. * - * @param resourceGroupName The name of the Resource Group to which the dedicated hsm belongs. - * @param name The name of the dedicated HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name Name of the dedicated Hsm. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.resourcemanager.hardwaresecuritymodules.models.ErrorException thrown if the request is rejected diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/ManagedServiceIdentity.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/ManagedServiceIdentity.java new file mode 100644 index 000000000000..cdc04afd0c46 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/ManagedServiceIdentity.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; +import java.util.UUID; + +/** + * Managed service identity (system assigned and/or user assigned identities). + */ +@Fluent +public final class ManagedServiceIdentity implements JsonSerializable { + /* + * The service principal ID of the system assigned identity. This property will only be provided for a system + * assigned identity. + */ + private UUID principalId; + + /* + * The tenant ID of the system assigned identity. This property will only be provided for a system assigned + * identity. + */ + private UUID tenantId; + + /* + * Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + */ + private ManagedServiceIdentityType type; + + /* + * The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will + * be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/ + * userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests. + */ + private Map userAssignedIdentities; + + /** + * Creates an instance of ManagedServiceIdentity class. + */ + public ManagedServiceIdentity() { + } + + /** + * Get the principalId property: The service principal ID of the system assigned identity. This property will only + * be provided for a system assigned identity. + * + * @return the principalId value. + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant ID of the system assigned identity. This property will only be provided for + * a system assigned identity. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Get the type property: Type of managed service identity (where both SystemAssigned and UserAssigned types are + * allowed). + * + * @return the type value. + */ + public ManagedServiceIdentityType type() { + return this.type; + } + + /** + * Set the type property: Type of managed service identity (where both SystemAssigned and UserAssigned types are + * allowed). + * + * @param type the type value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withType(ManagedServiceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentities property: The set of user assigned identities associated with the resource. The + * userAssignedIdentities dictionary keys will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + * The dictionary values can be empty objects ({}) in requests. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The set of user assigned identities associated with the resource. The + * userAssignedIdentities dictionary keys will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + * The dictionary values can be empty objects ({}) in requests. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (type() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property type in model ManagedServiceIdentity")); + } + if (userAssignedIdentities() != null) { + userAssignedIdentities().values().forEach(e -> { + if (e != null) { + e.validate(); + } + }); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ManagedServiceIdentity.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeMapField("userAssignedIdentities", this.userAssignedIdentities, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedServiceIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedServiceIdentity if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ManagedServiceIdentity. + */ + public static ManagedServiceIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedServiceIdentity deserializedManagedServiceIdentity = new ManagedServiceIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedManagedServiceIdentity.type = ManagedServiceIdentityType.fromString(reader.getString()); + } else if ("principalId".equals(fieldName)) { + deserializedManagedServiceIdentity.principalId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("tenantId".equals(fieldName)) { + deserializedManagedServiceIdentity.tenantId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("userAssignedIdentities".equals(fieldName)) { + Map userAssignedIdentities + = reader.readMap(reader1 -> UserAssignedIdentity.fromJson(reader1)); + deserializedManagedServiceIdentity.userAssignedIdentities = userAssignedIdentities; + } else { + reader.skipChildren(); + } + } + + return deserializedManagedServiceIdentity; + }); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/ManagedServiceIdentityType.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/ManagedServiceIdentityType.java new file mode 100644 index 000000000000..1054c5c20eab --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/ManagedServiceIdentityType.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + */ +public final class ManagedServiceIdentityType extends ExpandableStringEnum { + /** + * Static value None for ManagedServiceIdentityType. + */ + public static final ManagedServiceIdentityType NONE = fromString("None"); + + /** + * Static value SystemAssigned for ManagedServiceIdentityType. + */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** + * Static value UserAssigned for ManagedServiceIdentityType. + */ + public static final ManagedServiceIdentityType USER_ASSIGNED = fromString("UserAssigned"); + + /** + * Static value SystemAssigned,UserAssigned for ManagedServiceIdentityType. + */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED_USER_ASSIGNED + = fromString("SystemAssigned,UserAssigned"); + + /** + * Creates a new instance of ManagedServiceIdentityType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ManagedServiceIdentityType() { + } + + /** + * Creates or finds a ManagedServiceIdentityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedServiceIdentityType. + */ + public static ManagedServiceIdentityType fromString(String name) { + return fromString(name, ManagedServiceIdentityType.class); + } + + /** + * Gets known ManagedServiceIdentityType values. + * + * @return known ManagedServiceIdentityType values. + */ + public static Collection values() { + return values(ManagedServiceIdentityType.class); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/NetworkInterface.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/NetworkInterface.java index b3630a6b23bd..2b0248fd321a 100644 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/NetworkInterface.java +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/NetworkInterface.java @@ -17,9 +17,9 @@ @Fluent public final class NetworkInterface implements JsonSerializable { /* - * The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + * The Azure resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... */ - private String id; + private String resourceId; /* * Private Ip address of the interface @@ -33,13 +33,13 @@ public NetworkInterface() { } /** - * Get the id property: The ARM resource id in the form of + * Get the resourceId property: The Azure resource id in the form of * /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... * - * @return the id value. + * @return the resourceId value. */ - public String id() { - return this.id; + public String resourceId() { + return this.resourceId; } /** @@ -95,8 +95,8 @@ public static NetworkInterface fromJson(JsonReader jsonReader) throws IOExceptio String fieldName = reader.getFieldName(); reader.nextToken(); - if ("id".equals(fieldName)) { - deserializedNetworkInterface.id = reader.getString(); + if ("resourceId".equals(fieldName)) { + deserializedNetworkInterface.resourceId = reader.getString(); } else if ("privateIpAddress".equals(fieldName)) { deserializedNetworkInterface.privateIpAddress = reader.getString(); } else { diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/Operation.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/Operation.java new file mode 100644 index 000000000000..b075289a485d --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/Operation.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.OperationInner; + +/** + * An immutable client-side representation of Operation. + */ +public interface Operation { + /** + * Gets the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + Origin origin(); + + /** + * Gets the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + ActionType actionType(); + + /** + * Gets the inner com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/OperationDisplay.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/OperationDisplay.java new file mode 100644 index 000000000000..c9b98ad61e21 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/OperationDisplay.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Localized display information for this particular operation. + */ +@Immutable +public final class OperationDisplay implements JsonSerializable { + /* + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or + * "Microsoft Compute". + */ + private String provider; + + /* + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or + * "Job Schedule Collections". + */ + private String resource; + + /* + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + */ + private String operation; + + /* + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + */ + private String description; + + /** + * Creates an instance of OperationDisplay class. + */ + public OperationDisplay() { + } + + /** + * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring + * Insights" or "Microsoft Compute". + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. + * "Virtual Machines" or "Job Schedule Collections". + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: The short, localized friendly description of the operation; suitable for tool tips + * and detailed views. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationDisplay from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationDisplay if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationDisplay. + */ + public static OperationDisplay fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationDisplay deserializedOperationDisplay = new OperationDisplay(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provider".equals(fieldName)) { + deserializedOperationDisplay.provider = reader.getString(); + } else if ("resource".equals(fieldName)) { + deserializedOperationDisplay.resource = reader.getString(); + } else if ("operation".equals(fieldName)) { + deserializedOperationDisplay.operation = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedOperationDisplay.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationDisplay; + }); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/OperationListResult.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/OperationListResult.java new file mode 100644 index 000000000000..6724b19a8385 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/OperationListResult.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.OperationInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + * results. + */ +@Immutable +public final class OperationListResult implements JsonSerializable { + /* + * List of operations supported by the resource provider + */ + private List value; + + /* + * URL to get the next set of operation list results (if there are any). + */ + private String nextLink; + + /** + * Creates an instance of OperationListResult class. + */ + public OperationListResult() { + } + + /** + * Get the value property: List of operations supported by the resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results (if there are any). + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationListResult. + */ + public static OperationListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationListResult deserializedOperationListResult = new OperationListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> OperationInner.fromJson(reader1)); + deserializedOperationListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedOperationListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationListResult; + }); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/Operations.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/Operations.java index 007b6726a999..6d84fb289569 100644 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/Operations.java +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/Operations.java @@ -12,24 +12,22 @@ */ public interface Operations { /** - * Get a list of Dedicated HSM operations. + * Get a list of Hardware Security Modules operations. * - * @throws com.azure.resourcemanager.hardwaresecuritymodules.models.ErrorException thrown if the request is rejected - * by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of Dedicated HSM operations as paginated response with {@link PagedIterable}. + * @return a list of Hardware Security Modules operations as paginated response with {@link PagedIterable}. */ - PagedIterable list(); + PagedIterable list(); /** - * Get a list of Dedicated HSM operations. + * Get a list of Hardware Security Modules operations. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.hardwaresecuritymodules.models.ErrorException thrown if the request is rejected - * by server. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of Dedicated HSM operations as paginated response with {@link PagedIterable}. + * @return a list of Hardware Security Modules operations as paginated response with {@link PagedIterable}. */ - PagedIterable list(Context context); + PagedIterable list(Context context); } diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/Origin.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/Origin.java new file mode 100644 index 000000000000..20f7ef248385 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/Origin.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value + * is "user,system". + */ +public final class Origin extends ExpandableStringEnum { + /** + * Static value user for Origin. + */ + public static final Origin USER = fromString("user"); + + /** + * Static value system for Origin. + */ + public static final Origin SYSTEM = fromString("system"); + + /** + * Static value user,system for Origin. + */ + public static final Origin USER_SYSTEM = fromString("user,system"); + + /** + * Creates a new instance of Origin value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Origin() { + } + + /** + * Creates or finds a Origin from its string representation. + * + * @param name a name to look for. + * @return the corresponding Origin. + */ + public static Origin fromString(String name) { + return fromString(name, Origin.class); + } + + /** + * Gets known Origin values. + * + * @return known Origin values. + */ + public static Collection values() { + return values(Origin.class); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/PrivateEndpoint.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/PrivateEndpoint.java new file mode 100644 index 000000000000..7327a1d843cd --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/PrivateEndpoint.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The private endpoint resource. + */ +@Immutable +public final class PrivateEndpoint implements JsonSerializable { + /* + * The ARM identifier for private endpoint. + */ + private String id; + + /** + * Creates an instance of PrivateEndpoint class. + */ + public PrivateEndpoint() { + } + + /** + * Get the id property: The ARM identifier for private endpoint. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateEndpoint from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateEndpoint if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the PrivateEndpoint. + */ + public static PrivateEndpoint fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateEndpoint deserializedPrivateEndpoint = new PrivateEndpoint(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPrivateEndpoint.id = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateEndpoint; + }); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/PrivateEndpointConnection.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/PrivateEndpointConnection.java new file mode 100644 index 000000000000..7665a97c8711 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/PrivateEndpointConnection.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.PrivateEndpointConnectionInner; + +/** + * An immutable client-side representation of PrivateEndpointConnection. + */ +public interface PrivateEndpointConnection { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: Resource properties. + * + * @return the properties value. + */ + PrivateEndpointConnectionProperties properties(); + + /** + * Gets the etag property: Modified whenever there is a change in the state of private endpoint connection. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.PrivateEndpointConnectionInner + * object. + * + * @return the inner object. + */ + PrivateEndpointConnectionInner innerModel(); + + /** + * The entirety of the PrivateEndpointConnection definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The PrivateEndpointConnection definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the PrivateEndpointConnection definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the PrivateEndpointConnection definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, cloudHsmClusterName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @return the next definition stage. + */ + WithCreate withExistingCloudHsmCluster(String resourceGroupName, String cloudHsmClusterName); + } + + /** + * The stage of the PrivateEndpointConnection definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties, DefinitionStages.WithEtag { + /** + * Executes the create request. + * + * @return the created resource. + */ + PrivateEndpointConnection create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + PrivateEndpointConnection create(Context context); + } + + /** + * The stage of the PrivateEndpointConnection definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: Resource properties.. + * + * @param properties Resource properties. + * @return the next definition stage. + */ + WithCreate withProperties(PrivateEndpointConnectionProperties properties); + } + + /** + * The stage of the PrivateEndpointConnection definition allowing to specify etag. + */ + interface WithEtag { + /** + * Specifies the etag property: Modified whenever there is a change in the state of private endpoint + * connection.. + * + * @param etag Modified whenever there is a change in the state of private endpoint connection. + * @return the next definition stage. + */ + WithCreate withEtag(String etag); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + PrivateEndpointConnection refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + PrivateEndpointConnection refresh(Context context); +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/PrivateEndpointConnectionListResult.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/PrivateEndpointConnectionListResult.java new file mode 100644 index 000000000000..e0b0a0b80bd7 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/PrivateEndpointConnectionListResult.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.PrivateEndpointConnectionInner; +import java.io.IOException; +import java.util.List; + +/** + * List of private endpoint connections associated with the specified resource. + */ +@Fluent +public final class PrivateEndpointConnectionListResult + implements JsonSerializable { + /* + * Array of private endpoint connections. + */ + private List value; + + /* + * The URL to get the next set of private endpoint connections. + */ + private String nextLink; + + /** + * Creates an instance of PrivateEndpointConnectionListResult class. + */ + public PrivateEndpointConnectionListResult() { + } + + /** + * Get the value property: Array of private endpoint connections. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of private endpoint connections. + * + * @param value the value value to set. + * @return the PrivateEndpointConnectionListResult object itself. + */ + public PrivateEndpointConnectionListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to get the next set of private endpoint connections. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URL to get the next set of private endpoint connections. + * + * @param nextLink the nextLink value to set. + * @return the PrivateEndpointConnectionListResult object itself. + */ + public PrivateEndpointConnectionListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateEndpointConnectionListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateEndpointConnectionListResult if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PrivateEndpointConnectionListResult. + */ + public static PrivateEndpointConnectionListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateEndpointConnectionListResult deserializedPrivateEndpointConnectionListResult + = new PrivateEndpointConnectionListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> PrivateEndpointConnectionInner.fromJson(reader1)); + deserializedPrivateEndpointConnectionListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedPrivateEndpointConnectionListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateEndpointConnectionListResult; + }); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/PrivateEndpointConnectionProperties.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/PrivateEndpointConnectionProperties.java new file mode 100644 index 000000000000..19ed791d5333 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/PrivateEndpointConnectionProperties.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Properties of the private endpoint connection. + */ +@Fluent +public final class PrivateEndpointConnectionProperties + implements JsonSerializable { + /* + * The private endpoint resource. + */ + private PrivateEndpoint privateEndpoint; + + /* + * A collection of information about the state of the connection between service consumer and provider. + */ + private PrivateLinkServiceConnectionState privateLinkServiceConnectionState; + + /* + * The provisioning state of the private endpoint connection resource. + */ + private PrivateEndpointConnectionProvisioningState provisioningState; + + /* + * The group ids for the private endpoint resource. + */ + private List groupIds; + + /** + * Creates an instance of PrivateEndpointConnectionProperties class. + */ + public PrivateEndpointConnectionProperties() { + } + + /** + * Get the privateEndpoint property: The private endpoint resource. + * + * @return the privateEndpoint value. + */ + public PrivateEndpoint privateEndpoint() { + return this.privateEndpoint; + } + + /** + * Set the privateEndpoint property: The private endpoint resource. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties withPrivateEndpoint(PrivateEndpoint privateEndpoint) { + this.privateEndpoint = privateEndpoint; + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: A collection of information about the state of the connection + * between service consumer and provider. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.privateLinkServiceConnectionState; + } + + /** + * Set the privateLinkServiceConnectionState property: A collection of information about the state of the connection + * between service consumer and provider. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties + withPrivateLinkServiceConnectionState(PrivateLinkServiceConnectionState privateLinkServiceConnectionState) { + this.privateLinkServiceConnectionState = privateLinkServiceConnectionState; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the private endpoint connection resource. + * + * @return the provisioningState value. + */ + public PrivateEndpointConnectionProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the groupIds property: The group ids for the private endpoint resource. + * + * @return the groupIds value. + */ + public List groupIds() { + return this.groupIds; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateEndpoint() != null) { + privateEndpoint().validate(); + } + if (privateLinkServiceConnectionState() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property privateLinkServiceConnectionState in model PrivateEndpointConnectionProperties")); + } else { + privateLinkServiceConnectionState().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(PrivateEndpointConnectionProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("privateLinkServiceConnectionState", this.privateLinkServiceConnectionState); + jsonWriter.writeJsonField("privateEndpoint", this.privateEndpoint); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateEndpointConnectionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateEndpointConnectionProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PrivateEndpointConnectionProperties. + */ + public static PrivateEndpointConnectionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateEndpointConnectionProperties deserializedPrivateEndpointConnectionProperties + = new PrivateEndpointConnectionProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("privateLinkServiceConnectionState".equals(fieldName)) { + deserializedPrivateEndpointConnectionProperties.privateLinkServiceConnectionState + = PrivateLinkServiceConnectionState.fromJson(reader); + } else if ("privateEndpoint".equals(fieldName)) { + deserializedPrivateEndpointConnectionProperties.privateEndpoint = PrivateEndpoint.fromJson(reader); + } else if ("provisioningState".equals(fieldName)) { + deserializedPrivateEndpointConnectionProperties.provisioningState + = PrivateEndpointConnectionProvisioningState.fromString(reader.getString()); + } else if ("groupIds".equals(fieldName)) { + List groupIds = reader.readArray(reader1 -> reader1.getString()); + deserializedPrivateEndpointConnectionProperties.groupIds = groupIds; + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateEndpointConnectionProperties; + }); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/PrivateEndpointConnectionProvisioningState.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/PrivateEndpointConnectionProvisioningState.java new file mode 100644 index 000000000000..898be9c8bfac --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/PrivateEndpointConnectionProvisioningState.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The current provisioning state. + */ +public final class PrivateEndpointConnectionProvisioningState + extends ExpandableStringEnum { + /** + * Static value Succeeded for PrivateEndpointConnectionProvisioningState. + */ + public static final PrivateEndpointConnectionProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Static value Creating for PrivateEndpointConnectionProvisioningState. + */ + public static final PrivateEndpointConnectionProvisioningState CREATING = fromString("Creating"); + + /** + * Static value Deleting for PrivateEndpointConnectionProvisioningState. + */ + public static final PrivateEndpointConnectionProvisioningState DELETING = fromString("Deleting"); + + /** + * Static value Failed for PrivateEndpointConnectionProvisioningState. + */ + public static final PrivateEndpointConnectionProvisioningState FAILED = fromString("Failed"); + + /** + * Static value Updating for PrivateEndpointConnectionProvisioningState. + */ + public static final PrivateEndpointConnectionProvisioningState UPDATING = fromString("Updating"); + + /** + * Static value InternalError for PrivateEndpointConnectionProvisioningState. + */ + public static final PrivateEndpointConnectionProvisioningState INTERNAL_ERROR = fromString("InternalError"); + + /** + * Static value Canceled for PrivateEndpointConnectionProvisioningState. + */ + public static final PrivateEndpointConnectionProvisioningState CANCELED = fromString("Canceled"); + + /** + * Creates a new instance of PrivateEndpointConnectionProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PrivateEndpointConnectionProvisioningState() { + } + + /** + * Creates or finds a PrivateEndpointConnectionProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrivateEndpointConnectionProvisioningState. + */ + public static PrivateEndpointConnectionProvisioningState fromString(String name) { + return fromString(name, PrivateEndpointConnectionProvisioningState.class); + } + + /** + * Gets known PrivateEndpointConnectionProvisioningState values. + * + * @return known PrivateEndpointConnectionProvisioningState values. + */ + public static Collection values() { + return values(PrivateEndpointConnectionProvisioningState.class); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/PrivateEndpointConnections.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/PrivateEndpointConnections.java new file mode 100644 index 000000000000..abcf5eb36b07 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/PrivateEndpointConnections.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of PrivateEndpointConnections. + */ +public interface PrivateEndpointConnections { + /** + * The List operation gets information about the private endpoint connections associated with the Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of private endpoint connections associated with the specified resource as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByCloudHsmCluster(String resourceGroupName, + String cloudHsmClusterName); + + /** + * The List operation gets information about the private endpoint connections associated with the Cloud HSM Cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cloudHsmClusterName 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of private endpoint connections associated with the specified resource as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByCloudHsmCluster(String resourceGroupName, String cloudHsmClusterName, + Context context); +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/PrivateEndpointServiceConnectionStatus.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/PrivateEndpointServiceConnectionStatus.java new file mode 100644 index 000000000000..9f0dec687772 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/PrivateEndpointServiceConnectionStatus.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The private endpoint connection status. + */ +public final class PrivateEndpointServiceConnectionStatus + extends ExpandableStringEnum { + /** + * Static value Pending for PrivateEndpointServiceConnectionStatus. + */ + public static final PrivateEndpointServiceConnectionStatus PENDING = fromString("Pending"); + + /** + * Static value Approved for PrivateEndpointServiceConnectionStatus. + */ + public static final PrivateEndpointServiceConnectionStatus APPROVED = fromString("Approved"); + + /** + * Static value Rejected for PrivateEndpointServiceConnectionStatus. + */ + public static final PrivateEndpointServiceConnectionStatus REJECTED = fromString("Rejected"); + + /** + * Creates a new instance of PrivateEndpointServiceConnectionStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PrivateEndpointServiceConnectionStatus() { + } + + /** + * Creates or finds a PrivateEndpointServiceConnectionStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrivateEndpointServiceConnectionStatus. + */ + public static PrivateEndpointServiceConnectionStatus fromString(String name) { + return fromString(name, PrivateEndpointServiceConnectionStatus.class); + } + + /** + * Gets known PrivateEndpointServiceConnectionStatus values. + * + * @return known PrivateEndpointServiceConnectionStatus values. + */ + public static Collection values() { + return values(PrivateEndpointServiceConnectionStatus.class); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/PrivateLinkResource.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/PrivateLinkResource.java new file mode 100644 index 000000000000..658888896afe --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/PrivateLinkResource.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.PrivateLinkResourceInner; + +/** + * An immutable client-side representation of PrivateLinkResource. + */ +public interface PrivateLinkResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: Resource properties. + * + * @return the properties value. + */ + PrivateLinkResourceProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.PrivateLinkResourceInner object. + * + * @return the inner object. + */ + PrivateLinkResourceInner innerModel(); +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/PrivateLinkResourceListResult.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/PrivateLinkResourceListResult.java new file mode 100644 index 000000000000..22d79cffe15b --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/PrivateLinkResourceListResult.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.PrivateLinkResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of private link resources. + */ +@Fluent +public final class PrivateLinkResourceListResult implements JsonSerializable { + /* + * Array of private link resources + */ + private List value; + + /* + * URL to get the next set of operation list results (if there are any). + */ + private String nextLink; + + /** + * Creates an instance of PrivateLinkResourceListResult class. + */ + public PrivateLinkResourceListResult() { + } + + /** + * Get the value property: Array of private link resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of private link resources. + * + * @param value the value value to set. + * @return the PrivateLinkResourceListResult object itself. + */ + public PrivateLinkResourceListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results (if there are any). + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateLinkResourceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateLinkResourceListResult if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PrivateLinkResourceListResult. + */ + public static PrivateLinkResourceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateLinkResourceListResult deserializedPrivateLinkResourceListResult + = new PrivateLinkResourceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> PrivateLinkResourceInner.fromJson(reader1)); + deserializedPrivateLinkResourceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedPrivateLinkResourceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateLinkResourceListResult; + }); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/PrivateLinkResourceProperties.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/PrivateLinkResourceProperties.java new file mode 100644 index 000000000000..4fb2061e8cee --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/PrivateLinkResourceProperties.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Properties of a private link resource. + */ +@Fluent +public final class PrivateLinkResourceProperties implements JsonSerializable { + /* + * The private link resource group id. + */ + private String groupId; + + /* + * The private link resource required member names. + */ + private List requiredMembers; + + /* + * The private link resource private link DNS zone name. + */ + private List requiredZoneNames; + + /** + * Creates an instance of PrivateLinkResourceProperties class. + */ + public PrivateLinkResourceProperties() { + } + + /** + * Get the groupId property: The private link resource group id. + * + * @return the groupId value. + */ + public String groupId() { + return this.groupId; + } + + /** + * Get the requiredMembers property: The private link resource required member names. + * + * @return the requiredMembers value. + */ + public List requiredMembers() { + return this.requiredMembers; + } + + /** + * Get the requiredZoneNames property: The private link resource private link DNS zone name. + * + * @return the requiredZoneNames value. + */ + public List requiredZoneNames() { + return this.requiredZoneNames; + } + + /** + * Set the requiredZoneNames property: The private link resource private link DNS zone name. + * + * @param requiredZoneNames the requiredZoneNames value to set. + * @return the PrivateLinkResourceProperties object itself. + */ + public PrivateLinkResourceProperties withRequiredZoneNames(List requiredZoneNames) { + this.requiredZoneNames = requiredZoneNames; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("requiredZoneNames", this.requiredZoneNames, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateLinkResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateLinkResourceProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PrivateLinkResourceProperties. + */ + public static PrivateLinkResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateLinkResourceProperties deserializedPrivateLinkResourceProperties + = new PrivateLinkResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("groupId".equals(fieldName)) { + deserializedPrivateLinkResourceProperties.groupId = reader.getString(); + } else if ("requiredMembers".equals(fieldName)) { + List requiredMembers = reader.readArray(reader1 -> reader1.getString()); + deserializedPrivateLinkResourceProperties.requiredMembers = requiredMembers; + } else if ("requiredZoneNames".equals(fieldName)) { + List requiredZoneNames = reader.readArray(reader1 -> reader1.getString()); + deserializedPrivateLinkResourceProperties.requiredZoneNames = requiredZoneNames; + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateLinkResourceProperties; + }); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/PrivateLinkServiceConnectionState.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/PrivateLinkServiceConnectionState.java new file mode 100644 index 000000000000..45df2aee158d --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/PrivateLinkServiceConnectionState.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A collection of information about the state of the connection between service consumer and provider. + */ +@Fluent +public final class PrivateLinkServiceConnectionState implements JsonSerializable { + /* + * Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. + */ + private PrivateEndpointServiceConnectionStatus status; + + /* + * The reason for approval/rejection of the connection. + */ + private String description; + + /* + * A message indicating if changes on the service provider require any updates on the consumer. + */ + private String actionsRequired; + + /** + * Creates an instance of PrivateLinkServiceConnectionState class. + */ + public PrivateLinkServiceConnectionState() { + } + + /** + * Get the status property: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the + * service. + * + * @return the status value. + */ + public PrivateEndpointServiceConnectionStatus status() { + return this.status; + } + + /** + * Set the status property: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the + * service. + * + * @param status the status value to set. + * @return the PrivateLinkServiceConnectionState object itself. + */ + public PrivateLinkServiceConnectionState withStatus(PrivateEndpointServiceConnectionStatus status) { + this.status = status; + return this; + } + + /** + * Get the description property: The reason for approval/rejection of the connection. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The reason for approval/rejection of the connection. + * + * @param description the description value to set. + * @return the PrivateLinkServiceConnectionState object itself. + */ + public PrivateLinkServiceConnectionState withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the actionsRequired property: A message indicating if changes on the service provider require any updates on + * the consumer. + * + * @return the actionsRequired value. + */ + public String actionsRequired() { + return this.actionsRequired; + } + + /** + * Set the actionsRequired property: A message indicating if changes on the service provider require any updates on + * the consumer. + * + * @param actionsRequired the actionsRequired value to set. + * @return the PrivateLinkServiceConnectionState object itself. + */ + public PrivateLinkServiceConnectionState withActionsRequired(String actionsRequired) { + this.actionsRequired = actionsRequired; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("actionsRequired", this.actionsRequired); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateLinkServiceConnectionState from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateLinkServiceConnectionState if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PrivateLinkServiceConnectionState. + */ + public static PrivateLinkServiceConnectionState fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateLinkServiceConnectionState deserializedPrivateLinkServiceConnectionState + = new PrivateLinkServiceConnectionState(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("status".equals(fieldName)) { + deserializedPrivateLinkServiceConnectionState.status + = PrivateEndpointServiceConnectionStatus.fromString(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedPrivateLinkServiceConnectionState.description = reader.getString(); + } else if ("actionsRequired".equals(fieldName)) { + deserializedPrivateLinkServiceConnectionState.actionsRequired = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateLinkServiceConnectionState; + }); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/ProvisioningState.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/ProvisioningState.java new file mode 100644 index 000000000000..8fb7b02d9672 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/ProvisioningState.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The Cloud HSM Cluster's provisioningState. + */ +public final class ProvisioningState extends ExpandableStringEnum { + /** + * Static value Provisioning for ProvisioningState. + */ + public static final ProvisioningState PROVISIONING = fromString("Provisioning"); + + /** + * Static value Succeeded for ProvisioningState. + */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Static value Failed for ProvisioningState. + */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** + * Static value Deleting for ProvisioningState. + */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** + * Static value Canceled for ProvisioningState. + */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** + * Creates a new instance of ProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProvisioningState() { + } + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * Gets known ProvisioningState values. + * + * @return known ProvisioningState values. + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/PublicNetworkAccess.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/PublicNetworkAccess.java new file mode 100644 index 000000000000..a9b907c8256b --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/PublicNetworkAccess.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The Cloud HSM Cluster public network access. + */ +public final class PublicNetworkAccess extends ExpandableStringEnum { + /** + * Static value Disabled for PublicNetworkAccess. + */ + public static final PublicNetworkAccess DISABLED = fromString("Disabled"); + + /** + * Creates a new instance of PublicNetworkAccess value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PublicNetworkAccess() { + } + + /** + * Creates or finds a PublicNetworkAccess from its string representation. + * + * @param name a name to look for. + * @return the corresponding PublicNetworkAccess. + */ + public static PublicNetworkAccess fromString(String name) { + return fromString(name, PublicNetworkAccess.class); + } + + /** + * Gets known PublicNetworkAccess values. + * + * @return known PublicNetworkAccess values. + */ + public static Collection values() { + return values(PublicNetworkAccess.class); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/RestoreRequestProperties.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/RestoreRequestProperties.java new file mode 100644 index 000000000000..5e823578bd92 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/RestoreRequestProperties.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Cloud Hsm Cluster restore information. + */ +@Fluent +public final class RestoreRequestProperties extends BackupRestoreRequestBaseProperties { + /* + * An autogenerated unique string ID for labeling the backup. It contains both a UUID and a date timestamp. + */ + private String backupId; + + /** + * Creates an instance of RestoreRequestProperties class. + */ + public RestoreRequestProperties() { + } + + /** + * Get the backupId property: An autogenerated unique string ID for labeling the backup. It contains both a UUID and + * a date timestamp. + * + * @return the backupId value. + */ + public String backupId() { + return this.backupId; + } + + /** + * Set the backupId property: An autogenerated unique string ID for labeling the backup. It contains both a UUID and + * a date timestamp. + * + * @param backupId the backupId value to set. + * @return the RestoreRequestProperties object itself. + */ + public RestoreRequestProperties withBackupId(String backupId) { + this.backupId = backupId; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public RestoreRequestProperties withAzureStorageBlobContainerUri(String azureStorageBlobContainerUri) { + super.withAzureStorageBlobContainerUri(azureStorageBlobContainerUri); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public RestoreRequestProperties withToken(String token) { + super.withToken(token); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (backupId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property backupId in model RestoreRequestProperties")); + } + if (azureStorageBlobContainerUri() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property azureStorageBlobContainerUri in model RestoreRequestProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RestoreRequestProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("azureStorageBlobContainerUri", azureStorageBlobContainerUri()); + jsonWriter.writeStringField("token", token()); + jsonWriter.writeStringField("backupId", this.backupId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RestoreRequestProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RestoreRequestProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RestoreRequestProperties. + */ + public static RestoreRequestProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RestoreRequestProperties deserializedRestoreRequestProperties = new RestoreRequestProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("azureStorageBlobContainerUri".equals(fieldName)) { + deserializedRestoreRequestProperties.withAzureStorageBlobContainerUri(reader.getString()); + } else if ("token".equals(fieldName)) { + deserializedRestoreRequestProperties.withToken(reader.getString()); + } else if ("backupId".equals(fieldName)) { + deserializedRestoreRequestProperties.backupId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRestoreRequestProperties; + }); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/RestoreResult.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/RestoreResult.java new file mode 100644 index 000000000000..09a47ed58cfc --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/RestoreResult.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.RestoreResultInner; + +/** + * An immutable client-side representation of RestoreResult. + */ +public interface RestoreResult { + /** + * Gets the properties property: Backup and Restore operation common properties. + * + * @return the properties value. + */ + BackupRestoreBaseResultProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.RestoreResultInner object. + * + * @return the inner object. + */ + RestoreResultInner innerModel(); +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/UserAssignedIdentity.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/UserAssignedIdentity.java new file mode 100644 index 000000000000..9dd8f8b5edf2 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/java/com/azure/resourcemanager/hardwaresecuritymodules/models/UserAssignedIdentity.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.UUID; + +/** + * User assigned identity properties. + */ +@Immutable +public final class UserAssignedIdentity implements JsonSerializable { + /* + * The principal ID of the assigned identity. + */ + private UUID principalId; + + /* + * The client ID of the assigned identity. + */ + private UUID clientId; + + /** + * Creates an instance of UserAssignedIdentity class. + */ + public UserAssignedIdentity() { + } + + /** + * Get the principalId property: The principal ID of the assigned identity. + * + * @return the principalId value. + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The client ID of the assigned identity. + * + * @return the clientId value. + */ + public UUID clientId() { + return this.clientId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UserAssignedIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UserAssignedIdentity if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the UserAssignedIdentity. + */ + public static UserAssignedIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UserAssignedIdentity deserializedUserAssignedIdentity = new UserAssignedIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("principalId".equals(fieldName)) { + deserializedUserAssignedIdentity.principalId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("clientId".equals(fieldName)) { + deserializedUserAssignedIdentity.clientId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedUserAssignedIdentity; + }); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-hardwaresecuritymodules/proxy-config.json b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-hardwaresecuritymodules/proxy-config.json index a8f46d291c61..5a52365e3afd 100644 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-hardwaresecuritymodules/proxy-config.json +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-hardwaresecuritymodules/proxy-config.json @@ -1 +1 @@ -[["com.azure.resourcemanager.hardwaresecuritymodules.implementation.DedicatedHsmsClientImpl$DedicatedHsmsService"],["com.azure.resourcemanager.hardwaresecuritymodules.implementation.OperationsClientImpl$OperationsService"]] \ No newline at end of file +[["com.azure.resourcemanager.hardwaresecuritymodules.implementation.CloudHsmClusterBackupStatusClientImpl$CloudHsmClusterBackupStatusService"],["com.azure.resourcemanager.hardwaresecuritymodules.implementation.CloudHsmClusterPrivateEndpointConnectionsClientImpl$CloudHsmClusterPrivateEndpointConnectionsService"],["com.azure.resourcemanager.hardwaresecuritymodules.implementation.CloudHsmClusterPrivateLinkResourcesClientImpl$CloudHsmClusterPrivateLinkResourcesService"],["com.azure.resourcemanager.hardwaresecuritymodules.implementation.CloudHsmClusterRestoreStatusClientImpl$CloudHsmClusterRestoreStatusService"],["com.azure.resourcemanager.hardwaresecuritymodules.implementation.CloudHsmClustersClientImpl$CloudHsmClustersService"],["com.azure.resourcemanager.hardwaresecuritymodules.implementation.DedicatedHsmsClientImpl$DedicatedHsmsService"],["com.azure.resourcemanager.hardwaresecuritymodules.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.hardwaresecuritymodules.implementation.PrivateEndpointConnectionsClientImpl$PrivateEndpointConnectionsService"]] \ No newline at end of file diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/resources/azure-resourcemanager-hardwaresecuritymodules.properties b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/resources/azure-resourcemanager-hardwaresecuritymodules.properties new file mode 100644 index 000000000000..defbd48204e4 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/main/resources/azure-resourcemanager-hardwaresecuritymodules.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClusterBackupStatusGetSamples.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClusterBackupStatusGetSamples.java new file mode 100644 index 000000000000..5c24f8f2424f --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClusterBackupStatusGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.generated; + +/** + * Samples for CloudHsmClusterBackupStatus Get. + */ +public final class CloudHsmClusterBackupStatusGetSamples { + /* + * x-ms-original-file: + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/CloudHsmCluster_Backup_Pending_MaximumSet_Gen.json + */ + /** + * Sample code: CloudHsmCluster_Get_Backup_Status_MaximumSet_Gen. + * + * @param manager Entry point to HardwareSecurityModulesManager. + */ + public static void cloudHsmClusterGetBackupStatusMaximumSetGen( + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { + manager.cloudHsmClusterBackupStatus() + .getWithResponse("rgcloudhsm", "chsm1", "572a45927fc240e1ac075de27371680b", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClusterPrivateEndpointConnectionsCreateSamples.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClusterPrivateEndpointConnectionsCreateSamples.java new file mode 100644 index 000000000000..7c8bac1fcd53 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClusterPrivateEndpointConnectionsCreateSamples.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.generated; + +import com.azure.resourcemanager.hardwaresecuritymodules.models.PrivateEndpointConnectionProperties; +import com.azure.resourcemanager.hardwaresecuritymodules.models.PrivateEndpointServiceConnectionStatus; +import com.azure.resourcemanager.hardwaresecuritymodules.models.PrivateLinkServiceConnectionState; + +/** + * Samples for CloudHsmClusterPrivateEndpointConnections Create. + */ +public final class CloudHsmClusterPrivateEndpointConnectionsCreateSamples { + /* + * x-ms-original-file: + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/CloudHsmClusterPrivateEndpointConnection_Create_MaximumSet_Gen.json + */ + /** + * Sample code: CloudHsmClusterPrivateEndpointConnection_Create_MaximumSet_Gen. + * + * @param manager Entry point to HardwareSecurityModulesManager. + */ + public static void cloudHsmClusterPrivateEndpointConnectionCreateMaximumSetGen( + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { + manager.cloudHsmClusterPrivateEndpointConnections() + .define("sample-pec") + .withExistingCloudHsmCluster("rgcloudhsm", "chsm1") + .withProperties(new PrivateEndpointConnectionProperties().withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionState().withStatus(PrivateEndpointServiceConnectionStatus.APPROVED) + .withDescription("My name is Joe and I'm approving this."))) + .create(); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClusterPrivateEndpointConnectionsDeleteSamples.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClusterPrivateEndpointConnectionsDeleteSamples.java new file mode 100644 index 000000000000..8289b37c7df0 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClusterPrivateEndpointConnectionsDeleteSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.generated; + +/** + * Samples for CloudHsmClusterPrivateEndpointConnections Delete. + */ +public final class CloudHsmClusterPrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/CloudHsmClusterPrivateEndpointConnection_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: CloudHsmClusterPrivateEndpointConnection_Delete_MaximumSet_Gen. + * + * @param manager Entry point to HardwareSecurityModulesManager. + */ + public static void cloudHsmClusterPrivateEndpointConnectionDeleteMaximumSetGen( + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { + manager.cloudHsmClusterPrivateEndpointConnections() + .delete("rgcloudhsm", "chsm1", "sample-pec", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClusterPrivateEndpointConnectionsGetSamples.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClusterPrivateEndpointConnectionsGetSamples.java new file mode 100644 index 000000000000..9bd5aaa276e8 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClusterPrivateEndpointConnectionsGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.generated; + +/** + * Samples for CloudHsmClusterPrivateEndpointConnections Get. + */ +public final class CloudHsmClusterPrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/CloudHsmClusterPrivateEndpointConnection_Get_MaximumSet_Gen.json + */ + /** + * Sample code: CloudHsmClusterPrivateEndpointConnection_Get_MaximumSet_Gen. + * + * @param manager Entry point to HardwareSecurityModulesManager. + */ + public static void cloudHsmClusterPrivateEndpointConnectionGetMaximumSetGen( + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { + manager.cloudHsmClusterPrivateEndpointConnections() + .getWithResponse("rgcloudhsm", "chsm1", "sample-pec", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClusterPrivateLinkResourcesListByCloudHsmClusterSamples.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClusterPrivateLinkResourcesListByCloudHsmClusterSamples.java new file mode 100644 index 000000000000..8794915d8414 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClusterPrivateLinkResourcesListByCloudHsmClusterSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.generated; + +/** + * Samples for CloudHsmClusterPrivateLinkResources ListByCloudHsmCluster. + */ +public final class CloudHsmClusterPrivateLinkResourcesListByCloudHsmClusterSamples { + /* + * x-ms-original-file: + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/CloudHsmClusterPrivateLinkResource_ListByCloudHsmCluster_MaximumSet_Gen.json + */ + /** + * Sample code: CloudHsmClusterPrivateLinkResources_ListByResource_MaximumSet_Gen. + * + * @param manager Entry point to HardwareSecurityModulesManager. + */ + public static void cloudHsmClusterPrivateLinkResourcesListByResourceMaximumSetGen( + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { + manager.cloudHsmClusterPrivateLinkResources() + .listByCloudHsmCluster("rgcloudhsm", "chsm1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClusterRestoreStatusGetSamples.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClusterRestoreStatusGetSamples.java new file mode 100644 index 000000000000..50c3e33af192 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClusterRestoreStatusGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.generated; + +/** + * Samples for CloudHsmClusterRestoreStatus Get. + */ +public final class CloudHsmClusterRestoreStatusGetSamples { + /* + * x-ms-original-file: + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/CloudHsmCluster_Restore_Pending_MaximumSet_Gen.json + */ + /** + * Sample code: CloudHsmCluster_Get_Restore_Status_MaximumSet_Gen. + * + * @param manager Entry point to HardwareSecurityModulesManager. + */ + public static void cloudHsmClusterGetRestoreStatusMaximumSetGen( + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { + manager.cloudHsmClusterRestoreStatus() + .getWithResponse("rgcloudhsm", "chsm1", "572a45927fc240e1ac075de27371680b", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClustersBackupSamples.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClustersBackupSamples.java new file mode 100644 index 000000000000..640d948f7d93 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClustersBackupSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.generated; + +import com.azure.resourcemanager.hardwaresecuritymodules.models.BackupRequestProperties; + +/** + * Samples for CloudHsmClusters Backup. + */ +public final class CloudHsmClustersBackupSamples { + /* + * x-ms-original-file: + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/CloudHsmCluster_CreateOrValidate_Backup_MaximumSet_Gen.json + */ + /** + * Sample code: CloudHsmCluster_Create_Backup_MaximumSet_Gen. + * + * @param manager Entry point to HardwareSecurityModulesManager. + */ + public static void cloudHsmClusterCreateBackupMaximumSetGen( + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { + manager.cloudHsmClusters() + .backup("rgcloudhsm", "chsm1", + new BackupRequestProperties() + .withAzureStorageBlobContainerUri( + "https://myaccount.blob.core.windows.net/sascontainer/sasContainer") + .withToken("fakeTokenPlaceholder"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClustersCreateOrUpdateSamples.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClustersCreateOrUpdateSamples.java new file mode 100644 index 000000000000..c624bf724d84 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClustersCreateOrUpdateSamples.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.generated; + +import com.azure.resourcemanager.hardwaresecuritymodules.models.CloudHsmClusterProperties; +import com.azure.resourcemanager.hardwaresecuritymodules.models.CloudHsmClusterSku; +import com.azure.resourcemanager.hardwaresecuritymodules.models.CloudHsmClusterSkuFamily; +import com.azure.resourcemanager.hardwaresecuritymodules.models.CloudHsmClusterSkuName; +import com.azure.resourcemanager.hardwaresecuritymodules.models.ManagedServiceIdentity; +import com.azure.resourcemanager.hardwaresecuritymodules.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.hardwaresecuritymodules.models.PublicNetworkAccess; +import com.azure.resourcemanager.hardwaresecuritymodules.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for CloudHsmClusters CreateOrUpdate. + */ +public final class CloudHsmClustersCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/CloudHsmCluster_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: CloudHsmCluster_CreateOrUpdate_MaximumSet_Gen. + * + * @param manager Entry point to HardwareSecurityModulesManager. + */ + public static void cloudHsmClusterCreateOrUpdateMaximumSetGen( + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { + manager.cloudHsmClusters() + .define("chsm1") + .withRegion("eastus2") + .withExistingResourceGroup("rgcloudhsm") + .withTags(mapOf("Dept", "hsm", "Environment", "dogfood")) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-1", + new UserAssignedIdentity()))) + .withSku(new CloudHsmClusterSku().withFamily(CloudHsmClusterSkuFamily.B) + .withName(CloudHsmClusterSkuName.STANDARD_B1)) + .withProperties(new CloudHsmClusterProperties().withPublicNetworkAccess(PublicNetworkAccess.DISABLED)) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClustersDeleteSamples.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClustersDeleteSamples.java new file mode 100644 index 000000000000..d38b150ab02b --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClustersDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.generated; + +/** + * Samples for CloudHsmClusters Delete. + */ +public final class CloudHsmClustersDeleteSamples { + /* + * x-ms-original-file: + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/CloudHsmCluster_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: CloudHsmCluster_Delete_MaximumSet_Gen. + * + * @param manager Entry point to HardwareSecurityModulesManager. + */ + public static void cloudHsmClusterDeleteMaximumSetGen( + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { + manager.cloudHsmClusters().delete("rgcloudhsm", "chsm1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClustersGetByResourceGroupSamples.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClustersGetByResourceGroupSamples.java new file mode 100644 index 000000000000..7572dc18392c --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClustersGetByResourceGroupSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.generated; + +/** + * Samples for CloudHsmClusters GetByResourceGroup. + */ +public final class CloudHsmClustersGetByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/CloudHsmCluster_Get_MaximumSet_Gen.json + */ + /** + * Sample code: CloudHsmCluster_Get_MaximumSet_Gen. + * + * @param manager Entry point to HardwareSecurityModulesManager. + */ + public static void cloudHsmClusterGetMaximumSetGen( + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { + manager.cloudHsmClusters() + .getByResourceGroupWithResponse("rgcloudhsm", "chsm1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClustersListByResourceGroupSamples.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClustersListByResourceGroupSamples.java new file mode 100644 index 000000000000..37bfa5fb9312 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClustersListByResourceGroupSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.generated; + +/** + * Samples for CloudHsmClusters ListByResourceGroup. + */ +public final class CloudHsmClustersListByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/CloudHsmCluster_ListByResourceGroup_MaximumSet_Gen.json + */ + /** + * Sample code: CloudHsmCluster_ListByResourceGroup_MaximumSet_Gen. + * + * @param manager Entry point to HardwareSecurityModulesManager. + */ + public static void cloudHsmClusterListByResourceGroupMaximumSetGen( + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { + manager.cloudHsmClusters().listByResourceGroup("rgcloudhsm", null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClustersListSamples.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClustersListSamples.java new file mode 100644 index 000000000000..42fe53507e17 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClustersListSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.generated; + +/** + * Samples for CloudHsmClusters List. + */ +public final class CloudHsmClustersListSamples { + /* + * x-ms-original-file: + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/CloudHsmCluster_ListBySubscription_MaximumSet_Gen.json + */ + /** + * Sample code: CloudHsmCluster_ListBySubscription_MaximumSet_Gen. + * + * @param manager Entry point to HardwareSecurityModulesManager. + */ + public static void cloudHsmClusterListBySubscriptionMaximumSetGen( + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { + manager.cloudHsmClusters().list(null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClustersRestoreSamples.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClustersRestoreSamples.java new file mode 100644 index 000000000000..21a2eaa578ff --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClustersRestoreSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.generated; + +import com.azure.resourcemanager.hardwaresecuritymodules.models.RestoreRequestProperties; + +/** + * Samples for CloudHsmClusters Restore. + */ +public final class CloudHsmClustersRestoreSamples { + /* + * x-ms-original-file: + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/CloudHsmCluster_RequestOrValidate_Restore_MaximumSet_Gen.json + */ + /** + * Sample code: CloudHsmCluster_Restore_MaximumSet_Gen. + * + * @param manager Entry point to HardwareSecurityModulesManager. + */ + public static void cloudHsmClusterRestoreMaximumSetGen( + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { + manager.cloudHsmClusters() + .restore("rgcloudhsm", "chsm1", + new RestoreRequestProperties() + .withAzureStorageBlobContainerUri( + "https://myaccount.blob.core.windows.net/sascontainer/sasContainer") + .withBackupId("backupId"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClustersUpdateSamples.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClustersUpdateSamples.java new file mode 100644 index 000000000000..1e6c569a72db --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClustersUpdateSamples.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.generated; + +import com.azure.resourcemanager.hardwaresecuritymodules.models.CloudHsmCluster; +import com.azure.resourcemanager.hardwaresecuritymodules.models.ManagedServiceIdentity; +import com.azure.resourcemanager.hardwaresecuritymodules.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.hardwaresecuritymodules.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for CloudHsmClusters Update. + */ +public final class CloudHsmClustersUpdateSamples { + /* + * x-ms-original-file: + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/CloudHsmCluster_Update_MaximumSet_Gen.json + */ + /** + * Sample code: CloudHsmCluster_Update_MaximumSet_Gen. + * + * @param manager Entry point to HardwareSecurityModulesManager. + */ + public static void cloudHsmClusterUpdateMaximumSetGen( + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { + CloudHsmCluster resource = manager.cloudHsmClusters() + .getByResourceGroupWithResponse("rgcloudhsm", "chsm1", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("Dept", "hsm", "Environment", "dogfood", "Slice", "A")) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-1", + new UserAssignedIdentity()))) + .apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClustersValidateBackupPropertiesSamples.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClustersValidateBackupPropertiesSamples.java new file mode 100644 index 000000000000..a51c70ddf326 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClustersValidateBackupPropertiesSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.generated; + +import com.azure.resourcemanager.hardwaresecuritymodules.models.BackupRequestProperties; + +/** + * Samples for CloudHsmClusters ValidateBackupProperties. + */ +public final class CloudHsmClustersValidateBackupPropertiesSamples { + /* + * x-ms-original-file: + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/CloudHsmCluster_CreateOrValidate_Backup_MaximumSet_Gen.json + */ + /** + * Sample code: CloudHsmCluster_ValidateBackup_Validation_MaximumSet_Gen. + * + * @param manager Entry point to HardwareSecurityModulesManager. + */ + public static void cloudHsmClusterValidateBackupValidationMaximumSetGen( + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { + manager.cloudHsmClusters() + .validateBackupProperties("rgcloudhsm", "chsm1", + new BackupRequestProperties() + .withAzureStorageBlobContainerUri( + "https://myaccount.blob.core.windows.net/sascontainer/sasContainer") + .withToken("fakeTokenPlaceholder"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClustersValidateRestorePropertiesSamples.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClustersValidateRestorePropertiesSamples.java new file mode 100644 index 000000000000..3eb73306b71d --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/CloudHsmClustersValidateRestorePropertiesSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.generated; + +import com.azure.resourcemanager.hardwaresecuritymodules.models.RestoreRequestProperties; + +/** + * Samples for CloudHsmClusters ValidateRestoreProperties. + */ +public final class CloudHsmClustersValidateRestorePropertiesSamples { + /* + * x-ms-original-file: + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/CloudHsmCluster_RequestOrValidate_Restore_MaximumSet_Gen.json + */ + /** + * Sample code: CloudHsmCluster_ValidateRestore_MaximumSet_Gen. + * + * @param manager Entry point to HardwareSecurityModulesManager. + */ + public static void cloudHsmClusterValidateRestoreMaximumSetGen( + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { + manager.cloudHsmClusters() + .validateRestoreProperties("rgcloudhsm", "chsm1", + new RestoreRequestProperties() + .withAzureStorageBlobContainerUri( + "https://myaccount.blob.core.windows.net/sascontainer/sasContainer") + .withBackupId("backupId"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmCreateOrUpdateSamples.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmCreateOrUpdateSamples.java index 66e00f592f43..71ca47fa8f4a 100644 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmCreateOrUpdateSamples.java +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmCreateOrUpdateSamples.java @@ -20,8 +20,8 @@ public final class DedicatedHsmCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/ - * examples/PaymentHsm_CreateOrUpdate_WithManagementProfile.json + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/PaymentHsm_CreateOrUpdate_WithManagementProfile.json */ /** * Sample code: Create a new or update an existing payment HSM with management profile. @@ -34,23 +34,23 @@ public static void createANewOrUpdateAnExistingPaymentHSMWithManagementProfile( .define("hsm1") .withRegion("westus") .withExistingResourceGroup("hsm-group") + .withSku(new Sku().withName(SkuName.PAY_SHIELD10K_LMK1_CPS60)) .withProperties(new DedicatedHsmProperties() - .withNetworkProfile(new NetworkProfile().withSubnet(new ApiEntityReference().withId( + .withNetworkProfile(new NetworkProfile().withSubnet(new ApiEntityReference().withResourceId( "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01")) .withNetworkInterfaces(Arrays.asList(new NetworkInterface().withPrivateIpAddress("1.0.0.1")))) - .withManagementNetworkProfile(new NetworkProfile().withSubnet(new ApiEntityReference().withId( + .withManagementNetworkProfile(new NetworkProfile().withSubnet(new ApiEntityReference().withResourceId( "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01")) .withNetworkInterfaces(Arrays.asList(new NetworkInterface().withPrivateIpAddress("1.0.0.2")))) .withStampId("stamp01")) .withTags(mapOf("Dept", "hsm", "Environment", "dogfood")) - .withSku(new Sku().withName(SkuName.PAY_SHIELD10K_LMK1_CPS60)) .create(); } /* * x-ms-original-file: - * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/ - * examples/DedicatedHsm_CreateOrUpdate.json + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/DedicatedHsm_CreateOrUpdate.json */ /** * Sample code: Create a new or update an existing dedicated HSM. @@ -63,20 +63,20 @@ public static void createANewOrUpdateAnExistingDedicatedHSM( .define("hsm1") .withRegion("westus") .withExistingResourceGroup("hsm-group") + .withSku(new Sku().withName(SkuName.SAFE_NET_LUNA_NETWORK_HSM_A790)) .withProperties(new DedicatedHsmProperties() - .withNetworkProfile(new NetworkProfile().withSubnet(new ApiEntityReference().withId( + .withNetworkProfile(new NetworkProfile().withSubnet(new ApiEntityReference().withResourceId( "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01")) .withNetworkInterfaces(Arrays.asList(new NetworkInterface().withPrivateIpAddress("1.0.0.1")))) .withStampId("stamp01")) .withTags(mapOf("Dept", "hsm", "Environment", "dogfood")) - .withSku(new Sku().withName(SkuName.SAFE_NET_LUNA_NETWORK_HSM_A790)) .create(); } /* * x-ms-original-file: - * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/ - * examples/PaymentHsm_CreateOrUpdate.json + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/PaymentHsm_CreateOrUpdate.json */ /** * Sample code: Create a new or update an existing payment HSM. @@ -89,13 +89,13 @@ public static void createANewOrUpdateAnExistingPaymentHSM( .define("hsm1") .withRegion("westus") .withExistingResourceGroup("hsm-group") + .withSku(new Sku().withName(SkuName.PAY_SHIELD10K_LMK1_CPS60)) .withProperties(new DedicatedHsmProperties() - .withNetworkProfile(new NetworkProfile().withSubnet(new ApiEntityReference().withId( + .withNetworkProfile(new NetworkProfile().withSubnet(new ApiEntityReference().withResourceId( "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/hsm-group/providers/Microsoft.Network/virtualNetworks/stamp01/subnets/stamp01")) .withNetworkInterfaces(Arrays.asList(new NetworkInterface().withPrivateIpAddress("1.0.0.1")))) .withStampId("stamp01")) .withTags(mapOf("Dept", "hsm", "Environment", "dogfood")) - .withSku(new Sku().withName(SkuName.PAY_SHIELD10K_LMK1_CPS60)) .create(); } diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmDeleteSamples.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmDeleteSamples.java index 5f4823f60121..d23c3e085bcc 100644 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmDeleteSamples.java +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmDeleteSamples.java @@ -10,8 +10,8 @@ public final class DedicatedHsmDeleteSamples { /* * x-ms-original-file: - * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/ - * examples/DedicatedHsm_Delete.json + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/DedicatedHsm_Delete.json */ /** * Sample code: Delete a dedicated HSM. diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmGetByResourceGroupSamples.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmGetByResourceGroupSamples.java index df9a38ce96ca..f9a3c3f2f171 100644 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmGetByResourceGroupSamples.java +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmGetByResourceGroupSamples.java @@ -10,8 +10,8 @@ public final class DedicatedHsmGetByResourceGroupSamples { /* * x-ms-original-file: - * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/ - * examples/PaymentHsm_Get.json + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/PaymentHsm_Get.json */ /** * Sample code: Get a payment HSM. @@ -25,8 +25,8 @@ public final class DedicatedHsmGetByResourceGroupSamples { /* * x-ms-original-file: - * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/ - * examples/PaymentHsm_Get_With_2018-10-31Preview_Version.json + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/PaymentHsm_Get_With_2018-10-31Preview_Version.json */ /** * Sample code: Get a payment HSM with 2018-10-31Preview api version. @@ -40,8 +40,8 @@ public static void getAPaymentHSMWith20181031PreviewApiVersion( /* * x-ms-original-file: - * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/ - * examples/DedicatedHsm_Get.json + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/DedicatedHsm_Get.json */ /** * Sample code: Get a dedicated HSM. diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmListByResourceGroupSamples.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmListByResourceGroupSamples.java index b399aced202a..add37fadc589 100644 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmListByResourceGroupSamples.java +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmListByResourceGroupSamples.java @@ -10,8 +10,8 @@ public final class DedicatedHsmListByResourceGroupSamples { /* * x-ms-original-file: - * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/ - * examples/DedicatedHsm_ListByResourceGroup.json + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/DedicatedHsm_ListByResourceGroup.json */ /** * Sample code: List dedicated HSM devices in a resource group. @@ -25,8 +25,8 @@ public static void listDedicatedHSMDevicesInAResourceGroup( /* * x-ms-original-file: - * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/ - * examples/PaymentHsm_ListByResourceGroup.json + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/PaymentHsm_ListByResourceGroup.json */ /** * Sample code: List dedicated HSM devices in a resource group including payment HSM. diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmListOutboundNetworkDependenciesEndpointsSamples.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmListOutboundNetworkDependenciesEndpointsSamples.java index 56f53251405e..81fe97183985 100644 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmListOutboundNetworkDependenciesEndpointsSamples.java +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmListOutboundNetworkDependenciesEndpointsSamples.java @@ -10,8 +10,8 @@ public final class DedicatedHsmListOutboundNetworkDependenciesEndpointsSamples { /* * x-ms-original-file: - * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/ - * examples/GetOutboundNetworkDependenciesEndpointsList.json + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/GetOutboundNetworkDependenciesEndpointsList.json */ /** * Sample code: List OutboundNetworkDependenciesEndpoints by Managed Cluster. diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmListSamples.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmListSamples.java index 43db5682a7c4..f7963bb74da6 100644 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmListSamples.java +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmListSamples.java @@ -10,8 +10,8 @@ public final class DedicatedHsmListSamples { /* * x-ms-original-file: - * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/ - * examples/PaymentHsm_ListBySubscription.json + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/PaymentHsm_ListBySubscription.json */ /** * Sample code: List dedicated HSM devices in a subscription including payment HSM. @@ -25,8 +25,8 @@ public static void listDedicatedHSMDevicesInASubscriptionIncludingPaymentHSM( /* * x-ms-original-file: - * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/ - * examples/DedicatedHsm_ListBySubscription.json + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/DedicatedHsm_ListBySubscription.json */ /** * Sample code: List dedicated HSM devices in a subscription. diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmUpdateSamples.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmUpdateSamples.java index 811a7ccbba52..c89fc2b68eb6 100644 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmUpdateSamples.java +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmUpdateSamples.java @@ -14,8 +14,8 @@ public final class DedicatedHsmUpdateSamples { /* * x-ms-original-file: - * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/ - * examples/DedicatedHsm_Update.json + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/DedicatedHsm_Update.json */ /** * Sample code: Update an existing dedicated HSM. @@ -32,8 +32,8 @@ public static void updateAnExistingDedicatedHSM( /* * x-ms-original-file: - * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/ - * examples/PaymentHsm_Update.json + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/PaymentHsm_Update.json */ /** * Sample code: Update an existing payment HSM. diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/OperationsListSamples.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/OperationsListSamples.java index 121b74952e5e..6b24f31f2ff4 100644 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/OperationsListSamples.java +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/OperationsListSamples.java @@ -10,8 +10,8 @@ public final class OperationsListSamples { /* * x-ms-original-file: - * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/ - * examples/PaymentHsm_OperationsList.json + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/OperationsList.json */ /** * Sample code: Get a list of Payment HSM operations. @@ -25,8 +25,8 @@ public static void getAListOfPaymentHSMOperations( /* * x-ms-original-file: - * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2021-11-30/ - * examples/DedicatedHsm_OperationsList.json + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/OperationsList.json */ /** * Sample code: Get a list of Dedicated HSM operations. diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/PrivateEndpointConnectionsListByCloudHsmClusterSamples.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/PrivateEndpointConnectionsListByCloudHsmClusterSamples.java new file mode 100644 index 000000000000..dd1ba00c19f2 --- /dev/null +++ b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/samples/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/PrivateEndpointConnectionsListByCloudHsmClusterSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hardwaresecuritymodules.generated; + +/** + * Samples for PrivateEndpointConnections ListByCloudHsmCluster. + */ +public final class PrivateEndpointConnectionsListByCloudHsmClusterSamples { + /* + * x-ms-original-file: + * specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/preview/2024-06-30- + * preview/examples/CloudHsmClusterPrivateEndpointConnection_ListByCloudHsmCluster_MaximumSet_Gen.json + */ + /** + * Sample code: CloudHsmClusterPrivateEndpointConnection_ListByResource_MaximumSet_Gen. + * + * @param manager Entry point to HardwareSecurityModulesManager. + */ + public static void cloudHsmClusterPrivateEndpointConnectionListByResourceMaximumSetGen( + com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager manager) { + manager.privateEndpointConnections() + .listByCloudHsmCluster("rgcloudhsm", "chsm1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/ApiEntityReferenceTests.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/ApiEntityReferenceTests.java deleted file mode 100644 index 481faab882f4..000000000000 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/ApiEntityReferenceTests.java +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.hardwaresecuritymodules.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.hardwaresecuritymodules.models.ApiEntityReference; -import org.junit.jupiter.api.Assertions; - -public final class ApiEntityReferenceTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ApiEntityReference model = BinaryData.fromString("{\"id\":\"e\"}").toObject(ApiEntityReference.class); - Assertions.assertEquals("e", model.id()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ApiEntityReference model = new ApiEntityReference().withId("e"); - model = BinaryData.fromObject(model).toObject(ApiEntityReference.class); - Assertions.assertEquals("e", model.id()); - } -} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmInnerTests.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmInnerTests.java deleted file mode 100644 index e08bbcb615a9..000000000000 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmInnerTests.java +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.hardwaresecuritymodules.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.DedicatedHsmInner; -import com.azure.resourcemanager.hardwaresecuritymodules.models.ApiEntityReference; -import com.azure.resourcemanager.hardwaresecuritymodules.models.DedicatedHsmProperties; -import com.azure.resourcemanager.hardwaresecuritymodules.models.NetworkInterface; -import com.azure.resourcemanager.hardwaresecuritymodules.models.NetworkProfile; -import com.azure.resourcemanager.hardwaresecuritymodules.models.Sku; -import com.azure.resourcemanager.hardwaresecuritymodules.models.SkuName; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class DedicatedHsmInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DedicatedHsmInner model = BinaryData.fromString( - "{\"properties\":{\"networkProfile\":{\"subnet\":{\"id\":\"dbihanufhfcbj\"},\"networkInterfaces\":[{\"id\":\"ithxqhabifpi\",\"privateIpAddress\":\"wczbys\"}]},\"managementNetworkProfile\":{\"subnet\":{\"id\":\"x\"},\"networkInterfaces\":[{\"id\":\"y\",\"privateIpAddress\":\"iwbybrkxvdumjg\"},{\"id\":\"fwvuk\",\"privateIpAddress\":\"audccsnhs\"},{\"id\":\"nyejhkryhtnap\",\"privateIpAddress\":\"wlokjyem\"},{\"id\":\"vnipjox\",\"privateIpAddress\":\"nchgej\"}]},\"stampId\":\"odmailzyd\",\"statusMessage\":\"o\",\"provisioningState\":\"Succeeded\"},\"sku\":{\"name\":\"payShield10K_LMK2_CPS250\"},\"zones\":[\"npmqnjaqwixjspro\"],\"location\":\"vcputegj\",\"tags\":{\"dvpjhulsuuvmk\":\"fdatsc\",\"jdpvwryo\":\"ozkrwfndiodjpslw\",\"hbcryffdfdosyge\":\"psoacctazakljl\"},\"id\":\"paojakhmsbzjh\",\"name\":\"rzevdphlxaol\",\"type\":\"hqtrgqjbpf\"}") - .toObject(DedicatedHsmInner.class); - Assertions.assertEquals("vcputegj", model.location()); - Assertions.assertEquals("fdatsc", model.tags().get("dvpjhulsuuvmk")); - Assertions.assertEquals(SkuName.PAY_SHIELD10K_LMK2_CPS250, model.sku().name()); - Assertions.assertEquals("npmqnjaqwixjspro", model.zones().get(0)); - Assertions.assertEquals("dbihanufhfcbj", model.properties().networkProfile().subnet().id()); - Assertions.assertEquals("wczbys", - model.properties().networkProfile().networkInterfaces().get(0).privateIpAddress()); - Assertions.assertEquals("x", model.properties().managementNetworkProfile().subnet().id()); - Assertions.assertEquals("iwbybrkxvdumjg", - model.properties().managementNetworkProfile().networkInterfaces().get(0).privateIpAddress()); - Assertions.assertEquals("odmailzyd", model.properties().stampId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DedicatedHsmInner model = new DedicatedHsmInner().withLocation("vcputegj") - .withTags( - mapOf("dvpjhulsuuvmk", "fdatsc", "jdpvwryo", "ozkrwfndiodjpslw", "hbcryffdfdosyge", "psoacctazakljl")) - .withSku(new Sku().withName(SkuName.PAY_SHIELD10K_LMK2_CPS250)) - .withZones(Arrays.asList("npmqnjaqwixjspro")) - .withProperties(new DedicatedHsmProperties() - .withNetworkProfile(new NetworkProfile().withSubnet(new ApiEntityReference().withId("dbihanufhfcbj")) - .withNetworkInterfaces(Arrays.asList(new NetworkInterface().withPrivateIpAddress("wczbys")))) - .withManagementNetworkProfile(new NetworkProfile().withSubnet(new ApiEntityReference().withId("x")) - .withNetworkInterfaces(Arrays.asList(new NetworkInterface().withPrivateIpAddress("iwbybrkxvdumjg"), - new NetworkInterface().withPrivateIpAddress("audccsnhs"), - new NetworkInterface().withPrivateIpAddress("wlokjyem"), - new NetworkInterface().withPrivateIpAddress("nchgej")))) - .withStampId("odmailzyd")); - model = BinaryData.fromObject(model).toObject(DedicatedHsmInner.class); - Assertions.assertEquals("vcputegj", model.location()); - Assertions.assertEquals("fdatsc", model.tags().get("dvpjhulsuuvmk")); - Assertions.assertEquals(SkuName.PAY_SHIELD10K_LMK2_CPS250, model.sku().name()); - Assertions.assertEquals("npmqnjaqwixjspro", model.zones().get(0)); - Assertions.assertEquals("dbihanufhfcbj", model.properties().networkProfile().subnet().id()); - Assertions.assertEquals("wczbys", - model.properties().networkProfile().networkInterfaces().get(0).privateIpAddress()); - Assertions.assertEquals("x", model.properties().managementNetworkProfile().subnet().id()); - Assertions.assertEquals("iwbybrkxvdumjg", - model.properties().managementNetworkProfile().networkInterfaces().get(0).privateIpAddress()); - Assertions.assertEquals("odmailzyd", model.properties().stampId()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmListResultTests.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmListResultTests.java deleted file mode 100644 index 64297ce46f43..000000000000 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmListResultTests.java +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.hardwaresecuritymodules.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.DedicatedHsmInner; -import com.azure.resourcemanager.hardwaresecuritymodules.models.ApiEntityReference; -import com.azure.resourcemanager.hardwaresecuritymodules.models.DedicatedHsmListResult; -import com.azure.resourcemanager.hardwaresecuritymodules.models.DedicatedHsmProperties; -import com.azure.resourcemanager.hardwaresecuritymodules.models.NetworkInterface; -import com.azure.resourcemanager.hardwaresecuritymodules.models.NetworkProfile; -import com.azure.resourcemanager.hardwaresecuritymodules.models.Sku; -import com.azure.resourcemanager.hardwaresecuritymodules.models.SkuName; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class DedicatedHsmListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DedicatedHsmListResult model = BinaryData.fromString( - "{\"value\":[{\"properties\":{\"networkProfile\":{\"subnet\":{\"id\":\"yhxhu\"},\"networkInterfaces\":[{}]},\"managementNetworkProfile\":{\"subnet\":{\"id\":\"xolniwpwcukjfk\"},\"networkInterfaces\":[{},{}]},\"stampId\":\"xklrypl\",\"statusMessage\":\"kbasyypn\",\"provisioningState\":\"Deleting\"},\"sku\":{\"name\":\"payShield10K_LMK2_CPS2500\"},\"zones\":[\"cph\",\"jkot\",\"nqgoulzndli\"],\"location\":\"wyqkgfgibm\",\"tags\":{\"xybz\":\"akeqs\",\"mnkzsmod\":\"qedqytbciqfoufl\"},\"id\":\"glougpbk\",\"name\":\"tmut\",\"type\":\"uqktap\"},{\"properties\":{\"networkProfile\":{\"subnet\":{\"id\":\"uertumk\"},\"networkInterfaces\":[{},{},{},{}]},\"managementNetworkProfile\":{\"subnet\":{\"id\":\"hbmdgbbjfdd\"},\"networkInterfaces\":[{},{},{},{}]},\"stampId\":\"bexppb\",\"statusMessage\":\"q\",\"provisioningState\":\"Deleting\"},\"sku\":{\"name\":\"SafeNet Luna Network HSM A790\"},\"zones\":[\"s\",\"lgbquxig\",\"yjgzjaoyfhrtxiln\"],\"location\":\"rkujy\",\"tags\":{\"fqawrlyxw\":\"eju\"},\"id\":\"kcprbnw\",\"name\":\"xgjvtbv\",\"type\":\"ysszdnrujqguh\"},{\"properties\":{\"networkProfile\":{\"subnet\":{\"id\":\"f\"},\"networkInterfaces\":[{},{},{}]},\"managementNetworkProfile\":{\"subnet\":{\"id\":\"nguitnwuizgazxu\"},\"networkInterfaces\":[{},{}]},\"stampId\":\"ckyfih\",\"statusMessage\":\"idf\",\"provisioningState\":\"Allocating\"},\"sku\":{\"name\":\"SafeNet Luna Network HSM A790\"},\"zones\":[\"ymwisdkft\"],\"location\":\"wxmnteiwao\",\"tags\":{\"pymzidnsezcxtbzs\":\"mijcmmxdcufufs\"},\"id\":\"fycc\",\"name\":\"newmdwzjeiachbo\",\"type\":\"sflnrosfqp\"}],\"nextLink\":\"ehzzvypyqrim\"}") - .toObject(DedicatedHsmListResult.class); - Assertions.assertEquals("wyqkgfgibm", model.value().get(0).location()); - Assertions.assertEquals("akeqs", model.value().get(0).tags().get("xybz")); - Assertions.assertEquals(SkuName.PAY_SHIELD10K_LMK2_CPS2500, model.value().get(0).sku().name()); - Assertions.assertEquals("cph", model.value().get(0).zones().get(0)); - Assertions.assertEquals("yhxhu", model.value().get(0).properties().networkProfile().subnet().id()); - Assertions.assertEquals("xolniwpwcukjfk", - model.value().get(0).properties().managementNetworkProfile().subnet().id()); - Assertions.assertEquals("xklrypl", model.value().get(0).properties().stampId()); - Assertions.assertEquals("ehzzvypyqrim", model.nextLink()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DedicatedHsmListResult model = new DedicatedHsmListResult() - .withValue(Arrays.asList( - new DedicatedHsmInner().withLocation("wyqkgfgibm") - .withTags(mapOf("xybz", "akeqs", "mnkzsmod", "qedqytbciqfoufl")) - .withSku(new Sku().withName(SkuName.PAY_SHIELD10K_LMK2_CPS2500)) - .withZones(Arrays.asList("cph", "jkot", "nqgoulzndli")) - .withProperties(new DedicatedHsmProperties() - .withNetworkProfile(new NetworkProfile().withSubnet(new ApiEntityReference().withId("yhxhu")) - .withNetworkInterfaces(Arrays.asList(new NetworkInterface()))) - .withManagementNetworkProfile(new NetworkProfile() - .withSubnet(new ApiEntityReference().withId("xolniwpwcukjfk")) - .withNetworkInterfaces(Arrays.asList(new NetworkInterface(), new NetworkInterface()))) - .withStampId("xklrypl")), - new DedicatedHsmInner().withLocation("rkujy") - .withTags(mapOf("fqawrlyxw", "eju")) - .withSku(new Sku().withName(SkuName.SAFE_NET_LUNA_NETWORK_HSM_A790)) - .withZones(Arrays.asList("s", "lgbquxig", "yjgzjaoyfhrtxiln")) - .withProperties(new DedicatedHsmProperties() - .withNetworkProfile(new NetworkProfile().withSubnet(new ApiEntityReference().withId("uertumk")) - .withNetworkInterfaces(Arrays.asList(new NetworkInterface(), new NetworkInterface(), - new NetworkInterface(), new NetworkInterface()))) - .withManagementNetworkProfile( - new NetworkProfile().withSubnet(new ApiEntityReference().withId("hbmdgbbjfdd")) - .withNetworkInterfaces(Arrays.asList(new NetworkInterface(), new NetworkInterface(), - new NetworkInterface(), new NetworkInterface()))) - .withStampId("bexppb")), - new DedicatedHsmInner().withLocation("wxmnteiwao") - .withTags(mapOf("pymzidnsezcxtbzs", "mijcmmxdcufufs")) - .withSku(new Sku().withName(SkuName.SAFE_NET_LUNA_NETWORK_HSM_A790)) - .withZones(Arrays.asList("ymwisdkft")) - .withProperties( - new DedicatedHsmProperties() - .withNetworkProfile(new NetworkProfile().withSubnet(new ApiEntityReference().withId("f")) - .withNetworkInterfaces(Arrays.asList(new NetworkInterface(), new NetworkInterface(), - new NetworkInterface()))) - .withManagementNetworkProfile(new NetworkProfile() - .withSubnet(new ApiEntityReference().withId("nguitnwuizgazxu")) - .withNetworkInterfaces(Arrays.asList(new NetworkInterface(), new NetworkInterface()))) - .withStampId("ckyfih")))) - .withNextLink("ehzzvypyqrim"); - model = BinaryData.fromObject(model).toObject(DedicatedHsmListResult.class); - Assertions.assertEquals("wyqkgfgibm", model.value().get(0).location()); - Assertions.assertEquals("akeqs", model.value().get(0).tags().get("xybz")); - Assertions.assertEquals(SkuName.PAY_SHIELD10K_LMK2_CPS2500, model.value().get(0).sku().name()); - Assertions.assertEquals("cph", model.value().get(0).zones().get(0)); - Assertions.assertEquals("yhxhu", model.value().get(0).properties().networkProfile().subnet().id()); - Assertions.assertEquals("xolniwpwcukjfk", - model.value().get(0).properties().managementNetworkProfile().subnet().id()); - Assertions.assertEquals("xklrypl", model.value().get(0).properties().stampId()); - Assertions.assertEquals("ehzzvypyqrim", model.nextLink()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmOperationDisplayTests.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmOperationDisplayTests.java deleted file mode 100644 index d7671c9e89e1..000000000000 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmOperationDisplayTests.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.hardwaresecuritymodules.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.hardwaresecuritymodules.models.DedicatedHsmOperationDisplay; -import org.junit.jupiter.api.Assertions; - -public final class DedicatedHsmOperationDisplayTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DedicatedHsmOperationDisplay model = BinaryData.fromString( - "{\"provider\":\"uxzdxtay\",\"resource\":\"hmwhfpmrqo\",\"operation\":\"tu\",\"description\":\"nryrtihf\"}") - .toObject(DedicatedHsmOperationDisplay.class); - Assertions.assertEquals("uxzdxtay", model.provider()); - Assertions.assertEquals("hmwhfpmrqo", model.resource()); - Assertions.assertEquals("tu", model.operation()); - Assertions.assertEquals("nryrtihf", model.description()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DedicatedHsmOperationDisplay model = new DedicatedHsmOperationDisplay().withProvider("uxzdxtay") - .withResource("hmwhfpmrqo") - .withOperation("tu") - .withDescription("nryrtihf"); - model = BinaryData.fromObject(model).toObject(DedicatedHsmOperationDisplay.class); - Assertions.assertEquals("uxzdxtay", model.provider()); - Assertions.assertEquals("hmwhfpmrqo", model.resource()); - Assertions.assertEquals("tu", model.operation()); - Assertions.assertEquals("nryrtihf", model.description()); - } -} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmOperationInnerTests.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmOperationInnerTests.java deleted file mode 100644 index ef02aa29e3d0..000000000000 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmOperationInnerTests.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.hardwaresecuritymodules.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.DedicatedHsmOperationInner; -import com.azure.resourcemanager.hardwaresecuritymodules.models.DedicatedHsmOperationDisplay; -import org.junit.jupiter.api.Assertions; - -public final class DedicatedHsmOperationInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DedicatedHsmOperationInner model = BinaryData.fromString( - "{\"name\":\"itjz\",\"isDataAction\":false,\"origin\":\"sarhmofc\",\"display\":{\"provider\":\"my\",\"resource\":\"kdtmlxhekuk\",\"operation\":\"txukcdmp\",\"description\":\"cryuan\"}}") - .toObject(DedicatedHsmOperationInner.class); - Assertions.assertEquals("itjz", model.name()); - Assertions.assertEquals("sarhmofc", model.origin()); - Assertions.assertEquals("my", model.display().provider()); - Assertions.assertEquals("kdtmlxhekuk", model.display().resource()); - Assertions.assertEquals("txukcdmp", model.display().operation()); - Assertions.assertEquals("cryuan", model.display().description()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DedicatedHsmOperationInner model = new DedicatedHsmOperationInner().withName("itjz") - .withOrigin("sarhmofc") - .withDisplay(new DedicatedHsmOperationDisplay().withProvider("my") - .withResource("kdtmlxhekuk") - .withOperation("txukcdmp") - .withDescription("cryuan")); - model = BinaryData.fromObject(model).toObject(DedicatedHsmOperationInner.class); - Assertions.assertEquals("itjz", model.name()); - Assertions.assertEquals("sarhmofc", model.origin()); - Assertions.assertEquals("my", model.display().provider()); - Assertions.assertEquals("kdtmlxhekuk", model.display().resource()); - Assertions.assertEquals("txukcdmp", model.display().operation()); - Assertions.assertEquals("cryuan", model.display().description()); - } -} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmOperationListResultTests.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmOperationListResultTests.java deleted file mode 100644 index ef9355622166..000000000000 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmOperationListResultTests.java +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.hardwaresecuritymodules.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.DedicatedHsmOperationInner; -import com.azure.resourcemanager.hardwaresecuritymodules.models.DedicatedHsmOperationDisplay; -import com.azure.resourcemanager.hardwaresecuritymodules.models.DedicatedHsmOperationListResult; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class DedicatedHsmOperationListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DedicatedHsmOperationListResult model = BinaryData.fromString( - "{\"value\":[{\"name\":\"quvgjxpybczme\",\"isDataAction\":true,\"origin\":\"opb\",\"display\":{\"provider\":\"rupidgsyb\",\"resource\":\"jhphoyc\",\"operation\":\"xaobhdxbmtqioqjz\",\"description\":\"tbmufpo\"}},{\"name\":\"oizh\",\"isDataAction\":false,\"origin\":\"ybqsoqijg\",\"display\":{\"provider\":\"bpazlobcufpdzn\",\"resource\":\"t\",\"operation\":\"qjnqglhqgnufoooj\",\"description\":\"ifsqesaagdfmg\"}},{\"name\":\"lhjxr\",\"isDataAction\":false,\"origin\":\"mrvktsizntoc\",\"display\":{\"provider\":\"ouajpsqucmpoyf\",\"resource\":\"fogknygjofjdde\",\"operation\":\"rd\",\"description\":\"pewnw\"}}]}") - .toObject(DedicatedHsmOperationListResult.class); - Assertions.assertEquals("quvgjxpybczme", model.value().get(0).name()); - Assertions.assertEquals("opb", model.value().get(0).origin()); - Assertions.assertEquals("rupidgsyb", model.value().get(0).display().provider()); - Assertions.assertEquals("jhphoyc", model.value().get(0).display().resource()); - Assertions.assertEquals("xaobhdxbmtqioqjz", model.value().get(0).display().operation()); - Assertions.assertEquals("tbmufpo", model.value().get(0).display().description()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DedicatedHsmOperationListResult model = new DedicatedHsmOperationListResult().withValue(Arrays.asList( - new DedicatedHsmOperationInner().withName("quvgjxpybczme") - .withOrigin("opb") - .withDisplay(new DedicatedHsmOperationDisplay().withProvider("rupidgsyb") - .withResource("jhphoyc") - .withOperation("xaobhdxbmtqioqjz") - .withDescription("tbmufpo")), - new DedicatedHsmOperationInner().withName("oizh") - .withOrigin("ybqsoqijg") - .withDisplay(new DedicatedHsmOperationDisplay().withProvider("bpazlobcufpdzn") - .withResource("t") - .withOperation("qjnqglhqgnufoooj") - .withDescription("ifsqesaagdfmg")), - new DedicatedHsmOperationInner().withName("lhjxr") - .withOrigin("mrvktsizntoc") - .withDisplay(new DedicatedHsmOperationDisplay().withProvider("ouajpsqucmpoyf") - .withResource("fogknygjofjdde") - .withOperation("rd") - .withDescription("pewnw")))); - model = BinaryData.fromObject(model).toObject(DedicatedHsmOperationListResult.class); - Assertions.assertEquals("quvgjxpybczme", model.value().get(0).name()); - Assertions.assertEquals("opb", model.value().get(0).origin()); - Assertions.assertEquals("rupidgsyb", model.value().get(0).display().provider()); - Assertions.assertEquals("jhphoyc", model.value().get(0).display().resource()); - Assertions.assertEquals("xaobhdxbmtqioqjz", model.value().get(0).display().operation()); - Assertions.assertEquals("tbmufpo", model.value().get(0).display().description()); - } -} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmPatchParametersTests.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmPatchParametersTests.java deleted file mode 100644 index d3023b8175c7..000000000000 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmPatchParametersTests.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.hardwaresecuritymodules.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.hardwaresecuritymodules.models.DedicatedHsmPatchParameters; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class DedicatedHsmPatchParametersTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DedicatedHsmPatchParameters model - = BinaryData.fromString("{\"tags\":{\"tmrldhugjzzdatq\":\"je\",\"gphuticndvka\":\"hocdgeab\"}}") - .toObject(DedicatedHsmPatchParameters.class); - Assertions.assertEquals("je", model.tags().get("tmrldhugjzzdatq")); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DedicatedHsmPatchParameters model - = new DedicatedHsmPatchParameters().withTags(mapOf("tmrldhugjzzdatq", "je", "gphuticndvka", "hocdgeab")); - model = BinaryData.fromObject(model).toObject(DedicatedHsmPatchParameters.class); - Assertions.assertEquals("je", model.tags().get("tmrldhugjzzdatq")); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmPropertiesTests.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmPropertiesTests.java deleted file mode 100644 index ff3fd3b6b5cb..000000000000 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmPropertiesTests.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.hardwaresecuritymodules.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.hardwaresecuritymodules.models.ApiEntityReference; -import com.azure.resourcemanager.hardwaresecuritymodules.models.DedicatedHsmProperties; -import com.azure.resourcemanager.hardwaresecuritymodules.models.NetworkInterface; -import com.azure.resourcemanager.hardwaresecuritymodules.models.NetworkProfile; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class DedicatedHsmPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DedicatedHsmProperties model = BinaryData.fromString( - "{\"networkProfile\":{\"subnet\":{\"id\":\"n\"},\"networkInterfaces\":[{\"id\":\"cjrwzoxxjtfellu\",\"privateIpAddress\":\"zitonpeqfpjkjl\"}]},\"managementNetworkProfile\":{\"subnet\":{\"id\":\"dvhpfxxypininm\"},\"networkInterfaces\":[{\"id\":\"ybb\",\"privateIpAddress\":\"odepoogin\"}]},\"stampId\":\"amiheognarxz\",\"statusMessage\":\"heotusiv\",\"provisioningState\":\"Deleting\"}") - .toObject(DedicatedHsmProperties.class); - Assertions.assertEquals("n", model.networkProfile().subnet().id()); - Assertions.assertEquals("zitonpeqfpjkjl", model.networkProfile().networkInterfaces().get(0).privateIpAddress()); - Assertions.assertEquals("dvhpfxxypininm", model.managementNetworkProfile().subnet().id()); - Assertions.assertEquals("odepoogin", - model.managementNetworkProfile().networkInterfaces().get(0).privateIpAddress()); - Assertions.assertEquals("amiheognarxz", model.stampId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DedicatedHsmProperties model = new DedicatedHsmProperties() - .withNetworkProfile(new NetworkProfile().withSubnet(new ApiEntityReference().withId("n")) - .withNetworkInterfaces(Arrays.asList(new NetworkInterface().withPrivateIpAddress("zitonpeqfpjkjl")))) - .withManagementNetworkProfile( - new NetworkProfile().withSubnet(new ApiEntityReference().withId("dvhpfxxypininm")) - .withNetworkInterfaces(Arrays.asList(new NetworkInterface().withPrivateIpAddress("odepoogin")))) - .withStampId("amiheognarxz"); - model = BinaryData.fromObject(model).toObject(DedicatedHsmProperties.class); - Assertions.assertEquals("n", model.networkProfile().subnet().id()); - Assertions.assertEquals("zitonpeqfpjkjl", model.networkProfile().networkInterfaces().get(0).privateIpAddress()); - Assertions.assertEquals("dvhpfxxypininm", model.managementNetworkProfile().subnet().id()); - Assertions.assertEquals("odepoogin", - model.managementNetworkProfile().networkInterfaces().get(0).privateIpAddress()); - Assertions.assertEquals("amiheognarxz", model.stampId()); - } -} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmResourceTests.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmResourceTests.java deleted file mode 100644 index f0f4e6004755..000000000000 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmResourceTests.java +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.hardwaresecuritymodules.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.hardwaresecuritymodules.models.DedicatedHsmResource; -import com.azure.resourcemanager.hardwaresecuritymodules.models.Sku; -import com.azure.resourcemanager.hardwaresecuritymodules.models.SkuName; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class DedicatedHsmResourceTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DedicatedHsmResource model = BinaryData.fromString( - "{\"sku\":{\"name\":\"payShield10K_LMK1_CPS2500\"},\"zones\":[\"rljdouskcqv\",\"ocrcjdk\",\"tnhxbn\"],\"location\":\"biksq\",\"tags\":{\"fmppe\":\"ssainqpjwnzll\",\"c\":\"bvmgxsabkyqduuji\"},\"id\":\"czdzev\",\"name\":\"dhkrwpdappdsbdk\",\"type\":\"wrwjfeu\"}") - .toObject(DedicatedHsmResource.class); - Assertions.assertEquals("biksq", model.location()); - Assertions.assertEquals("ssainqpjwnzll", model.tags().get("fmppe")); - Assertions.assertEquals(SkuName.PAY_SHIELD10K_LMK1_CPS2500, model.sku().name()); - Assertions.assertEquals("rljdouskcqv", model.zones().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DedicatedHsmResource model = new DedicatedHsmResource().withLocation("biksq") - .withTags(mapOf("fmppe", "ssainqpjwnzll", "c", "bvmgxsabkyqduuji")) - .withSku(new Sku().withName(SkuName.PAY_SHIELD10K_LMK1_CPS2500)) - .withZones(Arrays.asList("rljdouskcqv", "ocrcjdk", "tnhxbn")); - model = BinaryData.fromObject(model).toObject(DedicatedHsmResource.class); - Assertions.assertEquals("biksq", model.location()); - Assertions.assertEquals("ssainqpjwnzll", model.tags().get("fmppe")); - Assertions.assertEquals(SkuName.PAY_SHIELD10K_LMK1_CPS2500, model.sku().name()); - Assertions.assertEquals("rljdouskcqv", model.zones().get(0)); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmsCreateOrUpdateMockTests.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmsCreateOrUpdateMockTests.java deleted file mode 100644 index 1330ffd96e6c..000000000000 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmsCreateOrUpdateMockTests.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.hardwaresecuritymodules.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager; -import com.azure.resourcemanager.hardwaresecuritymodules.models.ApiEntityReference; -import com.azure.resourcemanager.hardwaresecuritymodules.models.DedicatedHsm; -import com.azure.resourcemanager.hardwaresecuritymodules.models.DedicatedHsmProperties; -import com.azure.resourcemanager.hardwaresecuritymodules.models.NetworkInterface; -import com.azure.resourcemanager.hardwaresecuritymodules.models.NetworkProfile; -import com.azure.resourcemanager.hardwaresecuritymodules.models.Sku; -import com.azure.resourcemanager.hardwaresecuritymodules.models.SkuName; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class DedicatedHsmsCreateOrUpdateMockTests { - @Test - public void testCreateOrUpdate() throws Exception { - String responseStr - = "{\"properties\":{\"networkProfile\":{\"subnet\":{\"id\":\"wpn\"},\"networkInterfaces\":[{\"id\":\"qnermclfplphoxu\",\"privateIpAddress\":\"rpabg\"}]},\"managementNetworkProfile\":{\"subnet\":{\"id\":\"bjtazqugxywpmu\"},\"networkInterfaces\":[{\"id\":\"zwfqkqujidsuyon\",\"privateIpAddress\":\"glaocq\"}]},\"stampId\":\"ccm\",\"statusMessage\":\"udxytlmoyrx\",\"provisioningState\":\"Succeeded\"},\"sku\":{\"name\":\"payShield10K_LMK1_CPS250\"},\"zones\":[\"ntxhdzhlrqjbhck\",\"rlhrxs\"],\"location\":\"kyv\",\"tags\":{\"crnwbmeh\":\"anuzbpzkafkuw\"},\"id\":\"seyvj\",\"name\":\"srtslhspkdeem\",\"type\":\"ofmxagkvtmelmqkr\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - HardwareSecurityModulesManager manager = HardwareSecurityModulesManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - DedicatedHsm response = manager.dedicatedHsms() - .define("fzab") - .withRegion("xotogtwrupqsxv") - .withExistingResourceGroup("xytxhpzxbz") - .withProperties(new DedicatedHsmProperties() - .withNetworkProfile(new NetworkProfile().withSubnet(new ApiEntityReference().withId("xwtctyqiklbbovpl")) - .withNetworkInterfaces(Arrays.asList(new NetworkInterface().withPrivateIpAddress("kfssxqukkf"), - new NetworkInterface().withPrivateIpAddress("pvlopwiyighxpkd")))) - .withManagementNetworkProfile(new NetworkProfile() - .withSubnet(new ApiEntityReference().withId("iuebbaumny")) - .withNetworkInterfaces(Arrays.asList(new NetworkInterface().withPrivateIpAddress("bckhsmtxpsi")))) - .withStampId("tfhvpesapskrdqmh")) - .withTags(mapOf("eil", "cykvceo")) - .withSku(new Sku().withName(SkuName.PAY_SHIELD10K_LMK2_CPS2500)) - .withZones(Arrays.asList("scwsv")) - .create(); - - Assertions.assertEquals("kyv", response.location()); - Assertions.assertEquals("anuzbpzkafkuw", response.tags().get("crnwbmeh")); - Assertions.assertEquals(SkuName.PAY_SHIELD10K_LMK1_CPS250, response.sku().name()); - Assertions.assertEquals("ntxhdzhlrqjbhck", response.zones().get(0)); - Assertions.assertEquals("wpn", response.properties().networkProfile().subnet().id()); - Assertions.assertEquals("rpabg", - response.properties().networkProfile().networkInterfaces().get(0).privateIpAddress()); - Assertions.assertEquals("bjtazqugxywpmu", response.properties().managementNetworkProfile().subnet().id()); - Assertions.assertEquals("glaocq", - response.properties().managementNetworkProfile().networkInterfaces().get(0).privateIpAddress()); - Assertions.assertEquals("ccm", response.properties().stampId()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmsDeleteMockTests.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmsDeleteMockTests.java deleted file mode 100644 index 3a35306ce2da..000000000000 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmsDeleteMockTests.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.hardwaresecuritymodules.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class DedicatedHsmsDeleteMockTests { - @Test - public void testDelete() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - HardwareSecurityModulesManager manager = HardwareSecurityModulesManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.dedicatedHsms().delete("xnj", "ase", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmsGetByResourceGroupWithResponseMockTests.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmsGetByResourceGroupWithResponseMockTests.java deleted file mode 100644 index 4fb0ac061196..000000000000 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmsGetByResourceGroupWithResponseMockTests.java +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.hardwaresecuritymodules.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager; -import com.azure.resourcemanager.hardwaresecuritymodules.models.DedicatedHsm; -import com.azure.resourcemanager.hardwaresecuritymodules.models.SkuName; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class DedicatedHsmsGetByResourceGroupWithResponseMockTests { - @Test - public void testGetByResourceGroupWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"networkProfile\":{\"subnet\":{\"id\":\"masxazjpqyegu\"},\"networkInterfaces\":[{\"id\":\"xxhejjzzvd\",\"privateIpAddress\":\"gwdslfhotwm\"}]},\"managementNetworkProfile\":{\"subnet\":{\"id\":\"wlbjnpgacftade\"},\"networkInterfaces\":[{\"id\":\"tyfsoppusuesn\",\"privateIpAddress\":\"dejbavo\"},{\"id\":\"zdmohctbqvu\",\"privateIpAddress\":\"xdn\"},{\"id\":\"vo\",\"privateIpAddress\":\"ujjugwdkcglh\"},{\"id\":\"azjdyggd\",\"privateIpAddress\":\"ixhbkuofqweykhm\"}]},\"stampId\":\"evfyexfwhybcib\",\"statusMessage\":\"vdcsitynn\",\"provisioningState\":\"Provisioning\"},\"sku\":{\"name\":\"payShield10K_LMK1_CPS2500\"},\"zones\":[\"hfiqscjeypvhe\"],\"location\":\"rkgqhcjrefo\",\"tags\":{\"jpkcattpng\":\"kqsleyyvxy\",\"czsqpjhvm\":\"cr\",\"a\":\"ajvnysounqe\"},\"id\":\"oaeupfhyhltrpmo\",\"name\":\"jmcmatuokthfu\",\"type\":\"uaodsfcpk\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - HardwareSecurityModulesManager manager = HardwareSecurityModulesManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - DedicatedHsm response = manager.dedicatedHsms() - .getByResourceGroupWithResponse("pheoflokeyy", "enjbdlwtgrhp", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("rkgqhcjrefo", response.location()); - Assertions.assertEquals("kqsleyyvxy", response.tags().get("jpkcattpng")); - Assertions.assertEquals(SkuName.PAY_SHIELD10K_LMK1_CPS2500, response.sku().name()); - Assertions.assertEquals("hfiqscjeypvhe", response.zones().get(0)); - Assertions.assertEquals("masxazjpqyegu", response.properties().networkProfile().subnet().id()); - Assertions.assertEquals("gwdslfhotwm", - response.properties().networkProfile().networkInterfaces().get(0).privateIpAddress()); - Assertions.assertEquals("wlbjnpgacftade", response.properties().managementNetworkProfile().subnet().id()); - Assertions.assertEquals("dejbavo", - response.properties().managementNetworkProfile().networkInterfaces().get(0).privateIpAddress()); - Assertions.assertEquals("evfyexfwhybcib", response.properties().stampId()); - } -} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmsListByResourceGroupMockTests.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmsListByResourceGroupMockTests.java deleted file mode 100644 index eeba61521743..000000000000 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmsListByResourceGroupMockTests.java +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.hardwaresecuritymodules.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager; -import com.azure.resourcemanager.hardwaresecuritymodules.models.DedicatedHsm; -import com.azure.resourcemanager.hardwaresecuritymodules.models.SkuName; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class DedicatedHsmsListByResourceGroupMockTests { - @Test - public void testListByResourceGroup() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"networkProfile\":{\"subnet\":{\"id\":\"iu\"},\"networkInterfaces\":[{\"id\":\"whrdxwzywqsmbsu\",\"privateIpAddress\":\"xim\"}]},\"managementNetworkProfile\":{\"subnet\":{\"id\":\"cfsf\"},\"networkInterfaces\":[{\"id\":\"ddystkiiuxhqy\",\"privateIpAddress\":\"xorrqnb\"},{\"id\":\"czvyifq\",\"privateIpAddress\":\"kdvjsll\"}]},\"stampId\":\"vvdfwatkpnpul\",\"statusMessage\":\"xbczwtruwiqz\",\"provisioningState\":\"Allocating\"},\"sku\":{\"name\":\"payShield10K_LMK1_CPS60\"},\"zones\":[\"yokacspkw\",\"hzdobpxjmflbvvnc\",\"rkcciwwzjuqk\"],\"location\":\"rsa\",\"tags\":{\"foskghsauuimj\":\"ku\",\"rfbyaosvexcso\":\"vxieduugidyj\",\"vleggzfbuhfmvfax\":\"pclhocohslk\",\"hl\":\"ffeii\"},\"id\":\"m\",\"name\":\"zy\",\"type\":\"shxmzsbbzoggigrx\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - HardwareSecurityModulesManager manager = HardwareSecurityModulesManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.dedicatedHsms() - .listByResourceGroup("xodpuozmyzydagfu", 1113167460, com.azure.core.util.Context.NONE); - - Assertions.assertEquals("rsa", response.iterator().next().location()); - Assertions.assertEquals("ku", response.iterator().next().tags().get("foskghsauuimj")); - Assertions.assertEquals(SkuName.PAY_SHIELD10K_LMK1_CPS60, response.iterator().next().sku().name()); - Assertions.assertEquals("yokacspkw", response.iterator().next().zones().get(0)); - Assertions.assertEquals("iu", response.iterator().next().properties().networkProfile().subnet().id()); - Assertions.assertEquals("xim", - response.iterator().next().properties().networkProfile().networkInterfaces().get(0).privateIpAddress()); - Assertions.assertEquals("cfsf", - response.iterator().next().properties().managementNetworkProfile().subnet().id()); - Assertions.assertEquals("xorrqnb", - response.iterator() - .next() - .properties() - .managementNetworkProfile() - .networkInterfaces() - .get(0) - .privateIpAddress()); - Assertions.assertEquals("vvdfwatkpnpul", response.iterator().next().properties().stampId()); - } -} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmsListMockTests.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmsListMockTests.java deleted file mode 100644 index 7a8f95c936e3..000000000000 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmsListMockTests.java +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.hardwaresecuritymodules.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager; -import com.azure.resourcemanager.hardwaresecuritymodules.models.DedicatedHsm; -import com.azure.resourcemanager.hardwaresecuritymodules.models.SkuName; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class DedicatedHsmsListMockTests { - @Test - public void testList() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"networkProfile\":{\"subnet\":{\"id\":\"xxjnspydptk\"},\"networkInterfaces\":[{\"id\":\"ou\",\"privateIpAddress\":\"vudwtiukbldng\"},{\"id\":\"ocipazyxoeg\",\"privateIpAddress\":\"g\"}]},\"managementNetworkProfile\":{\"subnet\":{\"id\":\"ucgygevqz\"},\"networkInterfaces\":[{\"id\":\"mrbpizcdrqj\",\"privateIpAddress\":\"pyd\"}]},\"stampId\":\"yhxdeoejzicwi\",\"statusMessage\":\"jttgzf\",\"provisioningState\":\"Succeeded\"},\"sku\":{\"name\":\"payShield10K_LMK2_CPS2500\"},\"zones\":[\"ajdeyeamdphaga\",\"pbuxwgipwhon\",\"wkgshwa\",\"kix\"],\"location\":\"bin\",\"tags\":{\"yqzrnkcqvyxlw\":\"uttmrywnuzoqft\"},\"id\":\"zlsico\",\"name\":\"oqqnwvlryav\",\"type\":\"hheunmmqhgyx\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - HardwareSecurityModulesManager manager = HardwareSecurityModulesManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response - = manager.dedicatedHsms().list(830818996, com.azure.core.util.Context.NONE); - - Assertions.assertEquals("bin", response.iterator().next().location()); - Assertions.assertEquals("uttmrywnuzoqft", response.iterator().next().tags().get("yqzrnkcqvyxlw")); - Assertions.assertEquals(SkuName.PAY_SHIELD10K_LMK2_CPS2500, response.iterator().next().sku().name()); - Assertions.assertEquals("ajdeyeamdphaga", response.iterator().next().zones().get(0)); - Assertions.assertEquals("xxjnspydptk", response.iterator().next().properties().networkProfile().subnet().id()); - Assertions.assertEquals("vudwtiukbldng", - response.iterator().next().properties().networkProfile().networkInterfaces().get(0).privateIpAddress()); - Assertions.assertEquals("ucgygevqz", - response.iterator().next().properties().managementNetworkProfile().subnet().id()); - Assertions.assertEquals("pyd", - response.iterator() - .next() - .properties() - .managementNetworkProfile() - .networkInterfaces() - .get(0) - .privateIpAddress()); - Assertions.assertEquals("yhxdeoejzicwi", response.iterator().next().properties().stampId()); - } -} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmsListOutboundNetworkDependenciesEndpointsMockTests.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmsListOutboundNetworkDependenciesEndpointsMockTests.java deleted file mode 100644 index 334e656f791f..000000000000 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/DedicatedHsmsListOutboundNetworkDependenciesEndpointsMockTests.java +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.hardwaresecuritymodules.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager; -import com.azure.resourcemanager.hardwaresecuritymodules.models.OutboundEnvironmentEndpoint; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class DedicatedHsmsListOutboundNetworkDependenciesEndpointsMockTests { - @Test - public void testListOutboundNetworkDependenciesEndpoints() throws Exception { - String responseStr - = "{\"value\":[{\"category\":\"fkbey\",\"endpoints\":[{\"domainName\":\"mjmwvvjektcx\",\"endpointDetails\":[{\"ipAddress\":\"wlrsffrzpwv\",\"port\":1792150681,\"protocol\":\"gbiqylihkaet\",\"description\":\"tvfcivfsn\"},{\"ipAddress\":\"m\",\"port\":1059821653,\"protocol\":\"hjfbebrjcxe\",\"description\":\"uwutttxfvjrbi\"},{\"ipAddress\":\"hxepcyvahfnlj\",\"port\":561070013,\"protocol\":\"j\",\"description\":\"ujqgidok\"},{\"ipAddress\":\"ljyoxgvcltb\",\"port\":1745548413,\"protocol\":\"ghkjeszzhbi\",\"description\":\"txfvgx\"}]},{\"domainName\":\"smx\",\"endpointDetails\":[{\"ipAddress\":\"pvecxgodeb\",\"port\":398257944,\"protocol\":\"rbmpukgri\",\"description\":\"lzlfbxzpuz\"},{\"ipAddress\":\"ispnqzahmgkbrp\",\"port\":1687540865,\"protocol\":\"ibnuqqkpik\",\"description\":\"rgvtqag\"}]},{\"domainName\":\"uynhijg\",\"endpointDetails\":[{\"ipAddress\":\"fsiarbutr\",\"port\":1477198207,\"protocol\":\"azzmhjrunmpxt\",\"description\":\"bh\"}]},{\"domainName\":\"nlankxmyskpb\",\"endpointDetails\":[{\"ipAddress\":\"tkcxywnytnrsy\",\"port\":1857239406,\"protocol\":\"dybyxczfclhaa\",\"description\":\"babphlwrqlfk\"},{\"ipAddress\":\"thsu\",\"port\":296949281,\"protocol\":\"nyyazttbtwwrqpue\",\"description\":\"kzywbiex\"},{\"ipAddress\":\"eyueaxibxujwb\",\"port\":913520848,\"protocol\":\"lmuzy\",\"description\":\"aepdkzjanc\"},{\"ipAddress\":\"rhdwbavxbniw\",\"port\":1074996435,\"protocol\":\"zt\",\"description\":\"bpg\"}]}]}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - HardwareSecurityModulesManager manager = HardwareSecurityModulesManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.dedicatedHsms() - .listOutboundNetworkDependenciesEndpoints("konocu", "oklyaxuconuq", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("fkbey", response.iterator().next().category()); - Assertions.assertEquals("mjmwvvjektcx", response.iterator().next().endpoints().get(0).domainName()); - Assertions.assertEquals("wlrsffrzpwv", - response.iterator().next().endpoints().get(0).endpointDetails().get(0).ipAddress()); - Assertions.assertEquals(1792150681, - response.iterator().next().endpoints().get(0).endpointDetails().get(0).port()); - Assertions.assertEquals("gbiqylihkaet", - response.iterator().next().endpoints().get(0).endpointDetails().get(0).protocol()); - Assertions.assertEquals("tvfcivfsn", - response.iterator().next().endpoints().get(0).endpointDetails().get(0).description()); - } -} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/EndpointDependencyTests.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/EndpointDependencyTests.java deleted file mode 100644 index b05d144afc7c..000000000000 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/EndpointDependencyTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.hardwaresecuritymodules.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.hardwaresecuritymodules.models.EndpointDependency; -import com.azure.resourcemanager.hardwaresecuritymodules.models.EndpointDetail; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class EndpointDependencyTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - EndpointDependency model = BinaryData.fromString( - "{\"domainName\":\"nc\",\"endpointDetails\":[{\"ipAddress\":\"cfvmmco\",\"port\":734446999,\"protocol\":\"lzevgbmqjqab\",\"description\":\"pmivkwlzu\"}]}") - .toObject(EndpointDependency.class); - Assertions.assertEquals("nc", model.domainName()); - Assertions.assertEquals("cfvmmco", model.endpointDetails().get(0).ipAddress()); - Assertions.assertEquals(734446999, model.endpointDetails().get(0).port()); - Assertions.assertEquals("lzevgbmqjqab", model.endpointDetails().get(0).protocol()); - Assertions.assertEquals("pmivkwlzu", model.endpointDetails().get(0).description()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - EndpointDependency model = new EndpointDependency().withDomainName("nc") - .withEndpointDetails(Arrays.asList(new EndpointDetail().withIpAddress("cfvmmco") - .withPort(734446999) - .withProtocol("lzevgbmqjqab") - .withDescription("pmivkwlzu"))); - model = BinaryData.fromObject(model).toObject(EndpointDependency.class); - Assertions.assertEquals("nc", model.domainName()); - Assertions.assertEquals("cfvmmco", model.endpointDetails().get(0).ipAddress()); - Assertions.assertEquals(734446999, model.endpointDetails().get(0).port()); - Assertions.assertEquals("lzevgbmqjqab", model.endpointDetails().get(0).protocol()); - Assertions.assertEquals("pmivkwlzu", model.endpointDetails().get(0).description()); - } -} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/EndpointDetailTests.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/EndpointDetailTests.java deleted file mode 100644 index dd47f1baa8aa..000000000000 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/EndpointDetailTests.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.hardwaresecuritymodules.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.hardwaresecuritymodules.models.EndpointDetail; -import org.junit.jupiter.api.Assertions; - -public final class EndpointDetailTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - EndpointDetail model = BinaryData - .fromString("{\"ipAddress\":\"c\",\"port\":1704525857,\"protocol\":\"nbacfi\",\"description\":\"l\"}") - .toObject(EndpointDetail.class); - Assertions.assertEquals("c", model.ipAddress()); - Assertions.assertEquals(1704525857, model.port()); - Assertions.assertEquals("nbacfi", model.protocol()); - Assertions.assertEquals("l", model.description()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - EndpointDetail model - = new EndpointDetail().withIpAddress("c").withPort(1704525857).withProtocol("nbacfi").withDescription("l"); - model = BinaryData.fromObject(model).toObject(EndpointDetail.class); - Assertions.assertEquals("c", model.ipAddress()); - Assertions.assertEquals(1704525857, model.port()); - Assertions.assertEquals("nbacfi", model.protocol()); - Assertions.assertEquals("l", model.description()); - } -} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/NetworkInterfaceTests.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/NetworkInterfaceTests.java deleted file mode 100644 index cb471f0c621d..000000000000 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/NetworkInterfaceTests.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.hardwaresecuritymodules.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.hardwaresecuritymodules.models.NetworkInterface; -import org.junit.jupiter.api.Assertions; - -public final class NetworkInterfaceTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - NetworkInterface model - = BinaryData.fromString("{\"id\":\"hqjbasvmsmj\",\"privateIpAddress\":\"lngsntnbybkzgcwr\"}") - .toObject(NetworkInterface.class); - Assertions.assertEquals("lngsntnbybkzgcwr", model.privateIpAddress()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - NetworkInterface model = new NetworkInterface().withPrivateIpAddress("lngsntnbybkzgcwr"); - model = BinaryData.fromObject(model).toObject(NetworkInterface.class); - Assertions.assertEquals("lngsntnbybkzgcwr", model.privateIpAddress()); - } -} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/NetworkProfileTests.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/NetworkProfileTests.java deleted file mode 100644 index ec929fd18868..000000000000 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/NetworkProfileTests.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.hardwaresecuritymodules.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.hardwaresecuritymodules.models.ApiEntityReference; -import com.azure.resourcemanager.hardwaresecuritymodules.models.NetworkInterface; -import com.azure.resourcemanager.hardwaresecuritymodules.models.NetworkProfile; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class NetworkProfileTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - NetworkProfile model = BinaryData.fromString( - "{\"subnet\":{\"id\":\"iqihn\"},\"networkInterfaces\":[{\"id\":\"bwjzr\",\"privateIpAddress\":\"ygxgispemvtz\"},{\"id\":\"ufubl\",\"privateIpAddress\":\"fxqeof\"}]}") - .toObject(NetworkProfile.class); - Assertions.assertEquals("iqihn", model.subnet().id()); - Assertions.assertEquals("ygxgispemvtz", model.networkInterfaces().get(0).privateIpAddress()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - NetworkProfile model = new NetworkProfile().withSubnet(new ApiEntityReference().withId("iqihn")) - .withNetworkInterfaces(Arrays.asList(new NetworkInterface().withPrivateIpAddress("ygxgispemvtz"), - new NetworkInterface().withPrivateIpAddress("fxqeof"))); - model = BinaryData.fromObject(model).toObject(NetworkProfile.class); - Assertions.assertEquals("iqihn", model.subnet().id()); - Assertions.assertEquals("ygxgispemvtz", model.networkInterfaces().get(0).privateIpAddress()); - } -} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/OperationsListMockTests.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/OperationsListMockTests.java deleted file mode 100644 index 8cb034e00eba..000000000000 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/OperationsListMockTests.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.hardwaresecuritymodules.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.hardwaresecuritymodules.HardwareSecurityModulesManager; -import com.azure.resourcemanager.hardwaresecuritymodules.models.DedicatedHsmOperation; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class OperationsListMockTests { - @Test - public void testList() throws Exception { - String responseStr - = "{\"value\":[{\"name\":\"x\",\"isDataAction\":false,\"origin\":\"tzxdpnqbqqwx\",\"display\":{\"provider\":\"eallnwsubisnj\",\"resource\":\"pmng\",\"operation\":\"scxaq\",\"description\":\"ochcbonqvpkvl\"}}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - HardwareSecurityModulesManager manager = HardwareSecurityModulesManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.operations().list(com.azure.core.util.Context.NONE); - - Assertions.assertEquals("x", response.iterator().next().name()); - Assertions.assertEquals("tzxdpnqbqqwx", response.iterator().next().origin()); - Assertions.assertEquals("eallnwsubisnj", response.iterator().next().display().provider()); - Assertions.assertEquals("pmng", response.iterator().next().display().resource()); - Assertions.assertEquals("scxaq", response.iterator().next().display().operation()); - Assertions.assertEquals("ochcbonqvpkvl", response.iterator().next().display().description()); - } -} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/OutboundEnvironmentEndpointCollectionTests.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/OutboundEnvironmentEndpointCollectionTests.java deleted file mode 100644 index d4e013aceef5..000000000000 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/OutboundEnvironmentEndpointCollectionTests.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.hardwaresecuritymodules.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.OutboundEnvironmentEndpointInner; -import com.azure.resourcemanager.hardwaresecuritymodules.models.EndpointDependency; -import com.azure.resourcemanager.hardwaresecuritymodules.models.EndpointDetail; -import com.azure.resourcemanager.hardwaresecuritymodules.models.OutboundEnvironmentEndpointCollection; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class OutboundEnvironmentEndpointCollectionTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OutboundEnvironmentEndpointCollection model = BinaryData.fromString( - "{\"value\":[{\"category\":\"pvswjdkirso\",\"endpoints\":[{\"domainName\":\"hc\",\"endpointDetails\":[{},{}]},{\"domainName\":\"hjtckwhd\",\"endpointDetails\":[{},{},{},{}]}]},{\"category\":\"iy\",\"endpoints\":[{\"domainName\":\"sqwpgrjb\",\"endpointDetails\":[{},{},{}]},{\"domainName\":\"cjxvsnbyxqab\",\"endpointDetails\":[{},{}]},{\"domainName\":\"pcyshu\",\"endpointDetails\":[{},{},{},{}]}]},{\"category\":\"bl\",\"endpoints\":[{\"domainName\":\"btoqcjmkljavbqid\",\"endpointDetails\":[{},{}]},{\"domainName\":\"zyulp\",\"endpointDetails\":[{}]},{\"domainName\":\"krlkhbzhfepg\",\"endpointDetails\":[{}]}]},{\"category\":\"xzlocxscp\",\"endpoints\":[{\"domainName\":\"hhbcsglummajtjao\",\"endpointDetails\":[{},{},{},{}]},{\"domainName\":\"nbdxk\",\"endpointDetails\":[{}]},{\"domainName\":\"kajionpim\",\"endpointDetails\":[{},{}]}]}],\"nextLink\":\"txgcpodgmaajr\"}") - .toObject(OutboundEnvironmentEndpointCollection.class); - Assertions.assertEquals("pvswjdkirso", model.value().get(0).category()); - Assertions.assertEquals("hc", model.value().get(0).endpoints().get(0).domainName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OutboundEnvironmentEndpointCollection model - = new OutboundEnvironmentEndpointCollection() - .withValue( - Arrays.asList( - new OutboundEnvironmentEndpointInner().withCategory("pvswjdkirso") - .withEndpoints(Arrays.asList( - new EndpointDependency().withDomainName("hc") - .withEndpointDetails(Arrays.asList(new EndpointDetail(), new EndpointDetail())), - new EndpointDependency().withDomainName("hjtckwhd") - .withEndpointDetails(Arrays.asList(new EndpointDetail(), new EndpointDetail(), - new EndpointDetail(), new EndpointDetail())))), - new OutboundEnvironmentEndpointInner().withCategory("iy") - .withEndpoints(Arrays.asList( - new EndpointDependency().withDomainName("sqwpgrjb") - .withEndpointDetails(Arrays.asList(new EndpointDetail(), new EndpointDetail(), - new EndpointDetail())), - new EndpointDependency().withDomainName("cjxvsnbyxqab") - .withEndpointDetails(Arrays.asList(new EndpointDetail(), new EndpointDetail())), - new EndpointDependency().withDomainName("pcyshu") - .withEndpointDetails(Arrays.asList(new EndpointDetail(), new EndpointDetail(), - new EndpointDetail(), new EndpointDetail())))), - new OutboundEnvironmentEndpointInner().withCategory("bl") - .withEndpoints(Arrays.asList( - new EndpointDependency().withDomainName("btoqcjmkljavbqid") - .withEndpointDetails(Arrays.asList(new EndpointDetail(), new EndpointDetail())), - new EndpointDependency().withDomainName("zyulp") - .withEndpointDetails(Arrays.asList(new EndpointDetail())), - new EndpointDependency().withDomainName("krlkhbzhfepg") - .withEndpointDetails(Arrays.asList(new EndpointDetail())))), - new OutboundEnvironmentEndpointInner().withCategory("xzlocxscp") - .withEndpoints(Arrays.asList( - new EndpointDependency().withDomainName("hhbcsglummajtjao") - .withEndpointDetails(Arrays.asList(new EndpointDetail(), new EndpointDetail(), - new EndpointDetail(), new EndpointDetail())), - new EndpointDependency().withDomainName("nbdxk") - .withEndpointDetails(Arrays.asList(new EndpointDetail())), - new EndpointDependency().withDomainName("kajionpim") - .withEndpointDetails(Arrays.asList(new EndpointDetail(), new EndpointDetail())))))); - model = BinaryData.fromObject(model).toObject(OutboundEnvironmentEndpointCollection.class); - Assertions.assertEquals("pvswjdkirso", model.value().get(0).category()); - Assertions.assertEquals("hc", model.value().get(0).endpoints().get(0).domainName()); - } -} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/OutboundEnvironmentEndpointInnerTests.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/OutboundEnvironmentEndpointInnerTests.java deleted file mode 100644 index 470a5c5b1c2b..000000000000 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/OutboundEnvironmentEndpointInnerTests.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.hardwaresecuritymodules.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.hardwaresecuritymodules.fluent.models.OutboundEnvironmentEndpointInner; -import com.azure.resourcemanager.hardwaresecuritymodules.models.EndpointDependency; -import com.azure.resourcemanager.hardwaresecuritymodules.models.EndpointDetail; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class OutboundEnvironmentEndpointInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OutboundEnvironmentEndpointInner model = BinaryData.fromString( - "{\"category\":\"djwzrlov\",\"endpoints\":[{\"domainName\":\"hijco\",\"endpointDetails\":[{\"ipAddress\":\"bzaqsqsycbkbfk\",\"port\":1619207085,\"protocol\":\"kexxppof\",\"description\":\"axcfjpgddtocjjx\"},{\"ipAddress\":\"pmouexhdz\",\"port\":738311617,\"protocol\":\"eojnxqbzvddn\",\"description\":\"ndei\"}]},{\"domainName\":\"twnpzaoqvuhrhcf\",\"endpointDetails\":[{\"ipAddress\":\"dglmjthjqkwp\",\"port\":920917148,\"protocol\":\"xmqci\",\"description\":\"vhkhixu\"}]},{\"domainName\":\"dtopbob\",\"endpointDetails\":[{\"ipAddress\":\"m\",\"port\":115410873,\"protocol\":\"m\",\"description\":\"hrzayvvtpgvdf\"},{\"ipAddress\":\"otkftutqxlngx\",\"port\":1542158785,\"protocol\":\"ugnxkrxdqmi\",\"description\":\"thz\"}]},{\"domainName\":\"qdrabhjybigehoqf\",\"endpointDetails\":[{\"ipAddress\":\"kanyktzlcuiywg\",\"port\":1328534140,\"protocol\":\"ndrvynhzg\",\"description\":\"hrc\"}]}]}") - .toObject(OutboundEnvironmentEndpointInner.class); - Assertions.assertEquals("djwzrlov", model.category()); - Assertions.assertEquals("hijco", model.endpoints().get(0).domainName()); - Assertions.assertEquals("bzaqsqsycbkbfk", model.endpoints().get(0).endpointDetails().get(0).ipAddress()); - Assertions.assertEquals(1619207085, model.endpoints().get(0).endpointDetails().get(0).port()); - Assertions.assertEquals("kexxppof", model.endpoints().get(0).endpointDetails().get(0).protocol()); - Assertions.assertEquals("axcfjpgddtocjjx", model.endpoints().get(0).endpointDetails().get(0).description()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OutboundEnvironmentEndpointInner model = new OutboundEnvironmentEndpointInner().withCategory("djwzrlov") - .withEndpoints(Arrays.asList( - new EndpointDependency().withDomainName("hijco") - .withEndpointDetails(Arrays.asList( - new EndpointDetail().withIpAddress("bzaqsqsycbkbfk") - .withPort(1619207085) - .withProtocol("kexxppof") - .withDescription("axcfjpgddtocjjx"), - new EndpointDetail().withIpAddress("pmouexhdz") - .withPort(738311617) - .withProtocol("eojnxqbzvddn") - .withDescription("ndei"))), - new EndpointDependency().withDomainName("twnpzaoqvuhrhcf") - .withEndpointDetails(Arrays.asList(new EndpointDetail().withIpAddress("dglmjthjqkwp") - .withPort(920917148) - .withProtocol("xmqci") - .withDescription("vhkhixu"))), - new EndpointDependency().withDomainName("dtopbob") - .withEndpointDetails(Arrays.asList( - new EndpointDetail().withIpAddress("m") - .withPort(115410873) - .withProtocol("m") - .withDescription("hrzayvvtpgvdf"), - new EndpointDetail().withIpAddress("otkftutqxlngx") - .withPort(1542158785) - .withProtocol("ugnxkrxdqmi") - .withDescription("thz"))), - new EndpointDependency().withDomainName("qdrabhjybigehoqf") - .withEndpointDetails(Arrays.asList(new EndpointDetail().withIpAddress("kanyktzlcuiywg") - .withPort(1328534140) - .withProtocol("ndrvynhzg") - .withDescription("hrc"))))); - model = BinaryData.fromObject(model).toObject(OutboundEnvironmentEndpointInner.class); - Assertions.assertEquals("djwzrlov", model.category()); - Assertions.assertEquals("hijco", model.endpoints().get(0).domainName()); - Assertions.assertEquals("bzaqsqsycbkbfk", model.endpoints().get(0).endpointDetails().get(0).ipAddress()); - Assertions.assertEquals(1619207085, model.endpoints().get(0).endpointDetails().get(0).port()); - Assertions.assertEquals("kexxppof", model.endpoints().get(0).endpointDetails().get(0).protocol()); - Assertions.assertEquals("axcfjpgddtocjjx", model.endpoints().get(0).endpointDetails().get(0).description()); - } -} diff --git a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/SkuTests.java b/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/SkuTests.java deleted file mode 100644 index 08d32cfb247d..000000000000 --- a/sdk/hardwaresecuritymodules/azure-resourcemanager-hardwaresecuritymodules/src/test/java/com/azure/resourcemanager/hardwaresecuritymodules/generated/SkuTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.hardwaresecuritymodules.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.hardwaresecuritymodules.models.Sku; -import com.azure.resourcemanager.hardwaresecuritymodules.models.SkuName; -import org.junit.jupiter.api.Assertions; - -public final class SkuTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - Sku model = BinaryData.fromString("{\"name\":\"payShield10K_LMK1_CPS250\"}").toObject(Sku.class); - Assertions.assertEquals(SkuName.PAY_SHIELD10K_LMK1_CPS250, model.name()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - Sku model = new Sku().withName(SkuName.PAY_SHIELD10K_LMK1_CPS250); - model = BinaryData.fromObject(model).toObject(Sku.class); - Assertions.assertEquals(SkuName.PAY_SHIELD10K_LMK1_CPS250, model.name()); - } -}