diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 43ae4afcb6a7..5c572cf1a7d9 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -473,6 +473,7 @@ com.azure.resourcemanager:azure-resourcemanager-databasewatcher;1.0.0-beta.1;1.0 com.azure.resourcemanager:azure-resourcemanager-durabletask;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-arizeaiobservabilityeval;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-weightsandbiases;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-keyvault-generated;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0;1.1.0-beta.1 com.azure.v2:azure-client-sdk-parent;2.0.0-beta.1;2.0.0-beta.1 diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/CHANGELOG.md b/sdk/keyvault/azure-resourcemanager-keyvault-generated/CHANGELOG.md new file mode 100644 index 000000000000..182615262b05 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0-beta.1 (2025-04-09) + +- Azure Resource Manager keyvault client library for Java. This package contains Microsoft Azure SDK for keyvault Management SDK. The Azure management API provides a RESTful set of web services that interact with Azure Key Vault. Package tag package-2024-11-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +### Features Added + +- Initial release for the azure-resourcemanager-keyvault-generated Java SDK. diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/README.md b/sdk/keyvault/azure-resourcemanager-keyvault-generated/README.md new file mode 100644 index 000000000000..5dc9c2ea0d5f --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager keyvault client library for Java + +Azure Resource Manager keyvault client library for Java. + +This package contains Microsoft Azure SDK for keyvault Management SDK. The Azure management API provides a RESTful set of web services that interact with Azure Key Vault. Package tag package-2024-11-01. 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 + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-keyvault-generated;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-keyvault-generated + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. + +### Authentication + +Microsoft Entra ID token authentication relies on the [credential class][azure_identity_credentials] from [Azure Identity][azure_identity] package. + +Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. + +Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code: + +```java +AzureProfile profile = new AzureProfile(AzureCloud.AZURE_PUBLIC_CLOUD); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +KeyvaultManager manager = KeyvaultManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change the `AzureCloud.AZURE_PUBLIC_CLOUD` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/keyvault/azure-resourcemanager-keyvault-generated/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide][cg]. + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact with any additional questions or comments. + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/identity/azure-identity#credentials +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md +[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/keyvault/azure-resourcemanager-keyvault-generated/SAMPLE.md b/sdk/keyvault/azure-resourcemanager-keyvault-generated/SAMPLE.md new file mode 100644 index 000000000000..d3b348d65c34 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/SAMPLE.md @@ -0,0 +1,958 @@ +# Code snippets and samples + + +## ManagedHsms + +- [CheckMhsmNameAvailability](#managedhsms_checkmhsmnameavailability) +- [CreateOrUpdate](#managedhsms_createorupdate) +- [Delete](#managedhsms_delete) +- [GetByResourceGroup](#managedhsms_getbyresourcegroup) +- [GetDeleted](#managedhsms_getdeleted) +- [List](#managedhsms_list) +- [ListByResourceGroup](#managedhsms_listbyresourcegroup) +- [ListBySubscription](#managedhsms_listbysubscription) +- [PurgeDeleted](#managedhsms_purgedeleted) +- [Update](#managedhsms_update) + +## MhsmPrivateEndpointConnections + +- [Delete](#mhsmprivateendpointconnections_delete) +- [Get](#mhsmprivateendpointconnections_get) +- [ListByResource](#mhsmprivateendpointconnections_listbyresource) +- [Put](#mhsmprivateendpointconnections_put) + +## MhsmPrivateLinkResources + +- [ListByMhsmResource](#mhsmprivatelinkresources_listbymhsmresource) + +## MhsmRegions + +- [ListByResource](#mhsmregions_listbyresource) + +## PrivateEndpointConnections + +- [Delete](#privateendpointconnections_delete) +- [Get](#privateendpointconnections_get) +- [ListByResource](#privateendpointconnections_listbyresource) +- [Put](#privateendpointconnections_put) + +## PrivateLinkResources + +- [ListByVault](#privatelinkresources_listbyvault) + +## Secrets + +- [CreateOrUpdate](#secrets_createorupdate) +- [Get](#secrets_get) +- [List](#secrets_list) +- [Update](#secrets_update) + +## Vaults + +- [CheckNameAvailability](#vaults_checknameavailability) +- [CreateOrUpdate](#vaults_createorupdate) +- [Delete](#vaults_delete) +- [GetByResourceGroup](#vaults_getbyresourcegroup) +- [GetDeleted](#vaults_getdeleted) +- [List](#vaults_list) +- [ListByResourceGroup](#vaults_listbyresourcegroup) +- [ListBySubscription](#vaults_listbysubscription) +- [PurgeDeleted](#vaults_purgedeleted) +- [Update](#vaults_update) +- [UpdateAccessPolicy](#vaults_updateaccesspolicy) +### ManagedHsms_CheckMhsmNameAvailability + +```java + +/** + * Samples for ManagedHsms CheckMhsmNameAvailability. + */ +public final class ManagedHsmsCheckMhsmNameAvailabilitySamples { + /* + * x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/ + * ManagedHsm_checkMhsmNameAvailability.json + */ + /** + * Sample code: Validate a managed hsm name. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void validateAManagedHsmName(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.managedHsms().checkMhsmNameAvailabilityWithResponse(null, com.azure.core.util.Context.NONE); + } +} +``` + +### ManagedHsms_CreateOrUpdate + +```java +/** + * Samples for ManagedHsms CreateOrUpdate. + */ +public final class ManagedHsmsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/ManagedHsm_CreateOrUpdate. + * json + */ + /** + * Sample code: Create a new managed HSM Pool or update an existing managed HSM Pool. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void createANewManagedHSMPoolOrUpdateAnExistingManagedHSMPool( + com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.managedHsms().define("hsm1").withRegion((String) null).withExistingResourceGroup("hsm-group").create(); + } +} +``` + +### ManagedHsms_Delete + +```java +/** + * Samples for ManagedHsms Delete. + */ +public final class ManagedHsmsDeleteSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/ManagedHsm_Delete.json + */ + /** + * Sample code: Delete a managed HSM Pool. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void deleteAManagedHSMPool(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.managedHsms().delete("hsm-group", "hsm1", com.azure.core.util.Context.NONE); + } +} +``` + +### ManagedHsms_GetByResourceGroup + +```java +/** + * Samples for ManagedHsms GetByResourceGroup. + */ +public final class ManagedHsmsGetByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/ManagedHsm_Get.json + */ + /** + * Sample code: Retrieve a managed HSM Pool. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void retrieveAManagedHSMPool(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.managedHsms().getByResourceGroupWithResponse("hsm-group", "hsm1", com.azure.core.util.Context.NONE); + } +} +``` + +### ManagedHsms_GetDeleted + +```java +/** + * Samples for ManagedHsms GetDeleted. + */ +public final class ManagedHsmsGetDeletedSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/DeletedManagedHsm_Get.json + */ + /** + * Sample code: Retrieve a deleted managed HSM. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void + retrieveADeletedManagedHSM(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.managedHsms().getDeletedWithResponse("westus", "hsm1", com.azure.core.util.Context.NONE); + } +} +``` + +### ManagedHsms_List + +```java +/** + * Samples for ManagedHsms List. + */ +public final class ManagedHsmsListSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/DeletedManagedHsm_List.json + */ + /** + * Sample code: List deleted managed HSMs in the specified subscription. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void listDeletedManagedHSMsInTheSpecifiedSubscription( + com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.managedHsms().list(com.azure.core.util.Context.NONE); + } +} +``` + +### ManagedHsms_ListByResourceGroup + +```java +/** + * Samples for ManagedHsms ListByResourceGroup. + */ +public final class ManagedHsmsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/ + * ManagedHsm_ListByResourceGroup.json + */ + /** + * Sample code: List managed HSM Pools in a resource group. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void + listManagedHSMPoolsInAResourceGroup(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.managedHsms().listByResourceGroup("hsm-group", null, com.azure.core.util.Context.NONE); + } +} +``` + +### ManagedHsms_ListBySubscription + +```java +/** + * Samples for ManagedHsms ListBySubscription. + */ +public final class ManagedHsmsListBySubscriptionSamples { + /* + * x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/ + * ManagedHsm_ListBySubscription.json + */ + /** + * Sample code: List managed HSM Pools in a subscription. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void + listManagedHSMPoolsInASubscription(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.managedHsms().listBySubscription(null, com.azure.core.util.Context.NONE); + } +} +``` + +### ManagedHsms_PurgeDeleted + +```java +/** + * Samples for ManagedHsms PurgeDeleted. + */ +public final class ManagedHsmsPurgeDeletedSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/DeletedManagedHsm_Purge. + * json + */ + /** + * Sample code: Purge a managed HSM Pool. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void purgeAManagedHSMPool(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.managedHsms().purgeDeleted("westus", "hsm1", com.azure.core.util.Context.NONE); + } +} +``` + +### ManagedHsms_Update + +```java +import com.azure.resourcemanager.keyvault.generated.models.ManagedHsm; + +/** + * Samples for ManagedHsms Update. + */ +public final class ManagedHsmsUpdateSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/ManagedHsm_Update.json + */ + /** + * Sample code: Update an existing managed HSM Pool. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void + updateAnExistingManagedHSMPool(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + ManagedHsm resource = manager.managedHsms() + .getByResourceGroupWithResponse("hsm-group", "hsm1", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().apply(); + } +} +``` + +### MhsmPrivateEndpointConnections_Delete + +```java +/** + * Samples for MhsmPrivateEndpointConnections Delete. + */ +public final class MhsmPrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/ + * ManagedHsm_deletePrivateEndpointConnection.json + */ + /** + * Sample code: ManagedHsmDeletePrivateEndpointConnection. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void managedHsmDeletePrivateEndpointConnection( + com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.mhsmPrivateEndpointConnections() + .delete("sample-group", "sample-mhsm", "sample-pec", com.azure.core.util.Context.NONE); + } +} +``` + +### MhsmPrivateEndpointConnections_Get + +```java +/** + * Samples for MhsmPrivateEndpointConnections Get. + */ +public final class MhsmPrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/ + * ManagedHsm_getPrivateEndpointConnection.json + */ + /** + * Sample code: ManagedHsmGetPrivateEndpointConnection. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void + managedHsmGetPrivateEndpointConnection(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.mhsmPrivateEndpointConnections() + .getWithResponse("sample-group", "sample-mhsm", "sample-pec", com.azure.core.util.Context.NONE); + } +} +``` + +### MhsmPrivateEndpointConnections_ListByResource + +```java +/** + * Samples for MhsmPrivateEndpointConnections ListByResource. + */ +public final class MhsmPrivateEndpointConnectionsListByResourceSamples { + /* + * x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/ + * ManagedHsm_ListPrivateEndpointConnectionsByResource.json + */ + /** + * Sample code: List managed HSM Pools in a subscription. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void + listManagedHSMPoolsInASubscription(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.mhsmPrivateEndpointConnections() + .listByResource("sample-group", "sample-mhsm", com.azure.core.util.Context.NONE); + } +} +``` + +### MhsmPrivateEndpointConnections_Put + +```java +/** + * Samples for MhsmPrivateEndpointConnections Put. + */ +public final class MhsmPrivateEndpointConnectionsPutSamples { + /* + * x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/ + * ManagedHsm_putPrivateEndpointConnection.json + */ + /** + * Sample code: ManagedHsmPutPrivateEndpointConnection. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void + managedHsmPutPrivateEndpointConnection(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.mhsmPrivateEndpointConnections() + .define("sample-pec") + .withRegion((String) null) + .withExistingManagedHSM("sample-group", "sample-mhsm") + .create(); + } +} +``` + +### MhsmPrivateLinkResources_ListByMhsmResource + +```java +/** + * Samples for MhsmPrivateLinkResources ListByMhsmResource. + */ +public final class MhsmPrivateLinkResourcesListByMhsmResourceSamples { + /* + * x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/ + * ManagedHsm_listPrivateLinkResources.json + */ + /** + * Sample code: KeyVaultListPrivateLinkResources. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void + keyVaultListPrivateLinkResources(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.mhsmPrivateLinkResources() + .listByMhsmResourceWithResponse("sample-group", "sample-mhsm", com.azure.core.util.Context.NONE); + } +} +``` + +### MhsmRegions_ListByResource + +```java +/** + * Samples for MhsmRegions ListByResource. + */ +public final class MhsmRegionsListByResourceSamples { + /* + * x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/ + * ManagedHsm_ListRegionsByResource.json + */ + /** + * Sample code: List managed HSM Pools in a subscription. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void + listManagedHSMPoolsInASubscription(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.mhsmRegions().listByResource("sample-group", "sample-mhsm", com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateEndpointConnections_Delete + +```java +/** + * Samples for PrivateEndpointConnections Delete. + */ +public final class PrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/ + * deletePrivateEndpointConnection.json + */ + /** + * Sample code: KeyVaultDeletePrivateEndpointConnection. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void + keyVaultDeletePrivateEndpointConnection(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.privateEndpointConnections() + .delete("sample-group", "sample-vault", "sample-pec", com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateEndpointConnections_Get + +```java +/** + * Samples for PrivateEndpointConnections Get. + */ +public final class PrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/ + * getPrivateEndpointConnection.json + */ + /** + * Sample code: KeyVaultGetPrivateEndpointConnection. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void + keyVaultGetPrivateEndpointConnection(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.privateEndpointConnections() + .getWithResponse("sample-group", "sample-vault", "sample-pec", com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateEndpointConnections_ListByResource + +```java +/** + * Samples for PrivateEndpointConnections ListByResource. + */ +public final class PrivateEndpointConnectionsListByResourceSamples { + /* + * x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/ + * listPrivateEndpointConnection.json + */ + /** + * Sample code: KeyVaultListPrivateEndpointConnection. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void + keyVaultListPrivateEndpointConnection(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.privateEndpointConnections() + .listByResource("sample-group", "sample-vault", com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateEndpointConnections_Put + +```java +/** + * Samples for PrivateEndpointConnections Put. + */ +public final class PrivateEndpointConnectionsPutSamples { + /* + * x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/ + * putPrivateEndpointConnection.json + */ + /** + * Sample code: KeyVaultPutPrivateEndpointConnection. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void + keyVaultPutPrivateEndpointConnection(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.privateEndpointConnections() + .define("sample-pec") + .withRegion((String) null) + .withExistingVault("sample-group", "sample-vault") + .create(); + } +} +``` + +### PrivateLinkResources_ListByVault + +```java +/** + * Samples for PrivateLinkResources ListByVault. + */ +public final class PrivateLinkResourcesListByVaultSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/listPrivateLinkResources. + * json + */ + /** + * Sample code: KeyVaultListPrivateLinkResources. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void + keyVaultListPrivateLinkResources(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.privateLinkResources() + .listByVaultWithResponse("sample-group", "sample-vault", com.azure.core.util.Context.NONE); + } +} +``` + +### Secrets_CreateOrUpdate + +```java +/** + * Samples for Secrets CreateOrUpdate. + */ +public final class SecretsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/createSecret.json + */ + /** + * Sample code: Create a secret. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void createASecret(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.secrets() + .define("secret-name") + .withRegion((String) null) + .withExistingVault("sample-group", "sample-vault") + .create(); + } +} +``` + +### Secrets_Get + +```java +/** + * Samples for Secrets Get. + */ +public final class SecretsGetSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/getSecret.json + */ + /** + * Sample code: Get a secret. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void getASecret(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.secrets() + .getWithResponse("sample-group", "sample-vault", "secret-name", com.azure.core.util.Context.NONE); + } +} +``` + +### Secrets_List + +```java +/** + * Samples for Secrets List. + */ +public final class SecretsListSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/listSecrets.json + */ + /** + * Sample code: List secrets in the vault. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void listSecretsInTheVault(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.secrets().list("sample-group", "sample-vault", null, com.azure.core.util.Context.NONE); + } +} +``` + +### Secrets_Update + +```java +import com.azure.resourcemanager.keyvault.generated.models.Secret; + +/** + * Samples for Secrets Update. + */ +public final class SecretsUpdateSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/updateSecret.json + */ + /** + * Sample code: Update a secret. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void updateASecret(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + Secret resource = manager.secrets() + .getWithResponse("sample-group", "sample-vault", "secret-name", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().apply(); + } +} +``` + +### Vaults_CheckNameAvailability + +```java + +/** + * Samples for Vaults CheckNameAvailability. + */ +public final class VaultsCheckNameAvailabilitySamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/checkVaultNameAvailability. + * json + */ + /** + * Sample code: Validate a vault name. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void validateAVaultName(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.vaults().checkNameAvailabilityWithResponse(null, com.azure.core.util.Context.NONE); + } +} +``` + +### Vaults_CreateOrUpdate + +```java +import com.azure.resourcemanager.keyvault.generated.models.Sku; +import java.util.UUID; + +/** + * Samples for Vaults CreateOrUpdate. + */ +public final class VaultsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/createVaultWithNetworkAcls. + * json + */ + /** + * Sample code: Create or update a vault with network acls. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void + createOrUpdateAVaultWithNetworkAcls(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.vaults() + .define("sample-vault") + .withRegion((String) null) + .withExistingResourceGroup("sample-resource-group") + .withTenantId((UUID) null) + .withSku((Sku) null) + .create(); + } + + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/createVault.json + */ + /** + * Sample code: Create a new vault or update an existing vault. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void + createANewVaultOrUpdateAnExistingVault(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.vaults() + .define("sample-vault") + .withRegion((String) null) + .withExistingResourceGroup("sample-resource-group") + .withTenantId((UUID) null) + .withSku((Sku) null) + .create(); + } +} +``` + +### Vaults_Delete + +```java +/** + * Samples for Vaults Delete. + */ +public final class VaultsDeleteSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/deleteVault.json + */ + /** + * Sample code: Delete a vault. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void deleteAVault(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.vaults() + .deleteByResourceGroupWithResponse("sample-resource-group", "sample-vault", + com.azure.core.util.Context.NONE); + } +} +``` + +### Vaults_GetByResourceGroup + +```java +/** + * Samples for Vaults GetByResourceGroup. + */ +public final class VaultsGetByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/getVault.json + */ + /** + * Sample code: Retrieve a vault. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void retrieveAVault(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.vaults() + .getByResourceGroupWithResponse("sample-resource-group", "sample-vault", com.azure.core.util.Context.NONE); + } +} +``` + +### Vaults_GetDeleted + +```java +/** + * Samples for Vaults GetDeleted. + */ +public final class VaultsGetDeletedSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/getDeletedVault.json + */ + /** + * Sample code: Retrieve a deleted vault. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void retrieveADeletedVault(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.vaults().getDeletedWithResponse("westus", "sample-vault", com.azure.core.util.Context.NONE); + } +} +``` + +### Vaults_List + +```java +/** + * Samples for Vaults List. + */ +public final class VaultsListSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/listDeletedVaults.json + */ + /** + * Sample code: List deleted vaults in the specified subscription. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void listDeletedVaultsInTheSpecifiedSubscription( + com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.vaults().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Vaults_ListByResourceGroup + +```java +/** + * Samples for Vaults ListByResourceGroup. + */ +public final class VaultsListByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/listVaultByResourceGroup. + * json + */ + /** + * Sample code: List vaults in the specified resource group. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void + listVaultsInTheSpecifiedResourceGroup(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.vaults().listByResourceGroup("sample-group", 1, com.azure.core.util.Context.NONE); + } +} +``` + +### Vaults_ListBySubscription + +```java +/** + * Samples for Vaults ListBySubscription. + */ +public final class VaultsListBySubscriptionSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/listVaultBySubscription. + * json + */ + /** + * Sample code: List vaults in the specified subscription. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void + listVaultsInTheSpecifiedSubscription(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.vaults().listBySubscription(1, com.azure.core.util.Context.NONE); + } +} +``` + +### Vaults_PurgeDeleted + +```java +/** + * Samples for Vaults PurgeDeleted. + */ +public final class VaultsPurgeDeletedSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/purgeDeletedVault.json + */ + /** + * Sample code: Purge a deleted vault. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void purgeADeletedVault(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.vaults().purgeDeleted("westus", "sample-vault", com.azure.core.util.Context.NONE); + } +} +``` + +### Vaults_Update + +```java +import com.azure.resourcemanager.keyvault.generated.models.Vault; + +/** + * Samples for Vaults Update. + */ +public final class VaultsUpdateSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/updateVault.json + */ + /** + * Sample code: Update an existing vault. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void updateAnExistingVault(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + Vault resource = manager.vaults() + .getByResourceGroupWithResponse("sample-resource-group", "sample-vault", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().apply(); + } +} +``` + +### Vaults_UpdateAccessPolicy + +```java +import com.azure.resourcemanager.keyvault.generated.models.AccessPolicyUpdateKind; + +/** + * Samples for Vaults UpdateAccessPolicy. + */ +public final class VaultsUpdateAccessPolicySamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/updateAccessPoliciesAdd. + * json + */ + /** + * Sample code: Add an access policy, or update an access policy with new permissions. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void addAnAccessPolicyOrUpdateAnAccessPolicyWithNewPermissions( + com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.vaults() + .updateAccessPolicyWithResponse("sample-group", "sample-vault", AccessPolicyUpdateKind.ADD, null, + com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/pom.xml b/sdk/keyvault/azure-resourcemanager-keyvault-generated/pom.xml new file mode 100644 index 000000000000..29ac232d3783 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/pom.xml @@ -0,0 +1,63 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-keyvault-generated + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for keyvault Management + This package contains Microsoft Azure SDK for keyvault 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 Key Vault. Package tag package-2024-11-01. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + 0 + 0 + true + false + + + + com.azure + azure-core + 1.55.3 + + + com.azure + azure-core-management + 1.17.0 + + + diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/KeyvaultManager.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/KeyvaultManager.java new file mode 100644 index 000000000000..2caf2e22f1ce --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/KeyvaultManager.java @@ -0,0 +1,413 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +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.keyvault.generated.fluent.AzureStorageResourceManagementApi; +import com.azure.resourcemanager.keyvault.generated.implementation.AzureStorageResourceManagementApiBuilder; +import com.azure.resourcemanager.keyvault.generated.implementation.ManagedHsmsImpl; +import com.azure.resourcemanager.keyvault.generated.implementation.MhsmPrivateEndpointConnectionsImpl; +import com.azure.resourcemanager.keyvault.generated.implementation.MhsmPrivateLinkResourcesImpl; +import com.azure.resourcemanager.keyvault.generated.implementation.MhsmRegionsImpl; +import com.azure.resourcemanager.keyvault.generated.implementation.OperationsImpl; +import com.azure.resourcemanager.keyvault.generated.implementation.PrivateEndpointConnectionsImpl; +import com.azure.resourcemanager.keyvault.generated.implementation.PrivateLinkResourcesImpl; +import com.azure.resourcemanager.keyvault.generated.implementation.SecretsImpl; +import com.azure.resourcemanager.keyvault.generated.implementation.VaultsImpl; +import com.azure.resourcemanager.keyvault.generated.models.ManagedHsms; +import com.azure.resourcemanager.keyvault.generated.models.MhsmPrivateEndpointConnections; +import com.azure.resourcemanager.keyvault.generated.models.MhsmPrivateLinkResources; +import com.azure.resourcemanager.keyvault.generated.models.MhsmRegions; +import com.azure.resourcemanager.keyvault.generated.models.Operations; +import com.azure.resourcemanager.keyvault.generated.models.PrivateEndpointConnections; +import com.azure.resourcemanager.keyvault.generated.models.PrivateLinkResources; +import com.azure.resourcemanager.keyvault.generated.models.Secrets; +import com.azure.resourcemanager.keyvault.generated.models.Vaults; +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; + +/** + * Entry point to KeyvaultManager. + * The Azure management API provides a RESTful set of web services that interact with Azure Key Vault. + */ +public final class KeyvaultManager { + private Operations operations; + + private ManagedHsms managedHsms; + + private Vaults vaults; + + private MhsmPrivateEndpointConnections mhsmPrivateEndpointConnections; + + private MhsmPrivateLinkResources mhsmPrivateLinkResources; + + private MhsmRegions mhsmRegions; + + private PrivateEndpointConnections privateEndpointConnections; + + private PrivateLinkResources privateLinkResources; + + private Secrets secrets; + + private final AzureStorageResourceManagementApi clientObject; + + private KeyvaultManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new AzureStorageResourceManagementApiBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of keyvault service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the keyvault service API instance. + */ + public static KeyvaultManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Creates an instance of keyvault service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the keyvault service API instance. + */ + public static KeyvaultManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new KeyvaultManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create KeyvaultManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new KeyvaultManager.Configurable(); + } + + /** + * The Configurable allowing configurations to be set. + */ + 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-keyvault-generated.properties"); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + *

+ * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval + = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of keyvault service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the keyvault service API instance. + */ + public KeyvaultManager authenticate(TokenCredential credential, AzureProfile profile) { + 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.keyvault.generated") + .append("/") + .append(clientVersion); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder.append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new KeyvaultManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * 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 the resource collection API of ManagedHsms. It manages ManagedHsm. + * + * @return Resource collection API of ManagedHsms. + */ + public ManagedHsms managedHsms() { + if (this.managedHsms == null) { + this.managedHsms = new ManagedHsmsImpl(clientObject.getManagedHsms(), this); + } + return managedHsms; + } + + /** + * Gets the resource collection API of Vaults. It manages Vault. + * + * @return Resource collection API of Vaults. + */ + public Vaults vaults() { + if (this.vaults == null) { + this.vaults = new VaultsImpl(clientObject.getVaults(), this); + } + return vaults; + } + + /** + * Gets the resource collection API of MhsmPrivateEndpointConnections. It manages MhsmPrivateEndpointConnection. + * + * @return Resource collection API of MhsmPrivateEndpointConnections. + */ + public MhsmPrivateEndpointConnections mhsmPrivateEndpointConnections() { + if (this.mhsmPrivateEndpointConnections == null) { + this.mhsmPrivateEndpointConnections + = new MhsmPrivateEndpointConnectionsImpl(clientObject.getMhsmPrivateEndpointConnections(), this); + } + return mhsmPrivateEndpointConnections; + } + + /** + * Gets the resource collection API of MhsmPrivateLinkResources. + * + * @return Resource collection API of MhsmPrivateLinkResources. + */ + public MhsmPrivateLinkResources mhsmPrivateLinkResources() { + if (this.mhsmPrivateLinkResources == null) { + this.mhsmPrivateLinkResources + = new MhsmPrivateLinkResourcesImpl(clientObject.getMhsmPrivateLinkResources(), this); + } + return mhsmPrivateLinkResources; + } + + /** + * Gets the resource collection API of MhsmRegions. + * + * @return Resource collection API of MhsmRegions. + */ + public MhsmRegions mhsmRegions() { + if (this.mhsmRegions == null) { + this.mhsmRegions = new MhsmRegionsImpl(clientObject.getMhsmRegions(), this); + } + return mhsmRegions; + } + + /** + * Gets the resource collection API of PrivateEndpointConnections. It manages PrivateEndpointConnection. + * + * @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 PrivateLinkResources. + * + * @return Resource collection API of PrivateLinkResources. + */ + public PrivateLinkResources privateLinkResources() { + if (this.privateLinkResources == null) { + this.privateLinkResources = new PrivateLinkResourcesImpl(clientObject.getPrivateLinkResources(), this); + } + return privateLinkResources; + } + + /** + * Gets the resource collection API of Secrets. It manages Secret. + * + * @return Resource collection API of Secrets. + */ + public Secrets secrets() { + if (this.secrets == null) { + this.secrets = new SecretsImpl(clientObject.getSecrets(), this); + } + return secrets; + } + + /** + * Gets wrapped service client AzureStorageResourceManagementApi providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + * + * @return Wrapped service client AzureStorageResourceManagementApi. + */ + public AzureStorageResourceManagementApi serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/AzureStorageResourceManagementApi.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/AzureStorageResourceManagementApi.java new file mode 100644 index 000000000000..9ba8a39e4797 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/AzureStorageResourceManagementApi.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for AzureStorageResourceManagementApi class. + */ +public interface AzureStorageResourceManagementApi { + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the ManagedHsmsClient object to access its operations. + * + * @return the ManagedHsmsClient object. + */ + ManagedHsmsClient getManagedHsms(); + + /** + * Gets the VaultsClient object to access its operations. + * + * @return the VaultsClient object. + */ + VaultsClient getVaults(); + + /** + * Gets the MhsmPrivateEndpointConnectionsClient object to access its operations. + * + * @return the MhsmPrivateEndpointConnectionsClient object. + */ + MhsmPrivateEndpointConnectionsClient getMhsmPrivateEndpointConnections(); + + /** + * Gets the MhsmPrivateLinkResourcesClient object to access its operations. + * + * @return the MhsmPrivateLinkResourcesClient object. + */ + MhsmPrivateLinkResourcesClient getMhsmPrivateLinkResources(); + + /** + * Gets the MhsmRegionsClient object to access its operations. + * + * @return the MhsmRegionsClient object. + */ + MhsmRegionsClient getMhsmRegions(); + + /** + * Gets the PrivateEndpointConnectionsClient object to access its operations. + * + * @return the PrivateEndpointConnectionsClient object. + */ + PrivateEndpointConnectionsClient getPrivateEndpointConnections(); + + /** + * Gets the PrivateLinkResourcesClient object to access its operations. + * + * @return the PrivateLinkResourcesClient object. + */ + PrivateLinkResourcesClient getPrivateLinkResources(); + + /** + * Gets the SecretsClient object to access its operations. + * + * @return the SecretsClient object. + */ + SecretsClient getSecrets(); +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/ManagedHsmsClient.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/ManagedHsmsClient.java new file mode 100644 index 000000000000..8bffcc2db157 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/ManagedHsmsClient.java @@ -0,0 +1,399 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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.keyvault.generated.fluent.models.CheckMhsmNameAvailabilityResultInner; +import com.azure.resourcemanager.keyvault.generated.fluent.models.DeletedManagedHsmInner; +import com.azure.resourcemanager.keyvault.generated.fluent.models.ManagedHsmInner; +import com.azure.resourcemanager.keyvault.generated.models.CheckMhsmNameAvailabilityParameters; + +/** + * An instance of this class provides access to all the operations defined in ManagedHsmsClient. + */ +public interface ManagedHsmsClient { + /** + * Checks that the managed hsm name is valid and is not already in use. + * + * @param body The request body. + * @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 CheckMhsmNameAvailability operation response along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response + checkMhsmNameAvailabilityWithResponse(CheckMhsmNameAvailabilityParameters body, Context context); + + /** + * Checks that the managed hsm name is valid and is not already in use. + * + * @param body The request body. + * @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 CheckMhsmNameAvailability operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CheckMhsmNameAvailabilityResultInner checkMhsmNameAvailability(CheckMhsmNameAvailabilityParameters body); + + /** + * The List operation gets information about the deleted managed HSMs 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 the response of a DeletedManagedHsm list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * The List operation gets information about the deleted managed HSMs associated with the subscription. + * + * @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 response of a DeletedManagedHsm list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Gets the specified deleted managed HSM. + * + * @param location The name of the Azure region. + * @param name The name of the deleted managed HSM. + * @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 deleted managed HSM along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getDeletedWithResponse(String location, String name, Context context); + + /** + * Gets the specified deleted managed HSM. + * + * @param location The name of the Azure region. + * @param name The name of the deleted managed HSM. + * @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 deleted managed HSM. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeletedManagedHsmInner getDeleted(String location, String name); + + /** + * Permanently deletes the specified managed HSM. + * + * @param location The name of the Azure region. + * @param name The name of the deleted managed HSM. + * @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> beginPurgeDeleted(String location, String name); + + /** + * Permanently deletes the specified managed HSM. + * + * @param location The name of the Azure region. + * @param name The name of the deleted managed HSM. + * @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> beginPurgeDeleted(String location, String name, Context context); + + /** + * Permanently deletes the specified managed HSM. + * + * @param location The name of the Azure region. + * @param name The name of the deleted managed HSM. + * @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 purgeDeleted(String location, String name); + + /** + * Permanently deletes the specified managed HSM. + * + * @param location The name of the Azure region. + * @param name The name of the deleted managed HSM. + * @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 purgeDeleted(String location, String name, Context context); + + /** + * The List operation gets information about the managed HSM Pools 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 the response of a ManagedHsm list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySubscription(); + + /** + * The List operation gets information about the managed HSM Pools associated with the subscription. + * + * @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. + * @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 response of a ManagedHsm list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySubscription(Integer top, Context context); + + /** + * The List operation gets information about the managed HSM Pools 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 the response of a ManagedHsm list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * The List operation gets information about the managed HSM Pools associated with the subscription and within the + * specified resource group. + * + * @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. + * @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 response of a ManagedHsm list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Integer top, Context context); + + /** + * Gets the specified managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 managed HSM Pool along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String name, Context context); + + /** + * Gets the specified managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 managed HSM Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedHsmInner getByResourceGroup(String resourceGroupName, String name); + + /** + * Create or update a managed HSM Pool in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param resource Parameters to create or update the managed HSM Pool. + * @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, ManagedHsmInner> beginCreateOrUpdate(String resourceGroupName, String name, + ManagedHsmInner resource); + + /** + * Create or update a managed HSM Pool in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param resource Parameters to create or update the managed HSM Pool. + * @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, ManagedHsmInner> beginCreateOrUpdate(String resourceGroupName, String name, + ManagedHsmInner resource, Context context); + + /** + * Create or update a managed HSM Pool in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param resource Parameters to create or update the managed HSM Pool. + * @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) + ManagedHsmInner createOrUpdate(String resourceGroupName, String name, ManagedHsmInner resource); + + /** + * Create or update a managed HSM Pool in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param resource Parameters to create or update the managed HSM Pool. + * @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) + ManagedHsmInner createOrUpdate(String resourceGroupName, String name, ManagedHsmInner resource, Context context); + + /** + * Update a managed HSM Pool in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param properties Parameters to patch the managed HSM Pool. + * @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, ManagedHsmInner> beginUpdate(String resourceGroupName, String name, + ManagedHsmInner properties); + + /** + * Update a managed HSM Pool in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param properties Parameters to patch the managed HSM Pool. + * @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, ManagedHsmInner> beginUpdate(String resourceGroupName, String name, + ManagedHsmInner properties, Context context); + + /** + * Update a managed HSM Pool in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param properties Parameters to patch the managed HSM Pool. + * @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) + ManagedHsmInner update(String resourceGroupName, String name, ManagedHsmInner properties); + + /** + * Update a managed HSM Pool in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param properties Parameters to patch the managed HSM Pool. + * @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) + ManagedHsmInner update(String resourceGroupName, String name, ManagedHsmInner properties, Context context); + + /** + * Deletes the specified managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 name); + + /** + * Deletes the specified managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 name, Context context); + + /** + * Deletes the specified managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 name); + + /** + * Deletes the specified managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 name, Context context); +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/MhsmPrivateEndpointConnectionsClient.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/MhsmPrivateEndpointConnectionsClient.java new file mode 100644 index 000000000000..255e9917d5ba --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/MhsmPrivateEndpointConnectionsClient.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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.keyvault.generated.fluent.models.MhsmPrivateEndpointConnectionInner; + +/** + * An instance of this class provides access to all the operations defined in MhsmPrivateEndpointConnectionsClient. + */ +public interface MhsmPrivateEndpointConnectionsClient { + /** + * The List operation gets information about the private endpoint connections associated with the managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 response of a MhsmPrivateEndpointConnection list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResource(String resourceGroupName, String name); + + /** + * The List operation gets information about the private endpoint connections associated with the managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 response of a MhsmPrivateEndpointConnection list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResource(String resourceGroupName, String name, + Context context); + + /** + * Gets the specified private endpoint connection associated with the managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the managed hsm + * pool. + * @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 private endpoint connection associated with the managed HSM Pool along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String name, + String privateEndpointConnectionName, Context context); + + /** + * Gets the specified private endpoint connection associated with the managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the managed hsm + * pool. + * @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 private endpoint connection associated with the managed HSM Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MhsmPrivateEndpointConnectionInner get(String resourceGroupName, String name, String privateEndpointConnectionName); + + /** + * Updates the specified private endpoint connection associated with the managed hsm pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the managed hsm + * pool. + * @param resource The intended state of private endpoint connection. + * @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 private endpoint connection resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response putWithResponse(String resourceGroupName, String name, + String privateEndpointConnectionName, MhsmPrivateEndpointConnectionInner resource, Context context); + + /** + * Updates the specified private endpoint connection associated with the managed hsm pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the managed hsm + * pool. + * @param resource The intended state of private endpoint connection. + * @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 private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MhsmPrivateEndpointConnectionInner put(String resourceGroupName, String name, String privateEndpointConnectionName, + MhsmPrivateEndpointConnectionInner resource); + + /** + * Deletes the specified private endpoint connection associated with the managed hsm pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the managed hsm + * pool. + * @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 private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, MhsmPrivateEndpointConnectionInner> + beginDelete(String resourceGroupName, String name, String privateEndpointConnectionName); + + /** + * Deletes the specified private endpoint connection associated with the managed hsm pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the managed hsm + * pool. + * @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 private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, MhsmPrivateEndpointConnectionInner> + beginDelete(String resourceGroupName, String name, String privateEndpointConnectionName, Context context); + + /** + * Deletes the specified private endpoint connection associated with the managed hsm pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the managed hsm + * pool. + * @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 private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MhsmPrivateEndpointConnectionInner delete(String resourceGroupName, String name, + String privateEndpointConnectionName); + + /** + * Deletes the specified private endpoint connection associated with the managed hsm pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the managed hsm + * pool. + * @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 private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MhsmPrivateEndpointConnectionInner delete(String resourceGroupName, String name, + String privateEndpointConnectionName, Context context); +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/MhsmPrivateLinkResourcesClient.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/MhsmPrivateLinkResourcesClient.java new file mode 100644 index 000000000000..4b654c49fa3e --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/MhsmPrivateLinkResourcesClient.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.keyvault.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.keyvault.generated.fluent.models.MhsmPrivateLinkResourceListResultInner; + +/** + * An instance of this class provides access to all the operations defined in MhsmPrivateLinkResourcesClient. + */ +public interface MhsmPrivateLinkResourcesClient { + /** + * Gets the private link resources supported for the managed hsm pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 managed hsm pool along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listByMhsmResourceWithResponse(String resourceGroupName, + String name, Context context); + + /** + * Gets the private link resources supported for the managed hsm pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 managed hsm pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MhsmPrivateLinkResourceListResultInner listByMhsmResource(String resourceGroupName, String name); +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/MhsmRegionsClient.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/MhsmRegionsClient.java new file mode 100644 index 000000000000..2ba97ce0273b --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/MhsmRegionsClient.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.keyvault.generated.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.keyvault.generated.fluent.models.MhsmGeoReplicatedRegionInner; + +/** + * An instance of this class provides access to all the operations defined in MhsmRegionsClient. + */ +public interface MhsmRegionsClient { + /** + * The List operation gets information about the regions associated with the managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 regions associated with a managed HSM Pools as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResource(String resourceGroupName, String name); + + /** + * The List operation gets information about the regions associated with the managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 regions associated with a managed HSM Pools as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResource(String resourceGroupName, String name, Context context); +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/OperationsClient.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/OperationsClient.java new file mode 100644 index 000000000000..4358c47f0b99 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/OperationsClient.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.keyvault.generated.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.keyvault.generated.fluent.models.OperationInner; + +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ +public interface OperationsClient { + /** + * List the operations for the provider. + * + * @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 REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List the operations for the provider. + * + * @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 a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/PrivateEndpointConnectionsClient.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/PrivateEndpointConnectionsClient.java new file mode 100644 index 000000000000..0f5768a95a11 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/PrivateEndpointConnectionsClient.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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.keyvault.generated.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 vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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 response of a PrivateEndpointConnection list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResource(String resourceGroupName, String vaultName); + + /** + * The List operation gets information about the private endpoint connections associated with the vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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 response of a PrivateEndpointConnection list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResource(String resourceGroupName, String vaultName, + Context context); + + /** + * Gets the specified private endpoint connection associated with the key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the key vault. + * @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 private endpoint connection associated with the key vault along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String vaultName, + String privateEndpointConnectionName, Context context); + + /** + * Gets the specified private endpoint connection associated with the key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the key vault. + * @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 private endpoint connection associated with the key vault. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner get(String resourceGroupName, String vaultName, + String privateEndpointConnectionName); + + /** + * Updates the specified private endpoint connection associated with the key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the key vault. + * @param resource The intended state of private endpoint connection. + * @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 private endpoint connection resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response putWithResponse(String resourceGroupName, String vaultName, + String privateEndpointConnectionName, PrivateEndpointConnectionInner resource, Context context); + + /** + * Updates the specified private endpoint connection associated with the key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the key vault. + * @param resource The intended state of private endpoint connection. + * @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 private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner put(String resourceGroupName, String vaultName, String privateEndpointConnectionName, + PrivateEndpointConnectionInner resource); + + /** + * Deletes the specified private endpoint connection associated with the key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the key vault. + * @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 private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PrivateEndpointConnectionInner> + beginDelete(String resourceGroupName, String vaultName, String privateEndpointConnectionName); + + /** + * Deletes the specified private endpoint connection associated with the key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the key vault. + * @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 private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PrivateEndpointConnectionInner> + beginDelete(String resourceGroupName, String vaultName, String privateEndpointConnectionName, Context context); + + /** + * Deletes the specified private endpoint connection associated with the key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the key vault. + * @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 private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner delete(String resourceGroupName, String vaultName, + String privateEndpointConnectionName); + + /** + * Deletes the specified private endpoint connection associated with the key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the key vault. + * @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 private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner delete(String resourceGroupName, String vaultName, + String privateEndpointConnectionName, Context context); +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/PrivateLinkResourcesClient.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/PrivateLinkResourcesClient.java new file mode 100644 index 000000000000..8ef76dce1f01 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/PrivateLinkResourcesClient.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.keyvault.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.keyvault.generated.fluent.models.PrivateLinkResourceListResultInner; + +/** + * An instance of this class provides access to all the operations defined in PrivateLinkResourcesClient. + */ +public interface PrivateLinkResourcesClient { + /** + * Gets the private link resources supported for the key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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 key vault along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listByVaultWithResponse(String resourceGroupName, String vaultName, + Context context); + + /** + * Gets the private link resources supported for the key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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 key vault. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateLinkResourceListResultInner listByVault(String resourceGroupName, String vaultName); +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/SecretsClient.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/SecretsClient.java new file mode 100644 index 000000000000..c0d980d13c24 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/SecretsClient.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.keyvault.generated.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.util.Context; +import com.azure.resourcemanager.keyvault.generated.fluent.models.SecretInner; +import com.azure.resourcemanager.keyvault.generated.models.SecretPatchParameters; + +/** + * An instance of this class provides access to all the operations defined in SecretsClient. + */ +public interface SecretsClient { + /** + * The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in + * ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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 response of a Secret list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String vaultName); + + /** + * The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in + * ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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. + * @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 response of a Secret list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String vaultName, Integer top, Context context); + + /** + * Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the + * data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param secretName The name of the secret. + * @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 secret along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String vaultName, String secretName, + Context context); + + /** + * Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the + * data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param secretName The name of the secret. + * @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 secret. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SecretInner get(String resourceGroupName, String vaultName, String secretName); + + /** + * Create or update a secret in a key vault in the specified subscription. NOTE: This API is intended for internal + * use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param secretName The name of the secret. + * @param resource Parameters to create or update the secret. + * @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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String resourceGroupName, String vaultName, String secretName, + SecretInner resource, Context context); + + /** + * Create or update a secret in a key vault in the specified subscription. NOTE: This API is intended for internal + * use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param secretName The name of the secret. + * @param resource Parameters to create or update the secret. + * @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) + SecretInner createOrUpdate(String resourceGroupName, String vaultName, String secretName, SecretInner resource); + + /** + * Update a secret in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. + * Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param secretName The name of the secret. + * @param properties Parameters to patch the secret. + * @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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String resourceGroupName, String vaultName, String secretName, + SecretPatchParameters properties, Context context); + + /** + * Update a secret in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. + * Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param secretName The name of the secret. + * @param properties Parameters to patch the secret. + * @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) + SecretInner update(String resourceGroupName, String vaultName, String secretName, SecretPatchParameters properties); +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/VaultsClient.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/VaultsClient.java new file mode 100644 index 000000000000..af10ad3330c2 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/VaultsClient.java @@ -0,0 +1,380 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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.keyvault.generated.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.keyvault.generated.fluent.models.DeletedVaultInner; +import com.azure.resourcemanager.keyvault.generated.fluent.models.VaultAccessPolicyParametersInner; +import com.azure.resourcemanager.keyvault.generated.fluent.models.VaultInner; +import com.azure.resourcemanager.keyvault.generated.models.AccessPolicyUpdateKind; +import com.azure.resourcemanager.keyvault.generated.models.VaultCheckNameAvailabilityParameters; +import com.azure.resourcemanager.keyvault.generated.models.VaultPatchParameters; +import com.azure.resourcemanager.keyvault.generated.models.VaultsUpdateAccessPolicyResponse; + +/** + * An instance of this class provides access to all the operations defined in VaultsClient. + */ +public interface VaultsClient { + /** + * Checks that the vault name is valid and is not already in use. + * + * @param body The request body. + * @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 CheckNameAvailability operation response along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response + checkNameAvailabilityWithResponse(VaultCheckNameAvailabilityParameters body, Context context); + + /** + * Checks that the vault name is valid and is not already in use. + * + * @param body The request body. + * @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 CheckNameAvailability operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CheckNameAvailabilityResultInner checkNameAvailability(VaultCheckNameAvailabilityParameters body); + + /** + * Gets information about the deleted vaults in a 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 information about the deleted vaults in a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets information about the deleted vaults in a subscription. + * + * @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 information about the deleted vaults in a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Gets the deleted Azure key vault. + * + * @param location The name of the Azure region. + * @param vaultName The name of the vault. + * @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 deleted Azure key vault along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getDeletedWithResponse(String location, String vaultName, Context context); + + /** + * Gets the deleted Azure key vault. + * + * @param location The name of the Azure region. + * @param vaultName The name of the vault. + * @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 deleted Azure key vault. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeletedVaultInner getDeleted(String location, String vaultName); + + /** + * Permanently deletes the specified vault. aka Purges the deleted Azure key vault. + * + * @param location The name of the Azure region. + * @param vaultName The name of the vault. + * @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> beginPurgeDeleted(String location, String vaultName); + + /** + * Permanently deletes the specified vault. aka Purges the deleted Azure key vault. + * + * @param location The name of the Azure region. + * @param vaultName The name of the vault. + * @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> beginPurgeDeleted(String location, String vaultName, Context context); + + /** + * Permanently deletes the specified vault. aka Purges the deleted Azure key vault. + * + * @param location The name of the Azure region. + * @param vaultName The name of the vault. + * @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 purgeDeleted(String location, String vaultName); + + /** + * Permanently deletes the specified vault. aka Purges the deleted Azure key vault. + * + * @param location The name of the Azure region. + * @param vaultName The name of the vault. + * @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 purgeDeleted(String location, String vaultName, Context context); + + /** + * The List operation gets information about the vaults 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 the response of a Vault list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySubscription(); + + /** + * The List operation gets information about the vaults associated with the subscription. + * + * @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. + * @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 response of a Vault list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySubscription(Integer top, Context context); + + /** + * The List operation gets information about the vaults 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 the response of a Vault list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * The List operation gets information about the vaults associated with the subscription and within the specified + * resource group. + * + * @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. + * @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 response of a Vault list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Integer top, Context context); + + /** + * Gets the specified Azure key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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 Azure key vault along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String vaultName, Context context); + + /** + * Gets the specified Azure key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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 Azure key vault. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VaultInner getByResourceGroup(String resourceGroupName, String vaultName); + + /** + * Create or update a key vault in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param resource Parameters to create or update the vault. + * @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, VaultInner> beginCreateOrUpdate(String resourceGroupName, String vaultName, + VaultInner resource); + + /** + * Create or update a key vault in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param resource Parameters to create or update the vault. + * @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, VaultInner> beginCreateOrUpdate(String resourceGroupName, String vaultName, + VaultInner resource, Context context); + + /** + * Create or update a key vault in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param resource Parameters to create or update the vault. + * @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) + VaultInner createOrUpdate(String resourceGroupName, String vaultName, VaultInner resource); + + /** + * Create or update a key vault in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param resource Parameters to create or update the vault. + * @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) + VaultInner createOrUpdate(String resourceGroupName, String vaultName, VaultInner resource, Context context); + + /** + * Update a key vault in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param properties Parameters to patch the vault. + * @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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String resourceGroupName, String vaultName, VaultPatchParameters properties, + Context context); + + /** + * Update a key vault in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param properties Parameters to patch the vault. + * @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) + VaultInner update(String resourceGroupName, String vaultName, VaultPatchParameters properties); + + /** + * Deletes the specified Azure key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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 Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String vaultName, Context context); + + /** + * Deletes the specified Azure key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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 vaultName); + + /** + * Update access policies in a key vault in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param operationKind Name of the operation. + * @param body Access policy to merge into the vault. + * @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 parameters for updating the access policy in a vault. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VaultsUpdateAccessPolicyResponse updateAccessPolicyWithResponse(String resourceGroupName, String vaultName, + AccessPolicyUpdateKind operationKind, VaultAccessPolicyParametersInner body, Context context); + + /** + * Update access policies in a key vault in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param operationKind Name of the operation. + * @param body Access policy to merge into the vault. + * @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 parameters for updating the access policy in a vault. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VaultAccessPolicyParametersInner updateAccessPolicy(String resourceGroupName, String vaultName, + AccessPolicyUpdateKind operationKind, VaultAccessPolicyParametersInner body); +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/CheckMhsmNameAvailabilityResultInner.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/CheckMhsmNameAvailabilityResultInner.java new file mode 100644 index 000000000000..ab83dd91ff49 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/CheckMhsmNameAvailabilityResultInner.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.fluent.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.keyvault.generated.models.Reason; +import java.io.IOException; + +/** + * The CheckMhsmNameAvailability operation response. + */ +@Immutable +public final class CheckMhsmNameAvailabilityResultInner + implements JsonSerializable { + /* + * A boolean value that indicates whether the name is available for you to use. If true, the name is available. If + * false, the name has already been taken or is invalid and cannot be used. + */ + private Boolean nameAvailable; + + /* + * The reason that a managed hsm name could not be used. The reason element is only returned if NameAvailable is + * false. + */ + private Reason reason; + + /* + * An error message explaining the Reason value in more detail. + */ + private String message; + + /** + * Creates an instance of CheckMhsmNameAvailabilityResultInner class. + */ + public CheckMhsmNameAvailabilityResultInner() { + } + + /** + * Get the nameAvailable property: A boolean value that indicates whether the name is available for you to use. If + * true, the name is available. If false, the name has already been taken or is invalid and cannot be used. + * + * @return the nameAvailable value. + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Get the reason property: The reason that a managed hsm name could not be used. The reason element is only + * returned if NameAvailable is false. + * + * @return the reason value. + */ + public Reason reason() { + return this.reason; + } + + /** + * Get the message property: An error message explaining the Reason value in more detail. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * 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 CheckMhsmNameAvailabilityResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CheckMhsmNameAvailabilityResultInner 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 CheckMhsmNameAvailabilityResultInner. + */ + public static CheckMhsmNameAvailabilityResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CheckMhsmNameAvailabilityResultInner deserializedCheckMhsmNameAvailabilityResultInner + = new CheckMhsmNameAvailabilityResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("nameAvailable".equals(fieldName)) { + deserializedCheckMhsmNameAvailabilityResultInner.nameAvailable + = reader.getNullable(JsonReader::getBoolean); + } else if ("reason".equals(fieldName)) { + deserializedCheckMhsmNameAvailabilityResultInner.reason = Reason.fromString(reader.getString()); + } else if ("message".equals(fieldName)) { + deserializedCheckMhsmNameAvailabilityResultInner.message = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCheckMhsmNameAvailabilityResultInner; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/CheckNameAvailabilityResultInner.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/CheckNameAvailabilityResultInner.java new file mode 100644 index 000000000000..67aa84516ec5 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/CheckNameAvailabilityResultInner.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.fluent.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.keyvault.generated.models.KeyVaultNameUnavailableReason; +import java.io.IOException; + +/** + * The CheckNameAvailability operation response. + */ +@Immutable +public final class CheckNameAvailabilityResultInner implements JsonSerializable { + /* + * A boolean value that indicates whether the name is available for you to use. If true, the name is available. If + * false, the name has already been taken or is invalid and cannot be used. + */ + private Boolean nameAvailable; + + /* + * The reason that a vault name could not be used. The Reason element is only returned if NameAvailable is false. + */ + private KeyVaultNameUnavailableReason reason; + + /* + * An error message explaining the Reason value in more detail. + */ + private String message; + + /** + * Creates an instance of CheckNameAvailabilityResultInner class. + */ + public CheckNameAvailabilityResultInner() { + } + + /** + * Get the nameAvailable property: A boolean value that indicates whether the name is available for you to use. If + * true, the name is available. If false, the name has already been taken or is invalid and cannot be used. + * + * @return the nameAvailable value. + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Get the reason property: The reason that a vault name could not be used. The Reason element is only returned if + * NameAvailable is false. + * + * @return the reason value. + */ + public KeyVaultNameUnavailableReason reason() { + return this.reason; + } + + /** + * Get the message property: An error message explaining the Reason value in more detail. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * 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 CheckNameAvailabilityResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CheckNameAvailabilityResultInner 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 CheckNameAvailabilityResultInner. + */ + public static CheckNameAvailabilityResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CheckNameAvailabilityResultInner deserializedCheckNameAvailabilityResultInner + = new CheckNameAvailabilityResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("nameAvailable".equals(fieldName)) { + deserializedCheckNameAvailabilityResultInner.nameAvailable + = reader.getNullable(JsonReader::getBoolean); + } else if ("reason".equals(fieldName)) { + deserializedCheckNameAvailabilityResultInner.reason + = KeyVaultNameUnavailableReason.fromString(reader.getString()); + } else if ("message".equals(fieldName)) { + deserializedCheckNameAvailabilityResultInner.message = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCheckNameAvailabilityResultInner; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/DeletedManagedHsmInner.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/DeletedManagedHsmInner.java new file mode 100644 index 000000000000..e9e7ee8aa62a --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/DeletedManagedHsmInner.java @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +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 java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Map; + +/** + * Concrete proxy resource types can be created by aliasing this type using a specific property type. + */ +@Immutable +public final class DeletedManagedHsmInner extends ProxyResource { + /* + * Properties of the deleted managed HSM + */ + private DeletedManagedHsmProperties innerProperties; + + /* + * 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 DeletedManagedHsmInner class. + */ + public DeletedManagedHsmInner() { + } + + /** + * Get the innerProperties property: Properties of the deleted managed HSM. + * + * @return the innerProperties value. + */ + private DeletedManagedHsmProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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; + } + + /** + * Get the mhsmId property: The resource id of the original managed HSM. + * + * @return the mhsmId value. + */ + public String mhsmId() { + return this.innerProperties() == null ? null : this.innerProperties().mhsmId(); + } + + /** + * Get the location property: The location of the original managed HSM. + * + * @return the location value. + */ + public String location() { + return this.innerProperties() == null ? null : this.innerProperties().location(); + } + + /** + * Get the deletionDate property: The deleted date. + * + * @return the deletionDate value. + */ + public OffsetDateTime deletionDate() { + return this.innerProperties() == null ? null : this.innerProperties().deletionDate(); + } + + /** + * Get the scheduledPurgeDate property: The scheduled purged date. + * + * @return the scheduledPurgeDate value. + */ + public OffsetDateTime scheduledPurgeDate() { + return this.innerProperties() == null ? null : this.innerProperties().scheduledPurgeDate(); + } + + /** + * Get the purgeProtectionEnabled property: Purge protection status of the original managed HSM. + * + * @return the purgeProtectionEnabled value. + */ + public Boolean purgeProtectionEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().purgeProtectionEnabled(); + } + + /** + * Get the tags property: Tags of the original managed HSM. + * + * @return the tags value. + */ + public Map tags() { + return this.innerProperties() == null ? null : this.innerProperties().tags(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DeletedManagedHsmInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DeletedManagedHsmInner 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 DeletedManagedHsmInner. + */ + public static DeletedManagedHsmInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DeletedManagedHsmInner deserializedDeletedManagedHsmInner = new DeletedManagedHsmInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedDeletedManagedHsmInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedDeletedManagedHsmInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedDeletedManagedHsmInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedDeletedManagedHsmInner.innerProperties = DeletedManagedHsmProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedDeletedManagedHsmInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDeletedManagedHsmInner; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/DeletedManagedHsmProperties.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/DeletedManagedHsmProperties.java new file mode 100644 index 000000000000..c01efda07a63 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/DeletedManagedHsmProperties.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +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; +import java.util.Map; + +/** + * Properties of the deleted managed HSM. + */ +@Immutable +public final class DeletedManagedHsmProperties implements JsonSerializable { + /* + * The resource id of the original managed HSM. + */ + private String mhsmId; + + /* + * The location of the original managed HSM. + */ + private String location; + + /* + * The deleted date. + */ + private OffsetDateTime deletionDate; + + /* + * The scheduled purged date. + */ + private OffsetDateTime scheduledPurgeDate; + + /* + * Purge protection status of the original managed HSM. + */ + private Boolean purgeProtectionEnabled; + + /* + * Tags of the original managed HSM. + */ + private Map tags; + + /** + * Creates an instance of DeletedManagedHsmProperties class. + */ + public DeletedManagedHsmProperties() { + } + + /** + * Get the mhsmId property: The resource id of the original managed HSM. + * + * @return the mhsmId value. + */ + public String mhsmId() { + return this.mhsmId; + } + + /** + * Get the location property: The location of the original managed HSM. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the deletionDate property: The deleted date. + * + * @return the deletionDate value. + */ + public OffsetDateTime deletionDate() { + return this.deletionDate; + } + + /** + * Get the scheduledPurgeDate property: The scheduled purged date. + * + * @return the scheduledPurgeDate value. + */ + public OffsetDateTime scheduledPurgeDate() { + return this.scheduledPurgeDate; + } + + /** + * Get the purgeProtectionEnabled property: Purge protection status of the original managed HSM. + * + * @return the purgeProtectionEnabled value. + */ + public Boolean purgeProtectionEnabled() { + return this.purgeProtectionEnabled; + } + + /** + * Get the tags property: Tags of the original managed HSM. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * 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 DeletedManagedHsmProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DeletedManagedHsmProperties 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 DeletedManagedHsmProperties. + */ + public static DeletedManagedHsmProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DeletedManagedHsmProperties deserializedDeletedManagedHsmProperties = new DeletedManagedHsmProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("mhsmId".equals(fieldName)) { + deserializedDeletedManagedHsmProperties.mhsmId = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedDeletedManagedHsmProperties.location = reader.getString(); + } else if ("deletionDate".equals(fieldName)) { + deserializedDeletedManagedHsmProperties.deletionDate = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("scheduledPurgeDate".equals(fieldName)) { + deserializedDeletedManagedHsmProperties.scheduledPurgeDate = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("purgeProtectionEnabled".equals(fieldName)) { + deserializedDeletedManagedHsmProperties.purgeProtectionEnabled + = reader.getNullable(JsonReader::getBoolean); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedDeletedManagedHsmProperties.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedDeletedManagedHsmProperties; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/DeletedVaultInner.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/DeletedVaultInner.java new file mode 100644 index 000000000000..b4feb5d71f76 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/DeletedVaultInner.java @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +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 java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Map; + +/** + * Deleted vault information with extended details. + */ +@Immutable +public final class DeletedVaultInner extends ProxyResource { + /* + * Properties of the vault + */ + private DeletedVaultProperties innerProperties; + + /* + * 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 DeletedVaultInner class. + */ + public DeletedVaultInner() { + } + + /** + * Get the innerProperties property: Properties of the vault. + * + * @return the innerProperties value. + */ + private DeletedVaultProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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; + } + + /** + * Get the vaultId property: The resource id of the original vault. + * + * @return the vaultId value. + */ + public String vaultId() { + return this.innerProperties() == null ? null : this.innerProperties().vaultId(); + } + + /** + * Get the location property: The location of the original vault. + * + * @return the location value. + */ + public String location() { + return this.innerProperties() == null ? null : this.innerProperties().location(); + } + + /** + * Get the deletionDate property: The deleted date. + * + * @return the deletionDate value. + */ + public OffsetDateTime deletionDate() { + return this.innerProperties() == null ? null : this.innerProperties().deletionDate(); + } + + /** + * Get the scheduledPurgeDate property: The scheduled purged date. + * + * @return the scheduledPurgeDate value. + */ + public OffsetDateTime scheduledPurgeDate() { + return this.innerProperties() == null ? null : this.innerProperties().scheduledPurgeDate(); + } + + /** + * Get the tags property: Tags of the original vault. + * + * @return the tags value. + */ + public Map tags() { + return this.innerProperties() == null ? null : this.innerProperties().tags(); + } + + /** + * Get the purgeProtectionEnabled property: Purge protection status of the original vault. + * + * @return the purgeProtectionEnabled value. + */ + public Boolean purgeProtectionEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().purgeProtectionEnabled(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DeletedVaultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DeletedVaultInner 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 DeletedVaultInner. + */ + public static DeletedVaultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DeletedVaultInner deserializedDeletedVaultInner = new DeletedVaultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedDeletedVaultInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedDeletedVaultInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedDeletedVaultInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedDeletedVaultInner.innerProperties = DeletedVaultProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedDeletedVaultInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDeletedVaultInner; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/DeletedVaultProperties.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/DeletedVaultProperties.java new file mode 100644 index 000000000000..c0c340a88299 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/DeletedVaultProperties.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +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; +import java.util.Map; + +/** + * Properties of the deleted vault. + */ +@Immutable +public final class DeletedVaultProperties implements JsonSerializable { + /* + * The resource id of the original vault. + */ + private String vaultId; + + /* + * The location of the original vault. + */ + private String location; + + /* + * The deleted date. + */ + private OffsetDateTime deletionDate; + + /* + * The scheduled purged date. + */ + private OffsetDateTime scheduledPurgeDate; + + /* + * Tags of the original vault. + */ + private Map tags; + + /* + * Purge protection status of the original vault. + */ + private Boolean purgeProtectionEnabled; + + /** + * Creates an instance of DeletedVaultProperties class. + */ + public DeletedVaultProperties() { + } + + /** + * Get the vaultId property: The resource id of the original vault. + * + * @return the vaultId value. + */ + public String vaultId() { + return this.vaultId; + } + + /** + * Get the location property: The location of the original vault. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the deletionDate property: The deleted date. + * + * @return the deletionDate value. + */ + public OffsetDateTime deletionDate() { + return this.deletionDate; + } + + /** + * Get the scheduledPurgeDate property: The scheduled purged date. + * + * @return the scheduledPurgeDate value. + */ + public OffsetDateTime scheduledPurgeDate() { + return this.scheduledPurgeDate; + } + + /** + * Get the tags property: Tags of the original vault. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Get the purgeProtectionEnabled property: Purge protection status of the original vault. + * + * @return the purgeProtectionEnabled value. + */ + public Boolean purgeProtectionEnabled() { + return this.purgeProtectionEnabled; + } + + /** + * 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 DeletedVaultProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DeletedVaultProperties 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 DeletedVaultProperties. + */ + public static DeletedVaultProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DeletedVaultProperties deserializedDeletedVaultProperties = new DeletedVaultProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("vaultId".equals(fieldName)) { + deserializedDeletedVaultProperties.vaultId = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedDeletedVaultProperties.location = reader.getString(); + } else if ("deletionDate".equals(fieldName)) { + deserializedDeletedVaultProperties.deletionDate = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("scheduledPurgeDate".equals(fieldName)) { + deserializedDeletedVaultProperties.scheduledPurgeDate = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedDeletedVaultProperties.tags = tags; + } else if ("purgeProtectionEnabled".equals(fieldName)) { + deserializedDeletedVaultProperties.purgeProtectionEnabled + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedDeletedVaultProperties; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/ManagedHsmInner.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/ManagedHsmInner.java new file mode 100644 index 000000000000..b6ce35435bab --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/ManagedHsmInner.java @@ -0,0 +1,467 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.fluent.models; + +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 com.azure.resourcemanager.keyvault.generated.models.CreateMode; +import com.azure.resourcemanager.keyvault.generated.models.ManagedHsmProvisioningState; +import com.azure.resourcemanager.keyvault.generated.models.ManagedHsmSecurityDomainProperties; +import com.azure.resourcemanager.keyvault.generated.models.MhsmNetworkRuleSet; +import com.azure.resourcemanager.keyvault.generated.models.MhsmPrivateEndpointConnectionItem; +import com.azure.resourcemanager.keyvault.generated.models.PublicNetworkAccess; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +/** + * Resource information with extended details. + */ +@Fluent +public final class ManagedHsmInner extends Resource { + /* + * Properties of the managed HSM + */ + private ManagedHsmProperties innerProperties; + + /* + * 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 ManagedHsmInner class. + */ + public ManagedHsmInner() { + } + + /** + * Get the innerProperties property: Properties of the managed HSM. + * + * @return the innerProperties value. + */ + private ManagedHsmProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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; + } + + /** + * {@inheritDoc} + */ + @Override + public ManagedHsmInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ManagedHsmInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the tenantId property: The Azure Active Directory tenant ID that should be used for authenticating requests + * to the managed HSM pool. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The Azure Active Directory tenant ID that should be used for authenticating requests + * to the managed HSM pool. + * + * @param tenantId the tenantId value to set. + * @return the ManagedHsmInner object itself. + */ + public ManagedHsmInner withTenantId(UUID tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedHsmProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Get the initialAdminObjectIds property: Array of initial administrators object ids for this managed hsm pool. + * + * @return the initialAdminObjectIds value. + */ + public List initialAdminObjectIds() { + return this.innerProperties() == null ? null : this.innerProperties().initialAdminObjectIds(); + } + + /** + * Set the initialAdminObjectIds property: Array of initial administrators object ids for this managed hsm pool. + * + * @param initialAdminObjectIds the initialAdminObjectIds value to set. + * @return the ManagedHsmInner object itself. + */ + public ManagedHsmInner withInitialAdminObjectIds(List initialAdminObjectIds) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedHsmProperties(); + } + this.innerProperties().withInitialAdminObjectIds(initialAdminObjectIds); + return this; + } + + /** + * Get the hsmUri property: The URI of the managed hsm pool for performing operations on keys. + * + * @return the hsmUri value. + */ + public String hsmUri() { + return this.innerProperties() == null ? null : this.innerProperties().hsmUri(); + } + + /** + * Get the enableSoftDelete property: Property to specify whether the 'soft delete' functionality is enabled for + * this managed HSM pool. Soft delete is enabled by default for all managed HSMs and is immutable. + * + * @return the enableSoftDelete value. + */ + public Boolean enableSoftDelete() { + return this.innerProperties() == null ? null : this.innerProperties().enableSoftDelete(); + } + + /** + * Set the enableSoftDelete property: Property to specify whether the 'soft delete' functionality is enabled for + * this managed HSM pool. Soft delete is enabled by default for all managed HSMs and is immutable. + * + * @param enableSoftDelete the enableSoftDelete value to set. + * @return the ManagedHsmInner object itself. + */ + public ManagedHsmInner withEnableSoftDelete(Boolean enableSoftDelete) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedHsmProperties(); + } + this.innerProperties().withEnableSoftDelete(enableSoftDelete); + return this; + } + + /** + * Get the softDeleteRetentionInDays property: Soft deleted data retention days. When you delete an HSM or a key, it + * will remain recoverable for the configured retention period or for a default period of 90 days. It accepts values + * between 7 and 90. + * + * @return the softDeleteRetentionInDays value. + */ + public Integer softDeleteRetentionInDays() { + return this.innerProperties() == null ? null : this.innerProperties().softDeleteRetentionInDays(); + } + + /** + * Set the softDeleteRetentionInDays property: Soft deleted data retention days. When you delete an HSM or a key, it + * will remain recoverable for the configured retention period or for a default period of 90 days. It accepts values + * between 7 and 90. + * + * @param softDeleteRetentionInDays the softDeleteRetentionInDays value to set. + * @return the ManagedHsmInner object itself. + */ + public ManagedHsmInner withSoftDeleteRetentionInDays(Integer softDeleteRetentionInDays) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedHsmProperties(); + } + this.innerProperties().withSoftDeleteRetentionInDays(softDeleteRetentionInDays); + return this; + } + + /** + * Get the enablePurgeProtection property: Property specifying whether protection against purge is enabled for this + * managed HSM pool. Setting this property to true activates protection against purge for this managed HSM pool and + * its content - only the Managed HSM service may initiate a hard, irrecoverable deletion. Enabling this + * functionality is irreversible. + * + * @return the enablePurgeProtection value. + */ + public Boolean enablePurgeProtection() { + return this.innerProperties() == null ? null : this.innerProperties().enablePurgeProtection(); + } + + /** + * Set the enablePurgeProtection property: Property specifying whether protection against purge is enabled for this + * managed HSM pool. Setting this property to true activates protection against purge for this managed HSM pool and + * its content - only the Managed HSM service may initiate a hard, irrecoverable deletion. Enabling this + * functionality is irreversible. + * + * @param enablePurgeProtection the enablePurgeProtection value to set. + * @return the ManagedHsmInner object itself. + */ + public ManagedHsmInner withEnablePurgeProtection(Boolean enablePurgeProtection) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedHsmProperties(); + } + this.innerProperties().withEnablePurgeProtection(enablePurgeProtection); + return this; + } + + /** + * Get the createMode property: The create mode to indicate whether the resource is being created or is being + * recovered from a deleted resource. + * + * @return the createMode value. + */ + public CreateMode createMode() { + return this.innerProperties() == null ? null : this.innerProperties().createMode(); + } + + /** + * Set the createMode property: The create mode to indicate whether the resource is being created or is being + * recovered from a deleted resource. + * + * @param createMode the createMode value to set. + * @return the ManagedHsmInner object itself. + */ + public ManagedHsmInner withCreateMode(CreateMode createMode) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedHsmProperties(); + } + this.innerProperties().withCreateMode(createMode); + return this; + } + + /** + * Get the statusMessage property: Resource Status Message. + * + * @return the statusMessage value. + */ + public String statusMessage() { + return this.innerProperties() == null ? null : this.innerProperties().statusMessage(); + } + + /** + * Get the provisioningState property: Provisioning state. + * + * @return the provisioningState value. + */ + public ManagedHsmProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the networkAcls property: Rules governing the accessibility of the key vault from specific network locations. + * + * @return the networkAcls value. + */ + public MhsmNetworkRuleSet networkAcls() { + return this.innerProperties() == null ? null : this.innerProperties().networkAcls(); + } + + /** + * Set the networkAcls property: Rules governing the accessibility of the key vault from specific network locations. + * + * @param networkAcls the networkAcls value to set. + * @return the ManagedHsmInner object itself. + */ + public ManagedHsmInner withNetworkAcls(MhsmNetworkRuleSet networkAcls) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedHsmProperties(); + } + this.innerProperties().withNetworkAcls(networkAcls); + return this; + } + + /** + * Get the regions property: List of all regions associated with the managed hsm pool. + * + * @return the regions value. + */ + public List regions() { + return this.innerProperties() == null ? null : this.innerProperties().regions(); + } + + /** + * Set the regions property: List of all regions associated with the managed hsm pool. + * + * @param regions the regions value to set. + * @return the ManagedHsmInner object itself. + */ + public ManagedHsmInner withRegions(List regions) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedHsmProperties(); + } + this.innerProperties().withRegions(regions); + return this; + } + + /** + * Get the privateEndpointConnections property: List of private endpoint connections associated with the managed hsm + * pool. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.innerProperties() == null ? null : this.innerProperties().privateEndpointConnections(); + } + + /** + * Get the publicNetworkAccess property: Control permission to the managed HSM from public networks. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.innerProperties() == null ? null : this.innerProperties().publicNetworkAccess(); + } + + /** + * Set the publicNetworkAccess property: Control permission to the managed HSM from public networks. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the ManagedHsmInner object itself. + */ + public ManagedHsmInner withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedHsmProperties(); + } + this.innerProperties().withPublicNetworkAccess(publicNetworkAccess); + return this; + } + + /** + * Get the scheduledPurgeDate property: The scheduled purge date in UTC. + * + * @return the scheduledPurgeDate value. + */ + public OffsetDateTime scheduledPurgeDate() { + return this.innerProperties() == null ? null : this.innerProperties().scheduledPurgeDate(); + } + + /** + * Get the securityDomainProperties property: Managed HSM security domain properties. + * + * @return the securityDomainProperties value. + */ + public ManagedHsmSecurityDomainProperties securityDomainProperties() { + return this.innerProperties() == null ? null : this.innerProperties().securityDomainProperties(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().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("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedHsmInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedHsmInner 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 ManagedHsmInner. + */ + public static ManagedHsmInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedHsmInner deserializedManagedHsmInner = new ManagedHsmInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedManagedHsmInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedManagedHsmInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedManagedHsmInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedManagedHsmInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedManagedHsmInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedManagedHsmInner.innerProperties = ManagedHsmProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedManagedHsmInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedManagedHsmInner; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/ManagedHsmProperties.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/ManagedHsmProperties.java new file mode 100644 index 000000000000..e7d49ed87492 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/ManagedHsmProperties.java @@ -0,0 +1,469 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +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 com.azure.resourcemanager.keyvault.generated.models.CreateMode; +import com.azure.resourcemanager.keyvault.generated.models.ManagedHsmProvisioningState; +import com.azure.resourcemanager.keyvault.generated.models.ManagedHsmSecurityDomainProperties; +import com.azure.resourcemanager.keyvault.generated.models.MhsmNetworkRuleSet; +import com.azure.resourcemanager.keyvault.generated.models.MhsmPrivateEndpointConnectionItem; +import com.azure.resourcemanager.keyvault.generated.models.PublicNetworkAccess; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Objects; +import java.util.UUID; + +/** + * Properties of the managed HSM Pool. + */ +@Fluent +public final class ManagedHsmProperties implements JsonSerializable { + /* + * The Azure Active Directory tenant ID that should be used for authenticating requests to the managed HSM pool. + */ + private UUID tenantId; + + /* + * Array of initial administrators object ids for this managed hsm pool. + */ + private List initialAdminObjectIds; + + /* + * The URI of the managed hsm pool for performing operations on keys. + */ + private String hsmUri; + + /* + * Property to specify whether the 'soft delete' functionality is enabled for this managed HSM pool. Soft delete is + * enabled by default for all managed HSMs and is immutable. + */ + private Boolean enableSoftDelete; + + /* + * Soft deleted data retention days. When you delete an HSM or a key, it will remain recoverable for the configured + * retention period or for a default period of 90 days. It accepts values between 7 and 90. + */ + private Integer softDeleteRetentionInDays; + + /* + * Property specifying whether protection against purge is enabled for this managed HSM pool. Setting this property + * to true activates protection against purge for this managed HSM pool and its content - only the Managed HSM + * service may initiate a hard, irrecoverable deletion. Enabling this functionality is irreversible. + */ + private Boolean enablePurgeProtection; + + /* + * The create mode to indicate whether the resource is being created or is being recovered from a deleted resource. + */ + private CreateMode createMode; + + /* + * Resource Status Message. + */ + private String statusMessage; + + /* + * Provisioning state. + */ + private ManagedHsmProvisioningState provisioningState; + + /* + * Rules governing the accessibility of the key vault from specific network locations. + */ + private MhsmNetworkRuleSet networkAcls; + + /* + * List of all regions associated with the managed hsm pool. + */ + private List regions; + + /* + * List of private endpoint connections associated with the managed hsm pool. + */ + private List privateEndpointConnections; + + /* + * Control permission to the managed HSM from public networks. + */ + private PublicNetworkAccess publicNetworkAccess; + + /* + * The scheduled purge date in UTC. + */ + private OffsetDateTime scheduledPurgeDate; + + /* + * Managed HSM security domain properties. + */ + private ManagedHsmSecurityDomainProperties securityDomainProperties; + + /** + * Creates an instance of ManagedHsmProperties class. + */ + public ManagedHsmProperties() { + } + + /** + * Get the tenantId property: The Azure Active Directory tenant ID that should be used for authenticating requests + * to the managed HSM pool. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: The Azure Active Directory tenant ID that should be used for authenticating requests + * to the managed HSM pool. + * + * @param tenantId the tenantId value to set. + * @return the ManagedHsmProperties object itself. + */ + public ManagedHsmProperties withTenantId(UUID tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the initialAdminObjectIds property: Array of initial administrators object ids for this managed hsm pool. + * + * @return the initialAdminObjectIds value. + */ + public List initialAdminObjectIds() { + return this.initialAdminObjectIds; + } + + /** + * Set the initialAdminObjectIds property: Array of initial administrators object ids for this managed hsm pool. + * + * @param initialAdminObjectIds the initialAdminObjectIds value to set. + * @return the ManagedHsmProperties object itself. + */ + public ManagedHsmProperties withInitialAdminObjectIds(List initialAdminObjectIds) { + this.initialAdminObjectIds = initialAdminObjectIds; + return this; + } + + /** + * Get the hsmUri property: The URI of the managed hsm pool for performing operations on keys. + * + * @return the hsmUri value. + */ + public String hsmUri() { + return this.hsmUri; + } + + /** + * Get the enableSoftDelete property: Property to specify whether the 'soft delete' functionality is enabled for + * this managed HSM pool. Soft delete is enabled by default for all managed HSMs and is immutable. + * + * @return the enableSoftDelete value. + */ + public Boolean enableSoftDelete() { + return this.enableSoftDelete; + } + + /** + * Set the enableSoftDelete property: Property to specify whether the 'soft delete' functionality is enabled for + * this managed HSM pool. Soft delete is enabled by default for all managed HSMs and is immutable. + * + * @param enableSoftDelete the enableSoftDelete value to set. + * @return the ManagedHsmProperties object itself. + */ + public ManagedHsmProperties withEnableSoftDelete(Boolean enableSoftDelete) { + this.enableSoftDelete = enableSoftDelete; + return this; + } + + /** + * Get the softDeleteRetentionInDays property: Soft deleted data retention days. When you delete an HSM or a key, it + * will remain recoverable for the configured retention period or for a default period of 90 days. It accepts values + * between 7 and 90. + * + * @return the softDeleteRetentionInDays value. + */ + public Integer softDeleteRetentionInDays() { + return this.softDeleteRetentionInDays; + } + + /** + * Set the softDeleteRetentionInDays property: Soft deleted data retention days. When you delete an HSM or a key, it + * will remain recoverable for the configured retention period or for a default period of 90 days. It accepts values + * between 7 and 90. + * + * @param softDeleteRetentionInDays the softDeleteRetentionInDays value to set. + * @return the ManagedHsmProperties object itself. + */ + public ManagedHsmProperties withSoftDeleteRetentionInDays(Integer softDeleteRetentionInDays) { + this.softDeleteRetentionInDays = softDeleteRetentionInDays; + return this; + } + + /** + * Get the enablePurgeProtection property: Property specifying whether protection against purge is enabled for this + * managed HSM pool. Setting this property to true activates protection against purge for this managed HSM pool and + * its content - only the Managed HSM service may initiate a hard, irrecoverable deletion. Enabling this + * functionality is irreversible. + * + * @return the enablePurgeProtection value. + */ + public Boolean enablePurgeProtection() { + return this.enablePurgeProtection; + } + + /** + * Set the enablePurgeProtection property: Property specifying whether protection against purge is enabled for this + * managed HSM pool. Setting this property to true activates protection against purge for this managed HSM pool and + * its content - only the Managed HSM service may initiate a hard, irrecoverable deletion. Enabling this + * functionality is irreversible. + * + * @param enablePurgeProtection the enablePurgeProtection value to set. + * @return the ManagedHsmProperties object itself. + */ + public ManagedHsmProperties withEnablePurgeProtection(Boolean enablePurgeProtection) { + this.enablePurgeProtection = enablePurgeProtection; + return this; + } + + /** + * Get the createMode property: The create mode to indicate whether the resource is being created or is being + * recovered from a deleted resource. + * + * @return the createMode value. + */ + public CreateMode createMode() { + return this.createMode; + } + + /** + * Set the createMode property: The create mode to indicate whether the resource is being created or is being + * recovered from a deleted resource. + * + * @param createMode the createMode value to set. + * @return the ManagedHsmProperties object itself. + */ + public ManagedHsmProperties withCreateMode(CreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Get the statusMessage property: Resource Status Message. + * + * @return the statusMessage value. + */ + public String statusMessage() { + return this.statusMessage; + } + + /** + * Get the provisioningState property: Provisioning state. + * + * @return the provisioningState value. + */ + public ManagedHsmProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the networkAcls property: Rules governing the accessibility of the key vault from specific network locations. + * + * @return the networkAcls value. + */ + public MhsmNetworkRuleSet networkAcls() { + return this.networkAcls; + } + + /** + * Set the networkAcls property: Rules governing the accessibility of the key vault from specific network locations. + * + * @param networkAcls the networkAcls value to set. + * @return the ManagedHsmProperties object itself. + */ + public ManagedHsmProperties withNetworkAcls(MhsmNetworkRuleSet networkAcls) { + this.networkAcls = networkAcls; + return this; + } + + /** + * Get the regions property: List of all regions associated with the managed hsm pool. + * + * @return the regions value. + */ + public List regions() { + return this.regions; + } + + /** + * Set the regions property: List of all regions associated with the managed hsm pool. + * + * @param regions the regions value to set. + * @return the ManagedHsmProperties object itself. + */ + public ManagedHsmProperties withRegions(List regions) { + this.regions = regions; + return this; + } + + /** + * Get the privateEndpointConnections property: List of private endpoint connections associated with the managed hsm + * pool. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** + * Get the publicNetworkAccess property: Control permission to the managed HSM from public networks. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * Set the publicNetworkAccess property: Control permission to the managed HSM from public networks. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the ManagedHsmProperties object itself. + */ + public ManagedHsmProperties withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; + return this; + } + + /** + * Get the scheduledPurgeDate property: The scheduled purge date in UTC. + * + * @return the scheduledPurgeDate value. + */ + public OffsetDateTime scheduledPurgeDate() { + return this.scheduledPurgeDate; + } + + /** + * Get the securityDomainProperties property: Managed HSM security domain properties. + * + * @return the securityDomainProperties value. + */ + public ManagedHsmSecurityDomainProperties securityDomainProperties() { + return this.securityDomainProperties; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (networkAcls() != null) { + networkAcls().validate(); + } + if (regions() != null) { + regions().forEach(e -> e.validate()); + } + if (privateEndpointConnections() != null) { + privateEndpointConnections().forEach(e -> e.validate()); + } + if (securityDomainProperties() != null) { + securityDomainProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("tenantId", Objects.toString(this.tenantId, null)); + jsonWriter.writeArrayField("initialAdminObjectIds", this.initialAdminObjectIds, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeBooleanField("enableSoftDelete", this.enableSoftDelete); + jsonWriter.writeNumberField("softDeleteRetentionInDays", this.softDeleteRetentionInDays); + jsonWriter.writeBooleanField("enablePurgeProtection", this.enablePurgeProtection); + jsonWriter.writeStringField("createMode", this.createMode == null ? null : this.createMode.toString()); + jsonWriter.writeJsonField("networkAcls", this.networkAcls); + jsonWriter.writeArrayField("regions", this.regions, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("publicNetworkAccess", + this.publicNetworkAccess == null ? null : this.publicNetworkAccess.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedHsmProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedHsmProperties 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 ManagedHsmProperties. + */ + public static ManagedHsmProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedHsmProperties deserializedManagedHsmProperties = new ManagedHsmProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tenantId".equals(fieldName)) { + deserializedManagedHsmProperties.tenantId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("initialAdminObjectIds".equals(fieldName)) { + List initialAdminObjectIds = reader.readArray(reader1 -> reader1.getString()); + deserializedManagedHsmProperties.initialAdminObjectIds = initialAdminObjectIds; + } else if ("hsmUri".equals(fieldName)) { + deserializedManagedHsmProperties.hsmUri = reader.getString(); + } else if ("enableSoftDelete".equals(fieldName)) { + deserializedManagedHsmProperties.enableSoftDelete = reader.getNullable(JsonReader::getBoolean); + } else if ("softDeleteRetentionInDays".equals(fieldName)) { + deserializedManagedHsmProperties.softDeleteRetentionInDays = reader.getNullable(JsonReader::getInt); + } else if ("enablePurgeProtection".equals(fieldName)) { + deserializedManagedHsmProperties.enablePurgeProtection = reader.getNullable(JsonReader::getBoolean); + } else if ("createMode".equals(fieldName)) { + deserializedManagedHsmProperties.createMode = CreateMode.fromString(reader.getString()); + } else if ("statusMessage".equals(fieldName)) { + deserializedManagedHsmProperties.statusMessage = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedManagedHsmProperties.provisioningState + = ManagedHsmProvisioningState.fromString(reader.getString()); + } else if ("networkAcls".equals(fieldName)) { + deserializedManagedHsmProperties.networkAcls = MhsmNetworkRuleSet.fromJson(reader); + } else if ("regions".equals(fieldName)) { + List regions + = reader.readArray(reader1 -> MhsmGeoReplicatedRegionInner.fromJson(reader1)); + deserializedManagedHsmProperties.regions = regions; + } else if ("privateEndpointConnections".equals(fieldName)) { + List privateEndpointConnections + = reader.readArray(reader1 -> MhsmPrivateEndpointConnectionItem.fromJson(reader1)); + deserializedManagedHsmProperties.privateEndpointConnections = privateEndpointConnections; + } else if ("publicNetworkAccess".equals(fieldName)) { + deserializedManagedHsmProperties.publicNetworkAccess + = PublicNetworkAccess.fromString(reader.getString()); + } else if ("scheduledPurgeDate".equals(fieldName)) { + deserializedManagedHsmProperties.scheduledPurgeDate = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("securityDomainProperties".equals(fieldName)) { + deserializedManagedHsmProperties.securityDomainProperties + = ManagedHsmSecurityDomainProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedManagedHsmProperties; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/MhsmGeoReplicatedRegionInner.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/MhsmGeoReplicatedRegionInner.java new file mode 100644 index 000000000000..9db8f3930003 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/MhsmGeoReplicatedRegionInner.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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.keyvault.generated.models.GeoReplicationRegionProvisioningState; +import java.io.IOException; + +/** + * A region that this managed HSM Pool has been extended to. + */ +@Fluent +public final class MhsmGeoReplicatedRegionInner implements JsonSerializable { + /* + * Name of the geo replicated region. + */ + private String name; + + /* + * Provisioning state of the geo replicated region. + */ + private GeoReplicationRegionProvisioningState provisioningState; + + /* + * A boolean value that indicates whether the region is the primary region or a secondary region. + */ + private Boolean isPrimary; + + /** + * Creates an instance of MhsmGeoReplicatedRegionInner class. + */ + public MhsmGeoReplicatedRegionInner() { + } + + /** + * Get the name property: Name of the geo replicated region. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the geo replicated region. + * + * @param name the name value to set. + * @return the MhsmGeoReplicatedRegionInner object itself. + */ + public MhsmGeoReplicatedRegionInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the provisioningState property: Provisioning state of the geo replicated region. + * + * @return the provisioningState value. + */ + public GeoReplicationRegionProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the isPrimary property: A boolean value that indicates whether the region is the primary region or a + * secondary region. + * + * @return the isPrimary value. + */ + public Boolean isPrimary() { + return this.isPrimary; + } + + /** + * Set the isPrimary property: A boolean value that indicates whether the region is the primary region or a + * secondary region. + * + * @param isPrimary the isPrimary value to set. + * @return the MhsmGeoReplicatedRegionInner object itself. + */ + public MhsmGeoReplicatedRegionInner withIsPrimary(Boolean isPrimary) { + this.isPrimary = isPrimary; + 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("name", this.name); + jsonWriter.writeBooleanField("isPrimary", this.isPrimary); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MhsmGeoReplicatedRegionInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MhsmGeoReplicatedRegionInner 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 MhsmGeoReplicatedRegionInner. + */ + public static MhsmGeoReplicatedRegionInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MhsmGeoReplicatedRegionInner deserializedMhsmGeoReplicatedRegionInner = new MhsmGeoReplicatedRegionInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedMhsmGeoReplicatedRegionInner.name = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedMhsmGeoReplicatedRegionInner.provisioningState + = GeoReplicationRegionProvisioningState.fromString(reader.getString()); + } else if ("isPrimary".equals(fieldName)) { + deserializedMhsmGeoReplicatedRegionInner.isPrimary = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedMhsmGeoReplicatedRegionInner; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/MhsmPrivateEndpointConnectionInner.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/MhsmPrivateEndpointConnectionInner.java new file mode 100644 index 000000000000..d81aa1425e00 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/MhsmPrivateEndpointConnectionInner.java @@ -0,0 +1,269 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.fluent.models; + +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 com.azure.resourcemanager.keyvault.generated.models.ManagedHsmPrivateEndpointConnectionProvisioningState; +import com.azure.resourcemanager.keyvault.generated.models.MhsmPrivateEndpoint; +import com.azure.resourcemanager.keyvault.generated.models.MhsmPrivateLinkServiceConnectionState; +import java.io.IOException; +import java.util.Map; + +/** + * Private endpoint connection resource. + */ +@Fluent +public final class MhsmPrivateEndpointConnectionInner extends Resource { + /* + * Resource properties. + */ + private MhsmPrivateEndpointConnectionProperties innerProperties; + + /* + * 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 MhsmPrivateEndpointConnectionInner class. + */ + public MhsmPrivateEndpointConnectionInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private MhsmPrivateEndpointConnectionProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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 MhsmPrivateEndpointConnectionInner object itself. + */ + public MhsmPrivateEndpointConnectionInner 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; + } + + /** + * {@inheritDoc} + */ + @Override + public MhsmPrivateEndpointConnectionInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public MhsmPrivateEndpointConnectionInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the privateEndpoint property: Properties of the private endpoint object. + * + * @return the privateEndpoint value. + */ + public MhsmPrivateEndpoint privateEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().privateEndpoint(); + } + + /** + * Set the privateEndpoint property: Properties of the private endpoint object. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the MhsmPrivateEndpointConnectionInner object itself. + */ + public MhsmPrivateEndpointConnectionInner withPrivateEndpoint(MhsmPrivateEndpoint privateEndpoint) { + if (this.innerProperties() == null) { + this.innerProperties = new MhsmPrivateEndpointConnectionProperties(); + } + this.innerProperties().withPrivateEndpoint(privateEndpoint); + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: Approval state of the private link connection. + * + * @return the privateLinkServiceConnectionState value. + */ + public MhsmPrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.innerProperties() == null ? null : this.innerProperties().privateLinkServiceConnectionState(); + } + + /** + * Set the privateLinkServiceConnectionState property: Approval state of the private link connection. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the MhsmPrivateEndpointConnectionInner object itself. + */ + public MhsmPrivateEndpointConnectionInner + withPrivateLinkServiceConnectionState(MhsmPrivateLinkServiceConnectionState privateLinkServiceConnectionState) { + if (this.innerProperties() == null) { + this.innerProperties = new MhsmPrivateEndpointConnectionProperties(); + } + this.innerProperties().withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState); + return this; + } + + /** + * Get the provisioningState property: Provisioning state of the private endpoint connection. + * + * @return the provisioningState value. + */ + public ManagedHsmPrivateEndpointConnectionProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().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("properties", this.innerProperties); + jsonWriter.writeStringField("etag", this.etag); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MhsmPrivateEndpointConnectionInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MhsmPrivateEndpointConnectionInner 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 MhsmPrivateEndpointConnectionInner. + */ + public static MhsmPrivateEndpointConnectionInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MhsmPrivateEndpointConnectionInner deserializedMhsmPrivateEndpointConnectionInner + = new MhsmPrivateEndpointConnectionInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedMhsmPrivateEndpointConnectionInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedMhsmPrivateEndpointConnectionInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedMhsmPrivateEndpointConnectionInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedMhsmPrivateEndpointConnectionInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedMhsmPrivateEndpointConnectionInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedMhsmPrivateEndpointConnectionInner.innerProperties + = MhsmPrivateEndpointConnectionProperties.fromJson(reader); + } else if ("etag".equals(fieldName)) { + deserializedMhsmPrivateEndpointConnectionInner.etag = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedMhsmPrivateEndpointConnectionInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMhsmPrivateEndpointConnectionInner; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/MhsmPrivateEndpointConnectionProperties.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/MhsmPrivateEndpointConnectionProperties.java new file mode 100644 index 000000000000..a27a3df43f80 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/MhsmPrivateEndpointConnectionProperties.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.keyvault.generated.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.keyvault.generated.models.ManagedHsmPrivateEndpointConnectionProvisioningState; +import com.azure.resourcemanager.keyvault.generated.models.MhsmPrivateEndpoint; +import com.azure.resourcemanager.keyvault.generated.models.MhsmPrivateLinkServiceConnectionState; +import java.io.IOException; + +/** + * Properties of the private endpoint connection resource. + */ +@Fluent +public final class MhsmPrivateEndpointConnectionProperties + implements JsonSerializable { + /* + * Properties of the private endpoint object. + */ + private MhsmPrivateEndpoint privateEndpoint; + + /* + * Approval state of the private link connection. + */ + private MhsmPrivateLinkServiceConnectionState privateLinkServiceConnectionState; + + /* + * Provisioning state of the private endpoint connection. + */ + private ManagedHsmPrivateEndpointConnectionProvisioningState provisioningState; + + /** + * Creates an instance of MhsmPrivateEndpointConnectionProperties class. + */ + public MhsmPrivateEndpointConnectionProperties() { + } + + /** + * Get the privateEndpoint property: Properties of the private endpoint object. + * + * @return the privateEndpoint value. + */ + public MhsmPrivateEndpoint privateEndpoint() { + return this.privateEndpoint; + } + + /** + * Set the privateEndpoint property: Properties of the private endpoint object. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the MhsmPrivateEndpointConnectionProperties object itself. + */ + public MhsmPrivateEndpointConnectionProperties withPrivateEndpoint(MhsmPrivateEndpoint privateEndpoint) { + this.privateEndpoint = privateEndpoint; + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: Approval state of the private link connection. + * + * @return the privateLinkServiceConnectionState value. + */ + public MhsmPrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.privateLinkServiceConnectionState; + } + + /** + * Set the privateLinkServiceConnectionState property: Approval state of the private link connection. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the MhsmPrivateEndpointConnectionProperties object itself. + */ + public MhsmPrivateEndpointConnectionProperties + withPrivateLinkServiceConnectionState(MhsmPrivateLinkServiceConnectionState privateLinkServiceConnectionState) { + this.privateLinkServiceConnectionState = privateLinkServiceConnectionState; + return this; + } + + /** + * Get the provisioningState property: Provisioning state of the private endpoint connection. + * + * @return the provisioningState value. + */ + public ManagedHsmPrivateEndpointConnectionProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateEndpoint() != null) { + privateEndpoint().validate(); + } + if (privateLinkServiceConnectionState() != null) { + privateLinkServiceConnectionState().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("privateEndpoint", this.privateEndpoint); + jsonWriter.writeJsonField("privateLinkServiceConnectionState", this.privateLinkServiceConnectionState); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MhsmPrivateEndpointConnectionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MhsmPrivateEndpointConnectionProperties 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 MhsmPrivateEndpointConnectionProperties. + */ + public static MhsmPrivateEndpointConnectionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MhsmPrivateEndpointConnectionProperties deserializedMhsmPrivateEndpointConnectionProperties + = new MhsmPrivateEndpointConnectionProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("privateEndpoint".equals(fieldName)) { + deserializedMhsmPrivateEndpointConnectionProperties.privateEndpoint + = MhsmPrivateEndpoint.fromJson(reader); + } else if ("privateLinkServiceConnectionState".equals(fieldName)) { + deserializedMhsmPrivateEndpointConnectionProperties.privateLinkServiceConnectionState + = MhsmPrivateLinkServiceConnectionState.fromJson(reader); + } else if ("provisioningState".equals(fieldName)) { + deserializedMhsmPrivateEndpointConnectionProperties.provisioningState + = ManagedHsmPrivateEndpointConnectionProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedMhsmPrivateEndpointConnectionProperties; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/MhsmPrivateLinkResourceListResultInner.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/MhsmPrivateLinkResourceListResultInner.java new file mode 100644 index 000000000000..a97086236979 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/MhsmPrivateLinkResourceListResultInner.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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.keyvault.generated.models.MhsmPrivateLinkResource; +import java.io.IOException; +import java.util.List; + +/** + * A list of private link resources. + */ +@Fluent +public final class MhsmPrivateLinkResourceListResultInner + implements JsonSerializable { + /* + * Array of private link resources + */ + private List value; + + /** + * Creates an instance of MhsmPrivateLinkResourceListResultInner class. + */ + public MhsmPrivateLinkResourceListResultInner() { + } + + /** + * 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 MhsmPrivateLinkResourceListResultInner object itself. + */ + public MhsmPrivateLinkResourceListResultInner 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 MhsmPrivateLinkResourceListResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MhsmPrivateLinkResourceListResultInner 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 MhsmPrivateLinkResourceListResultInner. + */ + public static MhsmPrivateLinkResourceListResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MhsmPrivateLinkResourceListResultInner deserializedMhsmPrivateLinkResourceListResultInner + = new MhsmPrivateLinkResourceListResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> MhsmPrivateLinkResource.fromJson(reader1)); + deserializedMhsmPrivateLinkResourceListResultInner.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedMhsmPrivateLinkResourceListResultInner; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/MhsmPrivateLinkResourceProperties.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/MhsmPrivateLinkResourceProperties.java new file mode 100644 index 000000000000..918d8ca1c2b7 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/MhsmPrivateLinkResourceProperties.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.keyvault.generated.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 java.io.IOException; +import java.util.List; + +/** + * Properties of a private link resource. + */ +@Fluent +public final class MhsmPrivateLinkResourceProperties implements JsonSerializable { + /* + * Group identifier of private link resource. + */ + private String groupId; + + /* + * Required member names of private link resource. + */ + private List requiredMembers; + + /* + * Required DNS zone names of the the private link resource. + */ + private List requiredZoneNames; + + /** + * Creates an instance of MhsmPrivateLinkResourceProperties class. + */ + public MhsmPrivateLinkResourceProperties() { + } + + /** + * Get the groupId property: Group identifier of private link resource. + * + * @return the groupId value. + */ + public String groupId() { + return this.groupId; + } + + /** + * Get the requiredMembers property: Required member names of private link resource. + * + * @return the requiredMembers value. + */ + public List requiredMembers() { + return this.requiredMembers; + } + + /** + * Get the requiredZoneNames property: Required DNS zone names of the the private link resource. + * + * @return the requiredZoneNames value. + */ + public List requiredZoneNames() { + return this.requiredZoneNames; + } + + /** + * Set the requiredZoneNames property: Required DNS zone names of the the private link resource. + * + * @param requiredZoneNames the requiredZoneNames value to set. + * @return the MhsmPrivateLinkResourceProperties object itself. + */ + public MhsmPrivateLinkResourceProperties 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 MhsmPrivateLinkResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MhsmPrivateLinkResourceProperties 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 MhsmPrivateLinkResourceProperties. + */ + public static MhsmPrivateLinkResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MhsmPrivateLinkResourceProperties deserializedMhsmPrivateLinkResourceProperties + = new MhsmPrivateLinkResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("groupId".equals(fieldName)) { + deserializedMhsmPrivateLinkResourceProperties.groupId = reader.getString(); + } else if ("requiredMembers".equals(fieldName)) { + List requiredMembers = reader.readArray(reader1 -> reader1.getString()); + deserializedMhsmPrivateLinkResourceProperties.requiredMembers = requiredMembers; + } else if ("requiredZoneNames".equals(fieldName)) { + List requiredZoneNames = reader.readArray(reader1 -> reader1.getString()); + deserializedMhsmPrivateLinkResourceProperties.requiredZoneNames = requiredZoneNames; + } else { + reader.skipChildren(); + } + } + + return deserializedMhsmPrivateLinkResourceProperties; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/OperationInner.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/OperationInner.java new file mode 100644 index 000000000000..f7ba64e44b2e --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/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.keyvault.generated.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.keyvault.generated.models.ActionType; +import com.azure.resourcemanager.keyvault.generated.models.OperationDisplay; +import com.azure.resourcemanager.keyvault.generated.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/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/PrivateEndpointConnectionInner.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/PrivateEndpointConnectionInner.java new file mode 100644 index 000000000000..d4306a17441c --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/PrivateEndpointConnectionInner.java @@ -0,0 +1,269 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.fluent.models; + +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 com.azure.resourcemanager.keyvault.generated.models.PrivateEndpoint; +import com.azure.resourcemanager.keyvault.generated.models.PrivateEndpointConnectionProvisioningState; +import com.azure.resourcemanager.keyvault.generated.models.PrivateLinkServiceConnectionState; +import java.io.IOException; +import java.util.Map; + +/** + * Private endpoint connection resource. + */ +@Fluent +public final class PrivateEndpointConnectionInner extends Resource { + /* + * Resource properties. + */ + private PrivateEndpointConnectionProperties innerProperties; + + /* + * 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 innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private PrivateEndpointConnectionProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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; + } + + /** + * {@inheritDoc} + */ + @Override + public PrivateEndpointConnectionInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PrivateEndpointConnectionInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the privateEndpoint property: Properties of the private endpoint object. + * + * @return the privateEndpoint value. + */ + public PrivateEndpoint privateEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().privateEndpoint(); + } + + /** + * Set the privateEndpoint property: Properties of the private endpoint object. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withPrivateEndpoint(PrivateEndpoint privateEndpoint) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateEndpointConnectionProperties(); + } + this.innerProperties().withPrivateEndpoint(privateEndpoint); + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: Approval state of the private link connection. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.innerProperties() == null ? null : this.innerProperties().privateLinkServiceConnectionState(); + } + + /** + * Set the privateLinkServiceConnectionState property: Approval state of the private link connection. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner + withPrivateLinkServiceConnectionState(PrivateLinkServiceConnectionState privateLinkServiceConnectionState) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateEndpointConnectionProperties(); + } + this.innerProperties().withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState); + return this; + } + + /** + * Get the provisioningState property: Provisioning state of the private endpoint connection. + * + * @return the provisioningState value. + */ + public PrivateEndpointConnectionProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().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("properties", this.innerProperties); + 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 ("location".equals(fieldName)) { + deserializedPrivateEndpointConnectionInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedPrivateEndpointConnectionInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedPrivateEndpointConnectionInner.innerProperties + = 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/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/PrivateEndpointConnectionProperties.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/PrivateEndpointConnectionProperties.java new file mode 100644 index 000000000000..1f1a221d6e73 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/PrivateEndpointConnectionProperties.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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.keyvault.generated.models.PrivateEndpoint; +import com.azure.resourcemanager.keyvault.generated.models.PrivateEndpointConnectionProvisioningState; +import com.azure.resourcemanager.keyvault.generated.models.PrivateLinkServiceConnectionState; +import java.io.IOException; + +/** + * Properties of the private endpoint connection resource. + */ +@Fluent +public final class PrivateEndpointConnectionProperties + implements JsonSerializable { + /* + * Properties of the private endpoint object. + */ + private PrivateEndpoint privateEndpoint; + + /* + * Approval state of the private link connection. + */ + private PrivateLinkServiceConnectionState privateLinkServiceConnectionState; + + /* + * Provisioning state of the private endpoint connection. + */ + private PrivateEndpointConnectionProvisioningState provisioningState; + + /** + * Creates an instance of PrivateEndpointConnectionProperties class. + */ + public PrivateEndpointConnectionProperties() { + } + + /** + * Get the privateEndpoint property: Properties of the private endpoint object. + * + * @return the privateEndpoint value. + */ + public PrivateEndpoint privateEndpoint() { + return this.privateEndpoint; + } + + /** + * Set the privateEndpoint property: Properties of the private endpoint object. + * + * @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: Approval state of the private link connection. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.privateLinkServiceConnectionState; + } + + /** + * Set the privateLinkServiceConnectionState property: Approval state of the private link connection. + * + * @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: Provisioning state of the private endpoint connection. + * + * @return the provisioningState value. + */ + public PrivateEndpointConnectionProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateEndpoint() != null) { + privateEndpoint().validate(); + } + if (privateLinkServiceConnectionState() != null) { + privateLinkServiceConnectionState().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("privateEndpoint", this.privateEndpoint); + jsonWriter.writeJsonField("privateLinkServiceConnectionState", this.privateLinkServiceConnectionState); + 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 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 ("privateEndpoint".equals(fieldName)) { + deserializedPrivateEndpointConnectionProperties.privateEndpoint = PrivateEndpoint.fromJson(reader); + } else if ("privateLinkServiceConnectionState".equals(fieldName)) { + deserializedPrivateEndpointConnectionProperties.privateLinkServiceConnectionState + = PrivateLinkServiceConnectionState.fromJson(reader); + } else if ("provisioningState".equals(fieldName)) { + deserializedPrivateEndpointConnectionProperties.provisioningState + = PrivateEndpointConnectionProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateEndpointConnectionProperties; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/PrivateLinkResourceListResultInner.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/PrivateLinkResourceListResultInner.java new file mode 100644 index 000000000000..aa31cf4fa224 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/PrivateLinkResourceListResultInner.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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.keyvault.generated.models.PrivateLinkResource; +import java.io.IOException; +import java.util.List; + +/** + * A list of private link resources. + */ +@Fluent +public final class PrivateLinkResourceListResultInner implements JsonSerializable { + /* + * Array of private link resources + */ + private List value; + + /** + * Creates an instance of PrivateLinkResourceListResultInner class. + */ + public PrivateLinkResourceListResultInner() { + } + + /** + * 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 PrivateLinkResourceListResultInner object itself. + */ + public PrivateLinkResourceListResultInner 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 PrivateLinkResourceListResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateLinkResourceListResultInner 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 PrivateLinkResourceListResultInner. + */ + public static PrivateLinkResourceListResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateLinkResourceListResultInner deserializedPrivateLinkResourceListResultInner + = new PrivateLinkResourceListResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> PrivateLinkResource.fromJson(reader1)); + deserializedPrivateLinkResourceListResultInner.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateLinkResourceListResultInner; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/PrivateLinkResourceProperties.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/PrivateLinkResourceProperties.java new file mode 100644 index 000000000000..cf34a1b6fcff --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/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.keyvault.generated.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 java.io.IOException; +import java.util.List; + +/** + * Properties of a private link resource. + */ +@Fluent +public final class PrivateLinkResourceProperties implements JsonSerializable { + /* + * Group identifier of private link resource. + */ + private String groupId; + + /* + * Required member names of private link resource. + */ + private List requiredMembers; + + /* + * Required DNS zone names of the the private link resource. + */ + private List requiredZoneNames; + + /** + * Creates an instance of PrivateLinkResourceProperties class. + */ + public PrivateLinkResourceProperties() { + } + + /** + * Get the groupId property: Group identifier of private link resource. + * + * @return the groupId value. + */ + public String groupId() { + return this.groupId; + } + + /** + * Get the requiredMembers property: Required member names of private link resource. + * + * @return the requiredMembers value. + */ + public List requiredMembers() { + return this.requiredMembers; + } + + /** + * Get the requiredZoneNames property: Required DNS zone names of the the private link resource. + * + * @return the requiredZoneNames value. + */ + public List requiredZoneNames() { + return this.requiredZoneNames; + } + + /** + * Set the requiredZoneNames property: Required DNS zone names of the the private link resource. + * + * @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/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/SecretInner.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/SecretInner.java new file mode 100644 index 000000000000..cf548b586a70 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/SecretInner.java @@ -0,0 +1,278 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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.keyvault.generated.models.SecretAttributes; +import java.io.IOException; +import java.util.Map; + +/** + * Resource information with extended details. + */ +@Fluent +public final class SecretInner extends Resource { + /* + * Properties of the secret + */ + private SecretProperties innerProperties = new SecretProperties(); + + /* + * 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 SecretInner class. + */ + public SecretInner() { + } + + /** + * Get the innerProperties property: Properties of the secret. + * + * @return the innerProperties value. + */ + private SecretProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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; + } + + /** + * {@inheritDoc} + */ + @Override + public SecretInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public SecretInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the value property: The value of the secret. NOTE: 'value' will never be returned from the service, as APIs + * using this model are is intended for internal use in ARM deployments. Users should use the data-plane REST + * service for interaction with vault secrets. + * + * @return the value value. + */ + public String value() { + return this.innerProperties() == null ? null : this.innerProperties().value(); + } + + /** + * Set the value property: The value of the secret. NOTE: 'value' will never be returned from the service, as APIs + * using this model are is intended for internal use in ARM deployments. Users should use the data-plane REST + * service for interaction with vault secrets. + * + * @param value the value value to set. + * @return the SecretInner object itself. + */ + public SecretInner withValue(String value) { + if (this.innerProperties() == null) { + this.innerProperties = new SecretProperties(); + } + this.innerProperties().withValue(value); + return this; + } + + /** + * Get the contentType property: The content type of the secret. + * + * @return the contentType value. + */ + public String contentType() { + return this.innerProperties() == null ? null : this.innerProperties().contentType(); + } + + /** + * Set the contentType property: The content type of the secret. + * + * @param contentType the contentType value to set. + * @return the SecretInner object itself. + */ + public SecretInner withContentType(String contentType) { + if (this.innerProperties() == null) { + this.innerProperties = new SecretProperties(); + } + this.innerProperties().withContentType(contentType); + return this; + } + + /** + * Get the attributes property: The attributes of the secret. + * + * @return the attributes value. + */ + public SecretAttributes attributes() { + return this.innerProperties() == null ? null : this.innerProperties().attributes(); + } + + /** + * Set the attributes property: The attributes of the secret. + * + * @param attributes the attributes value to set. + * @return the SecretInner object itself. + */ + public SecretInner withAttributes(SecretAttributes attributes) { + if (this.innerProperties() == null) { + this.innerProperties = new SecretProperties(); + } + this.innerProperties().withAttributes(attributes); + return this; + } + + /** + * Get the secretUri property: The URI to retrieve the current version of the secret. + * + * @return the secretUri value. + */ + public String secretUri() { + return this.innerProperties() == null ? null : this.innerProperties().secretUri(); + } + + /** + * Get the secretUriWithVersion property: The URI to retrieve the specific version of the secret. + * + * @return the secretUriWithVersion value. + */ + public String secretUriWithVersion() { + return this.innerProperties() == null ? null : this.innerProperties().secretUriWithVersion(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property innerProperties in model SecretInner")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SecretInner.class); + + /** + * {@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("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecretInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecretInner 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 SecretInner. + */ + public static SecretInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecretInner deserializedSecretInner = new SecretInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSecretInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSecretInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSecretInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedSecretInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSecretInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedSecretInner.innerProperties = SecretProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedSecretInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSecretInner; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/SecretProperties.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/SecretProperties.java new file mode 100644 index 000000000000..dc0a9586300f --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/SecretProperties.java @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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.keyvault.generated.models.SecretAttributes; +import java.io.IOException; + +/** + * Properties of the secret. + */ +@Fluent +public final class SecretProperties implements JsonSerializable { + /* + * The value of the secret. NOTE: 'value' will never be returned from the service, as APIs using this model are is + * intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with + * vault secrets. + */ + private String value; + + /* + * The content type of the secret. + */ + private String contentType; + + /* + * The attributes of the secret. + */ + private SecretAttributes attributes; + + /* + * The URI to retrieve the current version of the secret. + */ + private String secretUri; + + /* + * The URI to retrieve the specific version of the secret. + */ + private String secretUriWithVersion; + + /** + * Creates an instance of SecretProperties class. + */ + public SecretProperties() { + } + + /** + * Get the value property: The value of the secret. NOTE: 'value' will never be returned from the service, as APIs + * using this model are is intended for internal use in ARM deployments. Users should use the data-plane REST + * service for interaction with vault secrets. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The value of the secret. NOTE: 'value' will never be returned from the service, as APIs + * using this model are is intended for internal use in ARM deployments. Users should use the data-plane REST + * service for interaction with vault secrets. + * + * @param value the value value to set. + * @return the SecretProperties object itself. + */ + public SecretProperties withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the contentType property: The content type of the secret. + * + * @return the contentType value. + */ + public String contentType() { + return this.contentType; + } + + /** + * Set the contentType property: The content type of the secret. + * + * @param contentType the contentType value to set. + * @return the SecretProperties object itself. + */ + public SecretProperties withContentType(String contentType) { + this.contentType = contentType; + return this; + } + + /** + * Get the attributes property: The attributes of the secret. + * + * @return the attributes value. + */ + public SecretAttributes attributes() { + return this.attributes; + } + + /** + * Set the attributes property: The attributes of the secret. + * + * @param attributes the attributes value to set. + * @return the SecretProperties object itself. + */ + public SecretProperties withAttributes(SecretAttributes attributes) { + this.attributes = attributes; + return this; + } + + /** + * Get the secretUri property: The URI to retrieve the current version of the secret. + * + * @return the secretUri value. + */ + public String secretUri() { + return this.secretUri; + } + + /** + * Get the secretUriWithVersion property: The URI to retrieve the specific version of the secret. + * + * @return the secretUriWithVersion value. + */ + public String secretUriWithVersion() { + return this.secretUriWithVersion; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (attributes() != null) { + attributes().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("value", this.value); + jsonWriter.writeStringField("contentType", this.contentType); + jsonWriter.writeJsonField("attributes", this.attributes); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecretProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecretProperties 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 SecretProperties. + */ + public static SecretProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecretProperties deserializedSecretProperties = new SecretProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + deserializedSecretProperties.value = reader.getString(); + } else if ("contentType".equals(fieldName)) { + deserializedSecretProperties.contentType = reader.getString(); + } else if ("attributes".equals(fieldName)) { + deserializedSecretProperties.attributes = SecretAttributes.fromJson(reader); + } else if ("secretUri".equals(fieldName)) { + deserializedSecretProperties.secretUri = reader.getString(); + } else if ("secretUriWithVersion".equals(fieldName)) { + deserializedSecretProperties.secretUriWithVersion = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSecretProperties; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/VaultAccessPolicyParametersInner.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/VaultAccessPolicyParametersInner.java new file mode 100644 index 000000000000..4b8f1789869a --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/VaultAccessPolicyParametersInner.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.fluent.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 com.azure.resourcemanager.keyvault.generated.models.VaultAccessPolicyProperties; +import java.io.IOException; + +/** + * Parameters for updating the access policy in a vault. + */ +@Fluent +public final class VaultAccessPolicyParametersInner implements JsonSerializable { + /* + * The resource id of the access policy. + */ + private String id; + + /* + * The resource name of the access policy. + */ + private String name; + + /* + * The resource name of the access policy. + */ + private String type; + + /* + * The resource type of the access policy. + */ + private String location; + + /* + * Properties of the access policy + */ + private VaultAccessPolicyProperties properties; + + /** + * Creates an instance of VaultAccessPolicyParametersInner class. + */ + public VaultAccessPolicyParametersInner() { + } + + /** + * Get the id property: The resource id of the access policy. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the name property: The resource name of the access policy. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the type property: The resource name of the access policy. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the location property: The resource type of the access policy. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the properties property: Properties of the access policy. + * + * @return the properties value. + */ + public VaultAccessPolicyProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of the access policy. + * + * @param properties the properties value to set. + * @return the VaultAccessPolicyParametersInner object itself. + */ + public VaultAccessPolicyParametersInner withProperties(VaultAccessPolicyProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property properties in model VaultAccessPolicyParametersInner")); + } else { + properties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VaultAccessPolicyParametersInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VaultAccessPolicyParametersInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VaultAccessPolicyParametersInner 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 VaultAccessPolicyParametersInner. + */ + public static VaultAccessPolicyParametersInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VaultAccessPolicyParametersInner deserializedVaultAccessPolicyParametersInner + = new VaultAccessPolicyParametersInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedVaultAccessPolicyParametersInner.properties + = VaultAccessPolicyProperties.fromJson(reader); + } else if ("id".equals(fieldName)) { + deserializedVaultAccessPolicyParametersInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedVaultAccessPolicyParametersInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedVaultAccessPolicyParametersInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedVaultAccessPolicyParametersInner.location = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedVaultAccessPolicyParametersInner; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/VaultInner.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/VaultInner.java new file mode 100644 index 000000000000..8ac6e3443615 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/VaultInner.java @@ -0,0 +1,597 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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.keyvault.generated.models.AccessPolicyEntry; +import com.azure.resourcemanager.keyvault.generated.models.KeyVaultCreateMode; +import com.azure.resourcemanager.keyvault.generated.models.KeyVaultProvisioningState; +import com.azure.resourcemanager.keyvault.generated.models.NetworkRuleSet; +import com.azure.resourcemanager.keyvault.generated.models.PrivateEndpointConnectionItem; +import com.azure.resourcemanager.keyvault.generated.models.Sku; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +/** + * Resource information with extended details. + */ +@Fluent +public final class VaultInner extends Resource { + /* + * Properties of the vault + */ + private VaultProperties innerProperties = new VaultProperties(); + + /* + * 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 VaultInner class. + */ + public VaultInner() { + } + + /** + * Get the innerProperties property: Properties of the vault. + * + * @return the innerProperties value. + */ + private VaultProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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; + } + + /** + * {@inheritDoc} + */ + @Override + public VaultInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public VaultInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the tenantId property: The Azure Active Directory tenant ID that should be used for authenticating requests + * to the key vault. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: The Azure Active Directory tenant ID that should be used for authenticating requests + * to the key vault. + * + * @param tenantId the tenantId value to set. + * @return the VaultInner object itself. + */ + public VaultInner withTenantId(UUID tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new VaultProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Get the sku property: SKU details. + * + * @return the sku value. + */ + public Sku sku() { + return this.innerProperties() == null ? null : this.innerProperties().sku(); + } + + /** + * Set the sku property: SKU details. + * + * @param sku the sku value to set. + * @return the VaultInner object itself. + */ + public VaultInner withSku(Sku sku) { + if (this.innerProperties() == null) { + this.innerProperties = new VaultProperties(); + } + this.innerProperties().withSku(sku); + return this; + } + + /** + * Get the accessPolicies property: An array of 0 to 1024 identities that have access to the key vault. All + * identities in the array must use the same tenant ID as the key vault's tenant ID. When `createMode` is set to + * `recover`, access policies are not required. Otherwise, access policies are required. + * + * @return the accessPolicies value. + */ + public List accessPolicies() { + return this.innerProperties() == null ? null : this.innerProperties().accessPolicies(); + } + + /** + * Set the accessPolicies property: An array of 0 to 1024 identities that have access to the key vault. All + * identities in the array must use the same tenant ID as the key vault's tenant ID. When `createMode` is set to + * `recover`, access policies are not required. Otherwise, access policies are required. + * + * @param accessPolicies the accessPolicies value to set. + * @return the VaultInner object itself. + */ + public VaultInner withAccessPolicies(List accessPolicies) { + if (this.innerProperties() == null) { + this.innerProperties = new VaultProperties(); + } + this.innerProperties().withAccessPolicies(accessPolicies); + return this; + } + + /** + * Get the vaultUri property: The URI of the vault for performing operations on keys and secrets. + * + * @return the vaultUri value. + */ + public String vaultUri() { + return this.innerProperties() == null ? null : this.innerProperties().vaultUri(); + } + + /** + * Set the vaultUri property: The URI of the vault for performing operations on keys and secrets. + * + * @param vaultUri the vaultUri value to set. + * @return the VaultInner object itself. + */ + public VaultInner withVaultUri(String vaultUri) { + if (this.innerProperties() == null) { + this.innerProperties = new VaultProperties(); + } + this.innerProperties().withVaultUri(vaultUri); + return this; + } + + /** + * Get the hsmPoolResourceId property: The resource id of HSM Pool. + * + * @return the hsmPoolResourceId value. + */ + public String hsmPoolResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().hsmPoolResourceId(); + } + + /** + * Get the enabledForDeployment property: Property to specify whether Azure Virtual Machines are permitted to + * retrieve certificates stored as secrets from the key vault. + * + * @return the enabledForDeployment value. + */ + public Boolean enabledForDeployment() { + return this.innerProperties() == null ? null : this.innerProperties().enabledForDeployment(); + } + + /** + * Set the enabledForDeployment property: Property to specify whether Azure Virtual Machines are permitted to + * retrieve certificates stored as secrets from the key vault. + * + * @param enabledForDeployment the enabledForDeployment value to set. + * @return the VaultInner object itself. + */ + public VaultInner withEnabledForDeployment(Boolean enabledForDeployment) { + if (this.innerProperties() == null) { + this.innerProperties = new VaultProperties(); + } + this.innerProperties().withEnabledForDeployment(enabledForDeployment); + return this; + } + + /** + * Get the enabledForDiskEncryption property: Property to specify whether Azure Disk Encryption is permitted to + * retrieve secrets from the vault and unwrap keys. + * + * @return the enabledForDiskEncryption value. + */ + public Boolean enabledForDiskEncryption() { + return this.innerProperties() == null ? null : this.innerProperties().enabledForDiskEncryption(); + } + + /** + * Set the enabledForDiskEncryption property: Property to specify whether Azure Disk Encryption is permitted to + * retrieve secrets from the vault and unwrap keys. + * + * @param enabledForDiskEncryption the enabledForDiskEncryption value to set. + * @return the VaultInner object itself. + */ + public VaultInner withEnabledForDiskEncryption(Boolean enabledForDiskEncryption) { + if (this.innerProperties() == null) { + this.innerProperties = new VaultProperties(); + } + this.innerProperties().withEnabledForDiskEncryption(enabledForDiskEncryption); + return this; + } + + /** + * Get the enabledForTemplateDeployment property: Property to specify whether Azure Resource Manager is permitted to + * retrieve secrets from the key vault. + * + * @return the enabledForTemplateDeployment value. + */ + public Boolean enabledForTemplateDeployment() { + return this.innerProperties() == null ? null : this.innerProperties().enabledForTemplateDeployment(); + } + + /** + * Set the enabledForTemplateDeployment property: Property to specify whether Azure Resource Manager is permitted to + * retrieve secrets from the key vault. + * + * @param enabledForTemplateDeployment the enabledForTemplateDeployment value to set. + * @return the VaultInner object itself. + */ + public VaultInner withEnabledForTemplateDeployment(Boolean enabledForTemplateDeployment) { + if (this.innerProperties() == null) { + this.innerProperties = new VaultProperties(); + } + this.innerProperties().withEnabledForTemplateDeployment(enabledForTemplateDeployment); + return this; + } + + /** + * Get the enableSoftDelete property: Property to specify whether the 'soft delete' functionality is enabled for + * this key vault. If it's not set to any value(true or false) when creating new key vault, it will be set to true + * by default. Once set to true, it cannot be reverted to false. + * + * @return the enableSoftDelete value. + */ + public Boolean enableSoftDelete() { + return this.innerProperties() == null ? null : this.innerProperties().enableSoftDelete(); + } + + /** + * Set the enableSoftDelete property: Property to specify whether the 'soft delete' functionality is enabled for + * this key vault. If it's not set to any value(true or false) when creating new key vault, it will be set to true + * by default. Once set to true, it cannot be reverted to false. + * + * @param enableSoftDelete the enableSoftDelete value to set. + * @return the VaultInner object itself. + */ + public VaultInner withEnableSoftDelete(Boolean enableSoftDelete) { + if (this.innerProperties() == null) { + this.innerProperties = new VaultProperties(); + } + this.innerProperties().withEnableSoftDelete(enableSoftDelete); + return this; + } + + /** + * Get the softDeleteRetentionInDays property: softDelete data retention days. It accepts >=7 and <=90. + * + * @return the softDeleteRetentionInDays value. + */ + public Integer softDeleteRetentionInDays() { + return this.innerProperties() == null ? null : this.innerProperties().softDeleteRetentionInDays(); + } + + /** + * Set the softDeleteRetentionInDays property: softDelete data retention days. It accepts >=7 and <=90. + * + * @param softDeleteRetentionInDays the softDeleteRetentionInDays value to set. + * @return the VaultInner object itself. + */ + public VaultInner withSoftDeleteRetentionInDays(Integer softDeleteRetentionInDays) { + if (this.innerProperties() == null) { + this.innerProperties = new VaultProperties(); + } + this.innerProperties().withSoftDeleteRetentionInDays(softDeleteRetentionInDays); + return this; + } + + /** + * Get the enableRbacAuthorization property: Property that controls how data actions are authorized. When true, the + * key vault will use Role Based Access Control (RBAC) for authorization of data actions, and the access policies + * specified in vault properties will be ignored. When false, the key vault will use the access policies specified + * in vault properties, and any policy stored on Azure Resource Manager will be ignored. If null or not specified, + * the vault is created with the default value of false. Note that management actions are always authorized with + * RBAC. + * + * @return the enableRbacAuthorization value. + */ + public Boolean enableRbacAuthorization() { + return this.innerProperties() == null ? null : this.innerProperties().enableRbacAuthorization(); + } + + /** + * Set the enableRbacAuthorization property: Property that controls how data actions are authorized. When true, the + * key vault will use Role Based Access Control (RBAC) for authorization of data actions, and the access policies + * specified in vault properties will be ignored. When false, the key vault will use the access policies specified + * in vault properties, and any policy stored on Azure Resource Manager will be ignored. If null or not specified, + * the vault is created with the default value of false. Note that management actions are always authorized with + * RBAC. + * + * @param enableRbacAuthorization the enableRbacAuthorization value to set. + * @return the VaultInner object itself. + */ + public VaultInner withEnableRbacAuthorization(Boolean enableRbacAuthorization) { + if (this.innerProperties() == null) { + this.innerProperties = new VaultProperties(); + } + this.innerProperties().withEnableRbacAuthorization(enableRbacAuthorization); + return this; + } + + /** + * Get the createMode property: The vault's create mode to indicate whether the vault need to be recovered or not. + * + * @return the createMode value. + */ + public KeyVaultCreateMode createMode() { + return this.innerProperties() == null ? null : this.innerProperties().createMode(); + } + + /** + * Set the createMode property: The vault's create mode to indicate whether the vault need to be recovered or not. + * + * @param createMode the createMode value to set. + * @return the VaultInner object itself. + */ + public VaultInner withCreateMode(KeyVaultCreateMode createMode) { + if (this.innerProperties() == null) { + this.innerProperties = new VaultProperties(); + } + this.innerProperties().withCreateMode(createMode); + return this; + } + + /** + * Get the enablePurgeProtection property: Property specifying whether protection against purge is enabled for this + * vault. Setting this property to true activates protection against purge for this vault and its content - only the + * Key Vault service may initiate a hard, irrecoverable deletion. The setting is effective only if soft delete is + * also enabled. Enabling this functionality is irreversible - that is, the property does not accept false as its + * value. + * + * @return the enablePurgeProtection value. + */ + public Boolean enablePurgeProtection() { + return this.innerProperties() == null ? null : this.innerProperties().enablePurgeProtection(); + } + + /** + * Set the enablePurgeProtection property: Property specifying whether protection against purge is enabled for this + * vault. Setting this property to true activates protection against purge for this vault and its content - only the + * Key Vault service may initiate a hard, irrecoverable deletion. The setting is effective only if soft delete is + * also enabled. Enabling this functionality is irreversible - that is, the property does not accept false as its + * value. + * + * @param enablePurgeProtection the enablePurgeProtection value to set. + * @return the VaultInner object itself. + */ + public VaultInner withEnablePurgeProtection(Boolean enablePurgeProtection) { + if (this.innerProperties() == null) { + this.innerProperties = new VaultProperties(); + } + this.innerProperties().withEnablePurgeProtection(enablePurgeProtection); + return this; + } + + /** + * Get the networkAcls property: Rules governing the accessibility of the key vault from specific network locations. + * + * @return the networkAcls value. + */ + public NetworkRuleSet networkAcls() { + return this.innerProperties() == null ? null : this.innerProperties().networkAcls(); + } + + /** + * Set the networkAcls property: Rules governing the accessibility of the key vault from specific network locations. + * + * @param networkAcls the networkAcls value to set. + * @return the VaultInner object itself. + */ + public VaultInner withNetworkAcls(NetworkRuleSet networkAcls) { + if (this.innerProperties() == null) { + this.innerProperties = new VaultProperties(); + } + this.innerProperties().withNetworkAcls(networkAcls); + return this; + } + + /** + * Get the provisioningState property: Provisioning state of the vault. + * + * @return the provisioningState value. + */ + public KeyVaultProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Set the provisioningState property: Provisioning state of the vault. + * + * @param provisioningState the provisioningState value to set. + * @return the VaultInner object itself. + */ + public VaultInner withProvisioningState(KeyVaultProvisioningState provisioningState) { + if (this.innerProperties() == null) { + this.innerProperties = new VaultProperties(); + } + this.innerProperties().withProvisioningState(provisioningState); + return this; + } + + /** + * Get the privateEndpointConnections property: List of private endpoint connections associated with the key vault. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.innerProperties() == null ? null : this.innerProperties().privateEndpointConnections(); + } + + /** + * Get the publicNetworkAccess property: Property to specify whether the vault will accept traffic from public + * internet. If set to 'disabled' all traffic except private endpoint traffic and that that originates from trusted + * services will be blocked. This will override the set firewall rules, meaning that even if the firewall rules are + * present we will not honor the rules. + * + * @return the publicNetworkAccess value. + */ + public String publicNetworkAccess() { + return this.innerProperties() == null ? null : this.innerProperties().publicNetworkAccess(); + } + + /** + * Set the publicNetworkAccess property: Property to specify whether the vault will accept traffic from public + * internet. If set to 'disabled' all traffic except private endpoint traffic and that that originates from trusted + * services will be blocked. This will override the set firewall rules, meaning that even if the firewall rules are + * present we will not honor the rules. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the VaultInner object itself. + */ + public VaultInner withPublicNetworkAccess(String publicNetworkAccess) { + if (this.innerProperties() == null) { + this.innerProperties = new VaultProperties(); + } + this.innerProperties().withPublicNetworkAccess(publicNetworkAccess); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property innerProperties in model VaultInner")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VaultInner.class); + + /** + * {@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("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VaultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VaultInner 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 VaultInner. + */ + public static VaultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VaultInner deserializedVaultInner = new VaultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedVaultInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedVaultInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedVaultInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedVaultInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedVaultInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedVaultInner.innerProperties = VaultProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedVaultInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedVaultInner; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/VaultProperties.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/VaultProperties.java new file mode 100644 index 000000000000..23e0c7720d57 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/VaultProperties.java @@ -0,0 +1,613 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.fluent.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 com.azure.resourcemanager.keyvault.generated.models.AccessPolicyEntry; +import com.azure.resourcemanager.keyvault.generated.models.KeyVaultCreateMode; +import com.azure.resourcemanager.keyvault.generated.models.KeyVaultProvisioningState; +import com.azure.resourcemanager.keyvault.generated.models.NetworkRuleSet; +import com.azure.resourcemanager.keyvault.generated.models.PrivateEndpointConnectionItem; +import com.azure.resourcemanager.keyvault.generated.models.Sku; +import java.io.IOException; +import java.util.List; +import java.util.Objects; +import java.util.UUID; + +/** + * Properties of the vault. + */ +@Fluent +public final class VaultProperties implements JsonSerializable { + /* + * The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault. + */ + private UUID tenantId; + + /* + * SKU details + */ + private Sku sku; + + /* + * An array of 0 to 1024 identities that have access to the key vault. All identities in the array must use the same + * tenant ID as the key vault's tenant ID. When `createMode` is set to `recover`, access policies are not required. + * Otherwise, access policies are required. + */ + private List accessPolicies; + + /* + * The URI of the vault for performing operations on keys and secrets. + */ + private String vaultUri; + + /* + * The resource id of HSM Pool. + */ + private String hsmPoolResourceId; + + /* + * Property to specify whether Azure Virtual Machines are permitted to retrieve certificates stored as secrets from + * the key vault. + */ + private Boolean enabledForDeployment; + + /* + * Property to specify whether Azure Disk Encryption is permitted to retrieve secrets from the vault and unwrap + * keys. + */ + private Boolean enabledForDiskEncryption; + + /* + * Property to specify whether Azure Resource Manager is permitted to retrieve secrets from the key vault. + */ + private Boolean enabledForTemplateDeployment; + + /* + * Property to specify whether the 'soft delete' functionality is enabled for this key vault. If it's not set to any + * value(true or false) when creating new key vault, it will be set to true by default. Once set to true, it cannot + * be reverted to false. + */ + private Boolean enableSoftDelete; + + /* + * softDelete data retention days. It accepts >=7 and <=90. + */ + private Integer softDeleteRetentionInDays; + + /* + * Property that controls how data actions are authorized. When true, the key vault will use Role Based Access + * Control (RBAC) for authorization of data actions, and the access policies specified in vault properties will be + * ignored. When false, the key vault will use the access policies specified in vault properties, and any policy + * stored on Azure Resource Manager will be ignored. If null or not specified, the vault is created with the default + * value of false. Note that management actions are always authorized with RBAC. + */ + private Boolean enableRbacAuthorization; + + /* + * The vault's create mode to indicate whether the vault need to be recovered or not. + */ + private KeyVaultCreateMode createMode; + + /* + * Property specifying whether protection against purge is enabled for this vault. Setting this property to true + * activates protection against purge for this vault and its content - only the Key Vault service may initiate a + * hard, irrecoverable deletion. The setting is effective only if soft delete is also enabled. Enabling this + * functionality is irreversible - that is, the property does not accept false as its value. + */ + private Boolean enablePurgeProtection; + + /* + * Rules governing the accessibility of the key vault from specific network locations. + */ + private NetworkRuleSet networkAcls; + + /* + * Provisioning state of the vault. + */ + private KeyVaultProvisioningState provisioningState; + + /* + * List of private endpoint connections associated with the key vault. + */ + private List privateEndpointConnections; + + /* + * Property to specify whether the vault will accept traffic from public internet. If set to 'disabled' all traffic + * except private endpoint traffic and that that originates from trusted services will be blocked. This will + * override the set firewall rules, meaning that even if the firewall rules are present we will not honor the rules. + */ + private String publicNetworkAccess; + + /** + * Creates an instance of VaultProperties class. + */ + public VaultProperties() { + } + + /** + * Get the tenantId property: The Azure Active Directory tenant ID that should be used for authenticating requests + * to the key vault. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: The Azure Active Directory tenant ID that should be used for authenticating requests + * to the key vault. + * + * @param tenantId the tenantId value to set. + * @return the VaultProperties object itself. + */ + public VaultProperties withTenantId(UUID tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the sku property: SKU details. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: SKU details. + * + * @param sku the sku value to set. + * @return the VaultProperties object itself. + */ + public VaultProperties withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the accessPolicies property: An array of 0 to 1024 identities that have access to the key vault. All + * identities in the array must use the same tenant ID as the key vault's tenant ID. When `createMode` is set to + * `recover`, access policies are not required. Otherwise, access policies are required. + * + * @return the accessPolicies value. + */ + public List accessPolicies() { + return this.accessPolicies; + } + + /** + * Set the accessPolicies property: An array of 0 to 1024 identities that have access to the key vault. All + * identities in the array must use the same tenant ID as the key vault's tenant ID. When `createMode` is set to + * `recover`, access policies are not required. Otherwise, access policies are required. + * + * @param accessPolicies the accessPolicies value to set. + * @return the VaultProperties object itself. + */ + public VaultProperties withAccessPolicies(List accessPolicies) { + this.accessPolicies = accessPolicies; + return this; + } + + /** + * Get the vaultUri property: The URI of the vault for performing operations on keys and secrets. + * + * @return the vaultUri value. + */ + public String vaultUri() { + return this.vaultUri; + } + + /** + * Set the vaultUri property: The URI of the vault for performing operations on keys and secrets. + * + * @param vaultUri the vaultUri value to set. + * @return the VaultProperties object itself. + */ + public VaultProperties withVaultUri(String vaultUri) { + this.vaultUri = vaultUri; + return this; + } + + /** + * Get the hsmPoolResourceId property: The resource id of HSM Pool. + * + * @return the hsmPoolResourceId value. + */ + public String hsmPoolResourceId() { + return this.hsmPoolResourceId; + } + + /** + * Get the enabledForDeployment property: Property to specify whether Azure Virtual Machines are permitted to + * retrieve certificates stored as secrets from the key vault. + * + * @return the enabledForDeployment value. + */ + public Boolean enabledForDeployment() { + return this.enabledForDeployment; + } + + /** + * Set the enabledForDeployment property: Property to specify whether Azure Virtual Machines are permitted to + * retrieve certificates stored as secrets from the key vault. + * + * @param enabledForDeployment the enabledForDeployment value to set. + * @return the VaultProperties object itself. + */ + public VaultProperties withEnabledForDeployment(Boolean enabledForDeployment) { + this.enabledForDeployment = enabledForDeployment; + return this; + } + + /** + * Get the enabledForDiskEncryption property: Property to specify whether Azure Disk Encryption is permitted to + * retrieve secrets from the vault and unwrap keys. + * + * @return the enabledForDiskEncryption value. + */ + public Boolean enabledForDiskEncryption() { + return this.enabledForDiskEncryption; + } + + /** + * Set the enabledForDiskEncryption property: Property to specify whether Azure Disk Encryption is permitted to + * retrieve secrets from the vault and unwrap keys. + * + * @param enabledForDiskEncryption the enabledForDiskEncryption value to set. + * @return the VaultProperties object itself. + */ + public VaultProperties withEnabledForDiskEncryption(Boolean enabledForDiskEncryption) { + this.enabledForDiskEncryption = enabledForDiskEncryption; + return this; + } + + /** + * Get the enabledForTemplateDeployment property: Property to specify whether Azure Resource Manager is permitted to + * retrieve secrets from the key vault. + * + * @return the enabledForTemplateDeployment value. + */ + public Boolean enabledForTemplateDeployment() { + return this.enabledForTemplateDeployment; + } + + /** + * Set the enabledForTemplateDeployment property: Property to specify whether Azure Resource Manager is permitted to + * retrieve secrets from the key vault. + * + * @param enabledForTemplateDeployment the enabledForTemplateDeployment value to set. + * @return the VaultProperties object itself. + */ + public VaultProperties withEnabledForTemplateDeployment(Boolean enabledForTemplateDeployment) { + this.enabledForTemplateDeployment = enabledForTemplateDeployment; + return this; + } + + /** + * Get the enableSoftDelete property: Property to specify whether the 'soft delete' functionality is enabled for + * this key vault. If it's not set to any value(true or false) when creating new key vault, it will be set to true + * by default. Once set to true, it cannot be reverted to false. + * + * @return the enableSoftDelete value. + */ + public Boolean enableSoftDelete() { + return this.enableSoftDelete; + } + + /** + * Set the enableSoftDelete property: Property to specify whether the 'soft delete' functionality is enabled for + * this key vault. If it's not set to any value(true or false) when creating new key vault, it will be set to true + * by default. Once set to true, it cannot be reverted to false. + * + * @param enableSoftDelete the enableSoftDelete value to set. + * @return the VaultProperties object itself. + */ + public VaultProperties withEnableSoftDelete(Boolean enableSoftDelete) { + this.enableSoftDelete = enableSoftDelete; + return this; + } + + /** + * Get the softDeleteRetentionInDays property: softDelete data retention days. It accepts >=7 and <=90. + * + * @return the softDeleteRetentionInDays value. + */ + public Integer softDeleteRetentionInDays() { + return this.softDeleteRetentionInDays; + } + + /** + * Set the softDeleteRetentionInDays property: softDelete data retention days. It accepts >=7 and <=90. + * + * @param softDeleteRetentionInDays the softDeleteRetentionInDays value to set. + * @return the VaultProperties object itself. + */ + public VaultProperties withSoftDeleteRetentionInDays(Integer softDeleteRetentionInDays) { + this.softDeleteRetentionInDays = softDeleteRetentionInDays; + return this; + } + + /** + * Get the enableRbacAuthorization property: Property that controls how data actions are authorized. When true, the + * key vault will use Role Based Access Control (RBAC) for authorization of data actions, and the access policies + * specified in vault properties will be ignored. When false, the key vault will use the access policies specified + * in vault properties, and any policy stored on Azure Resource Manager will be ignored. If null or not specified, + * the vault is created with the default value of false. Note that management actions are always authorized with + * RBAC. + * + * @return the enableRbacAuthorization value. + */ + public Boolean enableRbacAuthorization() { + return this.enableRbacAuthorization; + } + + /** + * Set the enableRbacAuthorization property: Property that controls how data actions are authorized. When true, the + * key vault will use Role Based Access Control (RBAC) for authorization of data actions, and the access policies + * specified in vault properties will be ignored. When false, the key vault will use the access policies specified + * in vault properties, and any policy stored on Azure Resource Manager will be ignored. If null or not specified, + * the vault is created with the default value of false. Note that management actions are always authorized with + * RBAC. + * + * @param enableRbacAuthorization the enableRbacAuthorization value to set. + * @return the VaultProperties object itself. + */ + public VaultProperties withEnableRbacAuthorization(Boolean enableRbacAuthorization) { + this.enableRbacAuthorization = enableRbacAuthorization; + return this; + } + + /** + * Get the createMode property: The vault's create mode to indicate whether the vault need to be recovered or not. + * + * @return the createMode value. + */ + public KeyVaultCreateMode createMode() { + return this.createMode; + } + + /** + * Set the createMode property: The vault's create mode to indicate whether the vault need to be recovered or not. + * + * @param createMode the createMode value to set. + * @return the VaultProperties object itself. + */ + public VaultProperties withCreateMode(KeyVaultCreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Get the enablePurgeProtection property: Property specifying whether protection against purge is enabled for this + * vault. Setting this property to true activates protection against purge for this vault and its content - only the + * Key Vault service may initiate a hard, irrecoverable deletion. The setting is effective only if soft delete is + * also enabled. Enabling this functionality is irreversible - that is, the property does not accept false as its + * value. + * + * @return the enablePurgeProtection value. + */ + public Boolean enablePurgeProtection() { + return this.enablePurgeProtection; + } + + /** + * Set the enablePurgeProtection property: Property specifying whether protection against purge is enabled for this + * vault. Setting this property to true activates protection against purge for this vault and its content - only the + * Key Vault service may initiate a hard, irrecoverable deletion. The setting is effective only if soft delete is + * also enabled. Enabling this functionality is irreversible - that is, the property does not accept false as its + * value. + * + * @param enablePurgeProtection the enablePurgeProtection value to set. + * @return the VaultProperties object itself. + */ + public VaultProperties withEnablePurgeProtection(Boolean enablePurgeProtection) { + this.enablePurgeProtection = enablePurgeProtection; + return this; + } + + /** + * Get the networkAcls property: Rules governing the accessibility of the key vault from specific network locations. + * + * @return the networkAcls value. + */ + public NetworkRuleSet networkAcls() { + return this.networkAcls; + } + + /** + * Set the networkAcls property: Rules governing the accessibility of the key vault from specific network locations. + * + * @param networkAcls the networkAcls value to set. + * @return the VaultProperties object itself. + */ + public VaultProperties withNetworkAcls(NetworkRuleSet networkAcls) { + this.networkAcls = networkAcls; + return this; + } + + /** + * Get the provisioningState property: Provisioning state of the vault. + * + * @return the provisioningState value. + */ + public KeyVaultProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState property: Provisioning state of the vault. + * + * @param provisioningState the provisioningState value to set. + * @return the VaultProperties object itself. + */ + public VaultProperties withProvisioningState(KeyVaultProvisioningState provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the privateEndpointConnections property: List of private endpoint connections associated with the key vault. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** + * Get the publicNetworkAccess property: Property to specify whether the vault will accept traffic from public + * internet. If set to 'disabled' all traffic except private endpoint traffic and that that originates from trusted + * services will be blocked. This will override the set firewall rules, meaning that even if the firewall rules are + * present we will not honor the rules. + * + * @return the publicNetworkAccess value. + */ + public String publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * Set the publicNetworkAccess property: Property to specify whether the vault will accept traffic from public + * internet. If set to 'disabled' all traffic except private endpoint traffic and that that originates from trusted + * services will be blocked. This will override the set firewall rules, meaning that even if the firewall rules are + * present we will not honor the rules. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the VaultProperties object itself. + */ + public VaultProperties withPublicNetworkAccess(String publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (tenantId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property tenantId in model VaultProperties")); + } + if (sku() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property sku in model VaultProperties")); + } else { + sku().validate(); + } + if (accessPolicies() != null) { + accessPolicies().forEach(e -> e.validate()); + } + if (networkAcls() != null) { + networkAcls().validate(); + } + if (privateEndpointConnections() != null) { + privateEndpointConnections().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VaultProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("tenantId", Objects.toString(this.tenantId, null)); + jsonWriter.writeJsonField("sku", this.sku); + jsonWriter.writeArrayField("accessPolicies", this.accessPolicies, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("vaultUri", this.vaultUri); + jsonWriter.writeBooleanField("enabledForDeployment", this.enabledForDeployment); + jsonWriter.writeBooleanField("enabledForDiskEncryption", this.enabledForDiskEncryption); + jsonWriter.writeBooleanField("enabledForTemplateDeployment", this.enabledForTemplateDeployment); + jsonWriter.writeBooleanField("enableSoftDelete", this.enableSoftDelete); + jsonWriter.writeNumberField("softDeleteRetentionInDays", this.softDeleteRetentionInDays); + jsonWriter.writeBooleanField("enableRbacAuthorization", this.enableRbacAuthorization); + jsonWriter.writeStringField("createMode", this.createMode == null ? null : this.createMode.toString()); + jsonWriter.writeBooleanField("enablePurgeProtection", this.enablePurgeProtection); + jsonWriter.writeJsonField("networkAcls", this.networkAcls); + jsonWriter.writeStringField("provisioningState", + this.provisioningState == null ? null : this.provisioningState.toString()); + jsonWriter.writeStringField("publicNetworkAccess", this.publicNetworkAccess); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VaultProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VaultProperties 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 VaultProperties. + */ + public static VaultProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VaultProperties deserializedVaultProperties = new VaultProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tenantId".equals(fieldName)) { + deserializedVaultProperties.tenantId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("sku".equals(fieldName)) { + deserializedVaultProperties.sku = Sku.fromJson(reader); + } else if ("accessPolicies".equals(fieldName)) { + List accessPolicies + = reader.readArray(reader1 -> AccessPolicyEntry.fromJson(reader1)); + deserializedVaultProperties.accessPolicies = accessPolicies; + } else if ("vaultUri".equals(fieldName)) { + deserializedVaultProperties.vaultUri = reader.getString(); + } else if ("hsmPoolResourceId".equals(fieldName)) { + deserializedVaultProperties.hsmPoolResourceId = reader.getString(); + } else if ("enabledForDeployment".equals(fieldName)) { + deserializedVaultProperties.enabledForDeployment = reader.getNullable(JsonReader::getBoolean); + } else if ("enabledForDiskEncryption".equals(fieldName)) { + deserializedVaultProperties.enabledForDiskEncryption = reader.getNullable(JsonReader::getBoolean); + } else if ("enabledForTemplateDeployment".equals(fieldName)) { + deserializedVaultProperties.enabledForTemplateDeployment + = reader.getNullable(JsonReader::getBoolean); + } else if ("enableSoftDelete".equals(fieldName)) { + deserializedVaultProperties.enableSoftDelete = reader.getNullable(JsonReader::getBoolean); + } else if ("softDeleteRetentionInDays".equals(fieldName)) { + deserializedVaultProperties.softDeleteRetentionInDays = reader.getNullable(JsonReader::getInt); + } else if ("enableRbacAuthorization".equals(fieldName)) { + deserializedVaultProperties.enableRbacAuthorization = reader.getNullable(JsonReader::getBoolean); + } else if ("createMode".equals(fieldName)) { + deserializedVaultProperties.createMode = KeyVaultCreateMode.fromString(reader.getString()); + } else if ("enablePurgeProtection".equals(fieldName)) { + deserializedVaultProperties.enablePurgeProtection = reader.getNullable(JsonReader::getBoolean); + } else if ("networkAcls".equals(fieldName)) { + deserializedVaultProperties.networkAcls = NetworkRuleSet.fromJson(reader); + } else if ("provisioningState".equals(fieldName)) { + deserializedVaultProperties.provisioningState + = KeyVaultProvisioningState.fromString(reader.getString()); + } else if ("privateEndpointConnections".equals(fieldName)) { + List privateEndpointConnections + = reader.readArray(reader1 -> PrivateEndpointConnectionItem.fromJson(reader1)); + deserializedVaultProperties.privateEndpointConnections = privateEndpointConnections; + } else if ("publicNetworkAccess".equals(fieldName)) { + deserializedVaultProperties.publicNetworkAccess = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedVaultProperties; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/package-info.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/package-info.java new file mode 100644 index 000000000000..9792b9ea734c --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the inner data models for AzureStorageResourceManagementApi. + * The Azure management API provides a RESTful set of web services that interact with Azure Key Vault. + */ +package com.azure.resourcemanager.keyvault.generated.fluent.models; diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/package-info.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/package-info.java new file mode 100644 index 000000000000..f0894c39da02 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the service clients for AzureStorageResourceManagementApi. + * The Azure management API provides a RESTful set of web services that interact with Azure Key Vault. + */ +package com.azure.resourcemanager.keyvault.generated.fluent; diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/AzureStorageResourceManagementApiBuilder.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/AzureStorageResourceManagementApiBuilder.java new file mode 100644 index 000000000000..311cae964f8d --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/AzureStorageResourceManagementApiBuilder.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** + * A builder for creating a new instance of the AzureStorageResourceManagementApiImpl type. + */ +@ServiceClientBuilder(serviceClients = { AzureStorageResourceManagementApiImpl.class }) +public final class AzureStorageResourceManagementApiBuilder { + /* + * The ID of the target subscription. The value must be an UUID. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. The value must be an UUID. + * + * @param subscriptionId the subscriptionId value. + * @return the AzureStorageResourceManagementApiBuilder. + */ + public AzureStorageResourceManagementApiBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the AzureStorageResourceManagementApiBuilder. + */ + public AzureStorageResourceManagementApiBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the AzureStorageResourceManagementApiBuilder. + */ + public AzureStorageResourceManagementApiBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the AzureStorageResourceManagementApiBuilder. + */ + public AzureStorageResourceManagementApiBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the AzureStorageResourceManagementApiBuilder. + */ + public AzureStorageResourceManagementApiBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the AzureStorageResourceManagementApiBuilder. + */ + public AzureStorageResourceManagementApiBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of AzureStorageResourceManagementApiImpl with the provided parameters. + * + * @return an instance of AzureStorageResourceManagementApiImpl. + */ + public AzureStorageResourceManagementApiImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval + = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + AzureStorageResourceManagementApiImpl client = new AzureStorageResourceManagementApiImpl(localPipeline, + localSerializerAdapter, localDefaultPollInterval, localEnvironment, this.subscriptionId, localEndpoint); + return client; + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/AzureStorageResourceManagementApiImpl.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/AzureStorageResourceManagementApiImpl.java new file mode 100644 index 000000000000..4cc7ad9be321 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/AzureStorageResourceManagementApiImpl.java @@ -0,0 +1,416 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.keyvault.generated.fluent.AzureStorageResourceManagementApi; +import com.azure.resourcemanager.keyvault.generated.fluent.ManagedHsmsClient; +import com.azure.resourcemanager.keyvault.generated.fluent.MhsmPrivateEndpointConnectionsClient; +import com.azure.resourcemanager.keyvault.generated.fluent.MhsmPrivateLinkResourcesClient; +import com.azure.resourcemanager.keyvault.generated.fluent.MhsmRegionsClient; +import com.azure.resourcemanager.keyvault.generated.fluent.OperationsClient; +import com.azure.resourcemanager.keyvault.generated.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.keyvault.generated.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.keyvault.generated.fluent.SecretsClient; +import com.azure.resourcemanager.keyvault.generated.fluent.VaultsClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the AzureStorageResourceManagementApiImpl type. + */ +@ServiceClient(builder = AzureStorageResourceManagementApiBuilder.class) +public final class AzureStorageResourceManagementApiImpl implements AzureStorageResourceManagementApi { + /** + * The ID of the target subscription. The value must be an UUID. + */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** + * server parameter. + */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Api Version. + */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** + * The HTTP pipeline to send requests through. + */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** + * The serializer to serialize an object into a string. + */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** + * The default poll interval for long-running operation. + */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** + * 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; + } + + /** + * The ManagedHsmsClient object to access its operations. + */ + private final ManagedHsmsClient managedHsms; + + /** + * Gets the ManagedHsmsClient object to access its operations. + * + * @return the ManagedHsmsClient object. + */ + public ManagedHsmsClient getManagedHsms() { + return this.managedHsms; + } + + /** + * The VaultsClient object to access its operations. + */ + private final VaultsClient vaults; + + /** + * Gets the VaultsClient object to access its operations. + * + * @return the VaultsClient object. + */ + public VaultsClient getVaults() { + return this.vaults; + } + + /** + * The MhsmPrivateEndpointConnectionsClient object to access its operations. + */ + private final MhsmPrivateEndpointConnectionsClient mhsmPrivateEndpointConnections; + + /** + * Gets the MhsmPrivateEndpointConnectionsClient object to access its operations. + * + * @return the MhsmPrivateEndpointConnectionsClient object. + */ + public MhsmPrivateEndpointConnectionsClient getMhsmPrivateEndpointConnections() { + return this.mhsmPrivateEndpointConnections; + } + + /** + * The MhsmPrivateLinkResourcesClient object to access its operations. + */ + private final MhsmPrivateLinkResourcesClient mhsmPrivateLinkResources; + + /** + * Gets the MhsmPrivateLinkResourcesClient object to access its operations. + * + * @return the MhsmPrivateLinkResourcesClient object. + */ + public MhsmPrivateLinkResourcesClient getMhsmPrivateLinkResources() { + return this.mhsmPrivateLinkResources; + } + + /** + * The MhsmRegionsClient object to access its operations. + */ + private final MhsmRegionsClient mhsmRegions; + + /** + * Gets the MhsmRegionsClient object to access its operations. + * + * @return the MhsmRegionsClient object. + */ + public MhsmRegionsClient getMhsmRegions() { + return this.mhsmRegions; + } + + /** + * 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 PrivateLinkResourcesClient object to access its operations. + */ + private final PrivateLinkResourcesClient privateLinkResources; + + /** + * Gets the PrivateLinkResourcesClient object to access its operations. + * + * @return the PrivateLinkResourcesClient object. + */ + public PrivateLinkResourcesClient getPrivateLinkResources() { + return this.privateLinkResources; + } + + /** + * The SecretsClient object to access its operations. + */ + private final SecretsClient secrets; + + /** + * Gets the SecretsClient object to access its operations. + * + * @return the SecretsClient object. + */ + public SecretsClient getSecrets() { + return this.secrets; + } + + /** + * Initializes an instance of AzureStorageResourceManagementApi client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @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. The value must be an UUID. + * @param endpoint server parameter. + */ + AzureStorageResourceManagementApiImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + Duration defaultPollInterval, AzureEnvironment environment, String subscriptionId, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2024-11-01"; + this.operations = new OperationsClientImpl(this); + this.managedHsms = new ManagedHsmsClientImpl(this); + this.vaults = new VaultsClientImpl(this); + this.mhsmPrivateEndpointConnections = new MhsmPrivateEndpointConnectionsClientImpl(this); + this.mhsmPrivateLinkResources = new MhsmPrivateLinkResourcesClientImpl(this); + this.mhsmRegions = new MhsmRegionsClientImpl(this); + this.privateEndpointConnections = new PrivateEndpointConnectionsClientImpl(this); + this.privateLinkResources = new PrivateLinkResourcesClientImpl(this); + this.secrets = new SecretsClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult(Mono>> activationResponse, + HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { + return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, activationResponse, context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), + lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = this.getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(HttpHeaderName.fromString(s)); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AzureStorageResourceManagementApiImpl.class); +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/CheckMhsmNameAvailabilityResultImpl.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/CheckMhsmNameAvailabilityResultImpl.java new file mode 100644 index 000000000000..db99aedf2226 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/CheckMhsmNameAvailabilityResultImpl.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.implementation; + +import com.azure.resourcemanager.keyvault.generated.fluent.models.CheckMhsmNameAvailabilityResultInner; +import com.azure.resourcemanager.keyvault.generated.models.CheckMhsmNameAvailabilityResult; +import com.azure.resourcemanager.keyvault.generated.models.Reason; + +public final class CheckMhsmNameAvailabilityResultImpl implements CheckMhsmNameAvailabilityResult { + private CheckMhsmNameAvailabilityResultInner innerObject; + + private final com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager; + + CheckMhsmNameAvailabilityResultImpl(CheckMhsmNameAvailabilityResultInner innerObject, + com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Boolean nameAvailable() { + return this.innerModel().nameAvailable(); + } + + public Reason reason() { + return this.innerModel().reason(); + } + + public String message() { + return this.innerModel().message(); + } + + public CheckMhsmNameAvailabilityResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/CheckNameAvailabilityResultImpl.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/CheckNameAvailabilityResultImpl.java new file mode 100644 index 000000000000..9cc16364d2c3 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/CheckNameAvailabilityResultImpl.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.implementation; + +import com.azure.resourcemanager.keyvault.generated.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.keyvault.generated.models.CheckNameAvailabilityResult; +import com.azure.resourcemanager.keyvault.generated.models.KeyVaultNameUnavailableReason; + +public final class CheckNameAvailabilityResultImpl implements CheckNameAvailabilityResult { + private CheckNameAvailabilityResultInner innerObject; + + private final com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager; + + CheckNameAvailabilityResultImpl(CheckNameAvailabilityResultInner innerObject, + com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Boolean nameAvailable() { + return this.innerModel().nameAvailable(); + } + + public KeyVaultNameUnavailableReason reason() { + return this.innerModel().reason(); + } + + public String message() { + return this.innerModel().message(); + } + + public CheckNameAvailabilityResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/DeletedManagedHsmImpl.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/DeletedManagedHsmImpl.java new file mode 100644 index 000000000000..693ed2d70a5d --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/DeletedManagedHsmImpl.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.keyvault.generated.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.keyvault.generated.fluent.models.DeletedManagedHsmInner; +import com.azure.resourcemanager.keyvault.generated.models.DeletedManagedHsm; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.Map; + +public final class DeletedManagedHsmImpl implements DeletedManagedHsm { + private DeletedManagedHsmInner innerObject; + + private final com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager; + + DeletedManagedHsmImpl(DeletedManagedHsmInner innerObject, + com.azure.resourcemanager.keyvault.generated.KeyvaultManager 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public String mhsmId() { + return this.innerModel().mhsmId(); + } + + public String location() { + return this.innerModel().location(); + } + + public OffsetDateTime deletionDate() { + return this.innerModel().deletionDate(); + } + + public OffsetDateTime scheduledPurgeDate() { + return this.innerModel().scheduledPurgeDate(); + } + + public Boolean purgeProtectionEnabled() { + return this.innerModel().purgeProtectionEnabled(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public DeletedManagedHsmInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/DeletedVaultImpl.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/DeletedVaultImpl.java new file mode 100644 index 000000000000..cf64c86b3b33 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/DeletedVaultImpl.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.keyvault.generated.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.keyvault.generated.fluent.models.DeletedVaultInner; +import com.azure.resourcemanager.keyvault.generated.models.DeletedVault; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.Map; + +public final class DeletedVaultImpl implements DeletedVault { + private DeletedVaultInner innerObject; + + private final com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager; + + DeletedVaultImpl(DeletedVaultInner innerObject, + com.azure.resourcemanager.keyvault.generated.KeyvaultManager 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public String vaultId() { + return this.innerModel().vaultId(); + } + + public String location() { + return this.innerModel().location(); + } + + public OffsetDateTime deletionDate() { + return this.innerModel().deletionDate(); + } + + public OffsetDateTime scheduledPurgeDate() { + return this.innerModel().scheduledPurgeDate(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public Boolean purgeProtectionEnabled() { + return this.innerModel().purgeProtectionEnabled(); + } + + public DeletedVaultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/ManagedHsmImpl.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/ManagedHsmImpl.java new file mode 100644 index 000000000000..64542f48eca9 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/ManagedHsmImpl.java @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.keyvault.generated.fluent.models.ManagedHsmInner; +import com.azure.resourcemanager.keyvault.generated.fluent.models.MhsmGeoReplicatedRegionInner; +import com.azure.resourcemanager.keyvault.generated.models.CreateMode; +import com.azure.resourcemanager.keyvault.generated.models.ManagedHsm; +import com.azure.resourcemanager.keyvault.generated.models.ManagedHsmProvisioningState; +import com.azure.resourcemanager.keyvault.generated.models.ManagedHsmSecurityDomainProperties; +import com.azure.resourcemanager.keyvault.generated.models.MhsmGeoReplicatedRegion; +import com.azure.resourcemanager.keyvault.generated.models.MhsmNetworkRuleSet; +import com.azure.resourcemanager.keyvault.generated.models.MhsmPrivateEndpointConnectionItem; +import com.azure.resourcemanager.keyvault.generated.models.PublicNetworkAccess; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.stream.Collectors; + +public final class ManagedHsmImpl implements ManagedHsm, ManagedHsm.Definition, ManagedHsm.Update { + private ManagedHsmInner innerObject; + + private final com.azure.resourcemanager.keyvault.generated.KeyvaultManager 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public UUID tenantId() { + return this.innerModel().tenantId(); + } + + public List initialAdminObjectIds() { + List inner = this.innerModel().initialAdminObjectIds(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String hsmUri() { + return this.innerModel().hsmUri(); + } + + public Boolean enableSoftDelete() { + return this.innerModel().enableSoftDelete(); + } + + public Integer softDeleteRetentionInDays() { + return this.innerModel().softDeleteRetentionInDays(); + } + + public Boolean enablePurgeProtection() { + return this.innerModel().enablePurgeProtection(); + } + + public CreateMode createMode() { + return this.innerModel().createMode(); + } + + public String statusMessage() { + return this.innerModel().statusMessage(); + } + + public ManagedHsmProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public MhsmNetworkRuleSet networkAcls() { + return this.innerModel().networkAcls(); + } + + public List regions() { + List inner = this.innerModel().regions(); + if (inner != null) { + return Collections.unmodifiableList(inner.stream() + .map(inner1 -> new MhsmGeoReplicatedRegionImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public List privateEndpointConnections() { + List inner = this.innerModel().privateEndpointConnections(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public PublicNetworkAccess publicNetworkAccess() { + return this.innerModel().publicNetworkAccess(); + } + + public OffsetDateTime scheduledPurgeDate() { + return this.innerModel().scheduledPurgeDate(); + } + + public ManagedHsmSecurityDomainProperties securityDomainProperties() { + return this.innerModel().securityDomainProperties(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ManagedHsmInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String name; + + public ManagedHsmImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public ManagedHsm create() { + this.innerObject = serviceManager.serviceClient() + .getManagedHsms() + .createOrUpdate(resourceGroupName, name, this.innerModel(), Context.NONE); + return this; + } + + public ManagedHsm create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getManagedHsms() + .createOrUpdate(resourceGroupName, name, this.innerModel(), context); + return this; + } + + ManagedHsmImpl(String name, com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager) { + this.innerObject = new ManagedHsmInner(); + this.serviceManager = serviceManager; + this.name = name; + } + + public ManagedHsmImpl update() { + return this; + } + + public ManagedHsm apply() { + this.innerObject = serviceManager.serviceClient() + .getManagedHsms() + .update(resourceGroupName, name, this.innerModel(), Context.NONE); + return this; + } + + public ManagedHsm apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getManagedHsms() + .update(resourceGroupName, name, this.innerModel(), context); + return this; + } + + ManagedHsmImpl(ManagedHsmInner innerObject, + com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.name = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "managedHSMs"); + } + + public ManagedHsm refresh() { + this.innerObject = serviceManager.serviceClient() + .getManagedHsms() + .getByResourceGroupWithResponse(resourceGroupName, name, Context.NONE) + .getValue(); + return this; + } + + public ManagedHsm refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getManagedHsms() + .getByResourceGroupWithResponse(resourceGroupName, name, context) + .getValue(); + return this; + } + + public ManagedHsmImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ManagedHsmImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ManagedHsmImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public ManagedHsmImpl withTenantId(UUID tenantId) { + this.innerModel().withTenantId(tenantId); + return this; + } + + public ManagedHsmImpl withInitialAdminObjectIds(List initialAdminObjectIds) { + this.innerModel().withInitialAdminObjectIds(initialAdminObjectIds); + return this; + } + + public ManagedHsmImpl withEnableSoftDelete(Boolean enableSoftDelete) { + this.innerModel().withEnableSoftDelete(enableSoftDelete); + return this; + } + + public ManagedHsmImpl withSoftDeleteRetentionInDays(Integer softDeleteRetentionInDays) { + this.innerModel().withSoftDeleteRetentionInDays(softDeleteRetentionInDays); + return this; + } + + public ManagedHsmImpl withEnablePurgeProtection(Boolean enablePurgeProtection) { + this.innerModel().withEnablePurgeProtection(enablePurgeProtection); + return this; + } + + public ManagedHsmImpl withCreateMode(CreateMode createMode) { + this.innerModel().withCreateMode(createMode); + return this; + } + + public ManagedHsmImpl withNetworkAcls(MhsmNetworkRuleSet networkAcls) { + this.innerModel().withNetworkAcls(networkAcls); + return this; + } + + public ManagedHsmImpl withRegions(List regions) { + this.innerModel().withRegions(regions); + return this; + } + + public ManagedHsmImpl withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + this.innerModel().withPublicNetworkAccess(publicNetworkAccess); + return this; + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/ManagedHsmsClientImpl.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/ManagedHsmsClientImpl.java new file mode 100644 index 000000000000..07d2d874dd91 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/ManagedHsmsClientImpl.java @@ -0,0 +1,1951 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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.keyvault.generated.fluent.ManagedHsmsClient; +import com.azure.resourcemanager.keyvault.generated.fluent.models.CheckMhsmNameAvailabilityResultInner; +import com.azure.resourcemanager.keyvault.generated.fluent.models.DeletedManagedHsmInner; +import com.azure.resourcemanager.keyvault.generated.fluent.models.ManagedHsmInner; +import com.azure.resourcemanager.keyvault.generated.models.CheckMhsmNameAvailabilityParameters; +import com.azure.resourcemanager.keyvault.generated.models.DeletedManagedHsmListResult; +import com.azure.resourcemanager.keyvault.generated.models.ManagedHsmListResult; +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 ManagedHsmsClient. + */ +public final class ManagedHsmsClientImpl implements ManagedHsmsClient { + /** + * The proxy service used to perform REST calls. + */ + private final ManagedHsmsService service; + + /** + * The service client containing this operation class. + */ + private final AzureStorageResourceManagementApiImpl client; + + /** + * Initializes an instance of ManagedHsmsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedHsmsClientImpl(AzureStorageResourceManagementApiImpl client) { + this.service + = RestProxy.create(ManagedHsmsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureStorageResourceManagementApiManagedHsms to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureStorageResource") + public interface ManagedHsmsService { + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkMhsmNameAvailability") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkMhsmNameAvailability( + @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") CheckMhsmNameAvailabilityParameters body, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedManagedHSMs") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getDeleted(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, @PathParam("name") String name, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}/purge") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> purgeDeleted(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, @PathParam("name") String name, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/managedHSMs") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscription(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @QueryParam("$top") Integer top, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("$top") Integer top, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("name") String name, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("name") String name, + @BodyParam("application/json") ManagedHsmInner resource, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("name") String name, + @BodyParam("application/json") ManagedHsmInner properties, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}") + @ExpectedResponses({ 200, 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("name") String name, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listDeletedNext( + @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); + + @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); + } + + /** + * Checks that the managed hsm name is valid and is not already in use. + * + * @param body The request body. + * @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 CheckMhsmNameAvailability operation response along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + checkMhsmNameAvailabilityWithResponseAsync(CheckMhsmNameAvailabilityParameters 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 (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.checkMhsmNameAvailability(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), body, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Checks that the managed hsm name is valid and is not already in use. + * + * @param body The request body. + * @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 CheckMhsmNameAvailability operation response along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + checkMhsmNameAvailabilityWithResponseAsync(CheckMhsmNameAvailabilityParameters 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 (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.checkMhsmNameAvailability(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), body, accept, context); + } + + /** + * Checks that the managed hsm name is valid and is not already in use. + * + * @param body The request body. + * @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 CheckMhsmNameAvailability operation response on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono + checkMhsmNameAvailabilityAsync(CheckMhsmNameAvailabilityParameters body) { + return checkMhsmNameAvailabilityWithResponseAsync(body).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Checks that the managed hsm name is valid and is not already in use. + * + * @param body The request body. + * @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 CheckMhsmNameAvailability operation response along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response + checkMhsmNameAvailabilityWithResponse(CheckMhsmNameAvailabilityParameters body, Context context) { + return checkMhsmNameAvailabilityWithResponseAsync(body, context).block(); + } + + /** + * Checks that the managed hsm name is valid and is not already in use. + * + * @param body The request body. + * @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 CheckMhsmNameAvailability operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CheckMhsmNameAvailabilityResultInner checkMhsmNameAvailability(CheckMhsmNameAvailabilityParameters body) { + return checkMhsmNameAvailabilityWithResponse(body, Context.NONE).getValue(); + } + + /** + * The List operation gets information about the deleted managed HSMs 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 the response of a DeletedManagedHsm list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + 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.getApiVersion(), + this.client.getSubscriptionId(), 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 deleted managed HSMs associated with the subscription. + * + * @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 response of a DeletedManagedHsm list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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.")); + } + 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.getApiVersion(), this.client.getSubscriptionId(), 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 deleted managed HSMs 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 the response of a DeletedManagedHsm list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listDeletedNextSinglePageAsync(nextLink)); + } + + /** + * The List operation gets information about the deleted managed HSMs associated with the subscription. + * + * @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 response of a DeletedManagedHsm list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listDeletedNextSinglePageAsync(nextLink, context)); + } + + /** + * The List operation gets information about the deleted managed HSMs 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 the response of a DeletedManagedHsm list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * The List operation gets information about the deleted managed HSMs associated with the subscription. + * + * @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 response of a DeletedManagedHsm list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Gets the specified deleted managed HSM. + * + * @param location The name of the Azure region. + * @param name The name of the deleted managed HSM. + * @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 deleted managed HSM along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDeletedWithResponseAsync(String location, String name) { + 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getDeleted(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, name, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the specified deleted managed HSM. + * + * @param location The name of the Azure region. + * @param name The name of the deleted managed HSM. + * @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 deleted managed HSM along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDeletedWithResponseAsync(String location, String name, + 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getDeleted(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, name, accept, context); + } + + /** + * Gets the specified deleted managed HSM. + * + * @param location The name of the Azure region. + * @param name The name of the deleted managed HSM. + * @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 deleted managed HSM on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getDeletedAsync(String location, String name) { + return getDeletedWithResponseAsync(location, name).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the specified deleted managed HSM. + * + * @param location The name of the Azure region. + * @param name The name of the deleted managed HSM. + * @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 deleted managed HSM along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDeletedWithResponse(String location, String name, Context context) { + return getDeletedWithResponseAsync(location, name, context).block(); + } + + /** + * Gets the specified deleted managed HSM. + * + * @param location The name of the Azure region. + * @param name The name of the deleted managed HSM. + * @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 deleted managed HSM. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeletedManagedHsmInner getDeleted(String location, String name) { + return getDeletedWithResponse(location, name, Context.NONE).getValue(); + } + + /** + * Permanently deletes the specified managed HSM. + * + * @param location The name of the Azure region. + * @param name The name of the deleted managed HSM. + * @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>> purgeDeletedWithResponseAsync(String location, String name) { + 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.purgeDeleted(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, name, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Permanently deletes the specified managed HSM. + * + * @param location The name of the Azure region. + * @param name The name of the deleted managed HSM. + * @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>> purgeDeletedWithResponseAsync(String location, String name, + 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.purgeDeleted(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, name, accept, context); + } + + /** + * Permanently deletes the specified managed HSM. + * + * @param location The name of the Azure region. + * @param name The name of the deleted managed HSM. + * @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> beginPurgeDeletedAsync(String location, String name) { + Mono>> mono = purgeDeletedWithResponseAsync(location, name); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Permanently deletes the specified managed HSM. + * + * @param location The name of the Azure region. + * @param name The name of the deleted managed HSM. + * @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> beginPurgeDeletedAsync(String location, String name, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = purgeDeletedWithResponseAsync(location, name, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Permanently deletes the specified managed HSM. + * + * @param location The name of the Azure region. + * @param name The name of the deleted managed HSM. + * @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> beginPurgeDeleted(String location, String name) { + return this.beginPurgeDeletedAsync(location, name).getSyncPoller(); + } + + /** + * Permanently deletes the specified managed HSM. + * + * @param location The name of the Azure region. + * @param name The name of the deleted managed HSM. + * @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> beginPurgeDeleted(String location, String name, Context context) { + return this.beginPurgeDeletedAsync(location, name, context).getSyncPoller(); + } + + /** + * Permanently deletes the specified managed HSM. + * + * @param location The name of the Azure region. + * @param name The name of the deleted managed HSM. + * @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 purgeDeletedAsync(String location, String name) { + return beginPurgeDeletedAsync(location, name).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Permanently deletes the specified managed HSM. + * + * @param location The name of the Azure region. + * @param name The name of the deleted managed HSM. + * @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 purgeDeletedAsync(String location, String name, Context context) { + return beginPurgeDeletedAsync(location, name, context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Permanently deletes the specified managed HSM. + * + * @param location The name of the Azure region. + * @param name The name of the deleted managed HSM. + * @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 purgeDeleted(String location, String name) { + purgeDeletedAsync(location, name).block(); + } + + /** + * Permanently deletes the specified managed HSM. + * + * @param location The name of the Azure region. + * @param name The name of the deleted managed HSM. + * @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 purgeDeleted(String location, String name, Context context) { + purgeDeletedAsync(location, name, context).block(); + } + + /** + * The List operation gets information about the managed HSM Pools associated with the subscription. + * + * @param top Maximum number of results to return. + * @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 response of a ManagedHsm list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionSinglePageAsync(Integer top) { + 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.listBySubscription(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), top, 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 managed HSM Pools associated with the subscription. + * + * @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. + * @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 response of a ManagedHsm list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionSinglePageAsync(Integer top, 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 + .listBySubscription(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + top, 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 managed HSM Pools associated with the subscription. + * + * @param top Maximum number of results to return. + * @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 response of a ManagedHsm list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionAsync(Integer top) { + return new PagedFlux<>(() -> listBySubscriptionSinglePageAsync(top), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * The List operation gets information about the managed HSM Pools 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 the response of a ManagedHsm list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionAsync() { + final Integer top = null; + return new PagedFlux<>(() -> listBySubscriptionSinglePageAsync(top), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * The List operation gets information about the managed HSM Pools associated with the subscription. + * + * @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. + * @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 response of a ManagedHsm list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionAsync(Integer top, Context context) { + return new PagedFlux<>(() -> listBySubscriptionSinglePageAsync(top, context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * The List operation gets information about the managed HSM Pools 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 the response of a ManagedHsm list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscription() { + final Integer top = null; + return new PagedIterable<>(listBySubscriptionAsync(top)); + } + + /** + * The List operation gets information about the managed HSM Pools associated with the subscription. + * + * @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. + * @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 response of a ManagedHsm list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscription(Integer top, Context context) { + return new PagedIterable<>(listBySubscriptionAsync(top, context)); + } + + /** + * The List operation gets information about the managed HSM Pools associated with the subscription and within the + * specified resource group. + * + * @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 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 response of a ManagedHsm list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, + Integer top) { + 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.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, top, 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 managed HSM Pools associated with the subscription and within the + * specified resource group. + * + * @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. + * @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 response of a ManagedHsm list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, + Integer top, 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.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, top, 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 managed HSM Pools associated with the subscription and within the + * specified resource group. + * + * @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 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 response of a ManagedHsm list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Integer top) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, top), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * The List operation gets information about the managed HSM Pools 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 the response of a ManagedHsm list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + final Integer top = null; + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, top), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * The List operation gets information about the managed HSM Pools associated with the subscription and within the + * specified resource group. + * + * @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. + * @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 response of a ManagedHsm list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Integer top, + Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, top, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * The List operation gets information about the managed HSM Pools 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 the response of a ManagedHsm list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + final Integer top = null; + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, top)); + } + + /** + * The List operation gets information about the managed HSM Pools associated with the subscription and within the + * specified resource group. + * + * @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. + * @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 response of a ManagedHsm list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Integer top, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, top, context)); + } + + /** + * Gets the specified managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 managed HSM Pool along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, String name) { + 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 (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, name, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the specified managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 managed HSM Pool along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, String name, + 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 (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, name, accept, context); + } + + /** + * Gets the specified managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 managed HSM Pool on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String name) { + return getByResourceGroupWithResponseAsync(resourceGroupName, name) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the specified managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 managed HSM Pool along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, String name, + Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, name, context).block(); + } + + /** + * Gets the specified managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 managed HSM Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedHsmInner getByResourceGroup(String resourceGroupName, String name) { + return getByResourceGroupWithResponse(resourceGroupName, name, Context.NONE).getValue(); + } + + /** + * Create or update a managed HSM Pool in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param resource Parameters to create or update the managed HSM Pool. + * @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 name, + ManagedHsmInner resource) { + 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 (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, name, resource, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update a managed HSM Pool in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param resource Parameters to create or update the managed HSM Pool. + * @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 name, + ManagedHsmInner resource, 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 (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, name, resource, accept, context); + } + + /** + * Create or update a managed HSM Pool in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param resource Parameters to create or update the managed HSM Pool. + * @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, ManagedHsmInner> beginCreateOrUpdateAsync(String resourceGroupName, + String name, ManagedHsmInner resource) { + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, name, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + ManagedHsmInner.class, ManagedHsmInner.class, this.client.getContext()); + } + + /** + * Create or update a managed HSM Pool in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param resource Parameters to create or update the managed HSM Pool. + * @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, ManagedHsmInner> beginCreateOrUpdateAsync(String resourceGroupName, + String name, ManagedHsmInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, name, resource, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + ManagedHsmInner.class, ManagedHsmInner.class, context); + } + + /** + * Create or update a managed HSM Pool in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param resource Parameters to create or update the managed HSM Pool. + * @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, ManagedHsmInner> beginCreateOrUpdate(String resourceGroupName, + String name, ManagedHsmInner resource) { + return this.beginCreateOrUpdateAsync(resourceGroupName, name, resource).getSyncPoller(); + } + + /** + * Create or update a managed HSM Pool in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param resource Parameters to create or update the managed HSM Pool. + * @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, ManagedHsmInner> beginCreateOrUpdate(String resourceGroupName, + String name, ManagedHsmInner resource, Context context) { + return this.beginCreateOrUpdateAsync(resourceGroupName, name, resource, context).getSyncPoller(); + } + + /** + * Create or update a managed HSM Pool in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param resource Parameters to create or update the managed HSM Pool. + * @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 name, ManagedHsmInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, name, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a managed HSM Pool in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param resource Parameters to create or update the managed HSM Pool. + * @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 name, ManagedHsmInner resource, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, name, resource, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a managed HSM Pool in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param resource Parameters to create or update the managed HSM Pool. + * @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 ManagedHsmInner createOrUpdate(String resourceGroupName, String name, ManagedHsmInner resource) { + return createOrUpdateAsync(resourceGroupName, name, resource).block(); + } + + /** + * Create or update a managed HSM Pool in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param resource Parameters to create or update the managed HSM Pool. + * @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 ManagedHsmInner createOrUpdate(String resourceGroupName, String name, ManagedHsmInner resource, + Context context) { + return createOrUpdateAsync(resourceGroupName, name, resource, context).block(); + } + + /** + * Update a managed HSM Pool in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param properties Parameters to patch the managed HSM Pool. + * @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 name, + ManagedHsmInner 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 (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name 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.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, name, properties, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a managed HSM Pool in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param properties Parameters to patch the managed HSM Pool. + * @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 name, + ManagedHsmInner 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 (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name 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.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, name, properties, accept, context); + } + + /** + * Update a managed HSM Pool in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param properties Parameters to patch the managed HSM Pool. + * @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, ManagedHsmInner> beginUpdateAsync(String resourceGroupName, + String name, ManagedHsmInner properties) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, name, properties); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + ManagedHsmInner.class, ManagedHsmInner.class, this.client.getContext()); + } + + /** + * Update a managed HSM Pool in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param properties Parameters to patch the managed HSM Pool. + * @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, ManagedHsmInner> beginUpdateAsync(String resourceGroupName, + String name, ManagedHsmInner properties, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = updateWithResponseAsync(resourceGroupName, name, properties, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + ManagedHsmInner.class, ManagedHsmInner.class, context); + } + + /** + * Update a managed HSM Pool in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param properties Parameters to patch the managed HSM Pool. + * @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, ManagedHsmInner> beginUpdate(String resourceGroupName, String name, + ManagedHsmInner properties) { + return this.beginUpdateAsync(resourceGroupName, name, properties).getSyncPoller(); + } + + /** + * Update a managed HSM Pool in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param properties Parameters to patch the managed HSM Pool. + * @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, ManagedHsmInner> beginUpdate(String resourceGroupName, String name, + ManagedHsmInner properties, Context context) { + return this.beginUpdateAsync(resourceGroupName, name, properties, context).getSyncPoller(); + } + + /** + * Update a managed HSM Pool in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param properties Parameters to patch the managed HSM Pool. + * @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 name, ManagedHsmInner properties) { + return beginUpdateAsync(resourceGroupName, name, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a managed HSM Pool in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param properties Parameters to patch the managed HSM Pool. + * @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 name, ManagedHsmInner properties, + Context context) { + return beginUpdateAsync(resourceGroupName, name, properties, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a managed HSM Pool in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param properties Parameters to patch the managed HSM Pool. + * @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 ManagedHsmInner update(String resourceGroupName, String name, ManagedHsmInner properties) { + return updateAsync(resourceGroupName, name, properties).block(); + } + + /** + * Update a managed HSM Pool in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param properties Parameters to patch the managed HSM Pool. + * @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 ManagedHsmInner update(String resourceGroupName, String name, ManagedHsmInner properties, Context context) { + return updateAsync(resourceGroupName, name, properties, context).block(); + } + + /** + * Deletes the specified managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 name) { + 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 (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, name, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the specified managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 name, + 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 (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, name, accept, context); + } + + /** + * Deletes the specified managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 name) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, name); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Deletes the specified managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 name, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, name, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Deletes the specified managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 name) { + return this.beginDeleteAsync(resourceGroupName, name).getSyncPoller(); + } + + /** + * Deletes the specified managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 name, Context context) { + return this.beginDeleteAsync(resourceGroupName, name, context).getSyncPoller(); + } + + /** + * Deletes the specified managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 name) { + return beginDeleteAsync(resourceGroupName, name).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the specified managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 name, Context context) { + return beginDeleteAsync(resourceGroupName, name, context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the specified managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 name) { + deleteAsync(resourceGroupName, name).block(); + } + + /** + * Deletes the specified managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 name, Context context) { + deleteAsync(resourceGroupName, name, 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 the response of a DeletedManagedHsm list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listDeletedNextSinglePageAsync(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.listDeletedNext(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 the response of a DeletedManagedHsm list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listDeletedNextSinglePageAsync(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.listDeletedNext(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 the response of a ManagedHsm list operation 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 the response of a ManagedHsm list operation 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)); + } + + /** + * 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 the response of a ManagedHsm list operation 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 the response of a ManagedHsm list operation 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)); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/ManagedHsmsImpl.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/ManagedHsmsImpl.java new file mode 100644 index 000000000000..59dfc31e029b --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/ManagedHsmsImpl.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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.keyvault.generated.fluent.ManagedHsmsClient; +import com.azure.resourcemanager.keyvault.generated.fluent.models.CheckMhsmNameAvailabilityResultInner; +import com.azure.resourcemanager.keyvault.generated.fluent.models.DeletedManagedHsmInner; +import com.azure.resourcemanager.keyvault.generated.fluent.models.ManagedHsmInner; +import com.azure.resourcemanager.keyvault.generated.models.CheckMhsmNameAvailabilityParameters; +import com.azure.resourcemanager.keyvault.generated.models.CheckMhsmNameAvailabilityResult; +import com.azure.resourcemanager.keyvault.generated.models.DeletedManagedHsm; +import com.azure.resourcemanager.keyvault.generated.models.ManagedHsm; +import com.azure.resourcemanager.keyvault.generated.models.ManagedHsms; + +public final class ManagedHsmsImpl implements ManagedHsms { + private static final ClientLogger LOGGER = new ClientLogger(ManagedHsmsImpl.class); + + private final ManagedHsmsClient innerClient; + + private final com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager; + + public ManagedHsmsImpl(ManagedHsmsClient innerClient, + com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response + checkMhsmNameAvailabilityWithResponse(CheckMhsmNameAvailabilityParameters body, Context context) { + Response inner + = this.serviceClient().checkMhsmNameAvailabilityWithResponse(body, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new CheckMhsmNameAvailabilityResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CheckMhsmNameAvailabilityResult checkMhsmNameAvailability(CheckMhsmNameAvailabilityParameters body) { + CheckMhsmNameAvailabilityResultInner inner = this.serviceClient().checkMhsmNameAvailability(body); + if (inner != null) { + return new CheckMhsmNameAvailabilityResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DeletedManagedHsmImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DeletedManagedHsmImpl(inner1, this.manager())); + } + + public Response getDeletedWithResponse(String location, String name, Context context) { + Response inner = this.serviceClient().getDeletedWithResponse(location, name, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new DeletedManagedHsmImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DeletedManagedHsm getDeleted(String location, String name) { + DeletedManagedHsmInner inner = this.serviceClient().getDeleted(location, name); + if (inner != null) { + return new DeletedManagedHsmImpl(inner, this.manager()); + } else { + return null; + } + } + + public void purgeDeleted(String location, String name) { + this.serviceClient().purgeDeleted(location, name); + } + + public void purgeDeleted(String location, String name, Context context) { + this.serviceClient().purgeDeleted(location, name, context); + } + + public PagedIterable listBySubscription() { + PagedIterable inner = this.serviceClient().listBySubscription(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ManagedHsmImpl(inner1, this.manager())); + } + + public PagedIterable listBySubscription(Integer top, Context context) { + PagedIterable inner = this.serviceClient().listBySubscription(top, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ManagedHsmImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ManagedHsmImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Integer top, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, top, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ManagedHsmImpl(inner1, this.manager())); + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, String name, Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, name, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ManagedHsmImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ManagedHsm getByResourceGroup(String resourceGroupName, String name) { + ManagedHsmInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, name); + if (inner != null) { + return new ManagedHsmImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String name) { + this.serviceClient().delete(resourceGroupName, name); + } + + public void delete(String resourceGroupName, String name, Context context) { + this.serviceClient().delete(resourceGroupName, name, context); + } + + public ManagedHsm 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 name = ResourceManagerUtils.getValueFromIdByName(id, "managedHSMs"); + if (name == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'managedHSMs'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, name, 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 name = ResourceManagerUtils.getValueFromIdByName(id, "managedHSMs"); + if (name == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'managedHSMs'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, name, 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 name = ResourceManagerUtils.getValueFromIdByName(id, "managedHSMs"); + if (name == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'managedHSMs'.", id))); + } + this.delete(resourceGroupName, name, 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 name = ResourceManagerUtils.getValueFromIdByName(id, "managedHSMs"); + if (name == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'managedHSMs'.", id))); + } + this.delete(resourceGroupName, name, context); + } + + private ManagedHsmsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager() { + return this.serviceManager; + } + + public ManagedHsmImpl define(String name) { + return new ManagedHsmImpl(name, this.manager()); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/MhsmGeoReplicatedRegionImpl.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/MhsmGeoReplicatedRegionImpl.java new file mode 100644 index 000000000000..580f6a9d8ee7 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/MhsmGeoReplicatedRegionImpl.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.implementation; + +import com.azure.resourcemanager.keyvault.generated.fluent.models.MhsmGeoReplicatedRegionInner; +import com.azure.resourcemanager.keyvault.generated.models.GeoReplicationRegionProvisioningState; +import com.azure.resourcemanager.keyvault.generated.models.MhsmGeoReplicatedRegion; + +public final class MhsmGeoReplicatedRegionImpl implements MhsmGeoReplicatedRegion { + private MhsmGeoReplicatedRegionInner innerObject; + + private final com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager; + + MhsmGeoReplicatedRegionImpl(MhsmGeoReplicatedRegionInner innerObject, + com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public GeoReplicationRegionProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public Boolean isPrimary() { + return this.innerModel().isPrimary(); + } + + public MhsmGeoReplicatedRegionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/MhsmPrivateEndpointConnectionImpl.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/MhsmPrivateEndpointConnectionImpl.java new file mode 100644 index 000000000000..0183cf127690 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/MhsmPrivateEndpointConnectionImpl.java @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.keyvault.generated.fluent.models.MhsmPrivateEndpointConnectionInner; +import com.azure.resourcemanager.keyvault.generated.models.ManagedHsmPrivateEndpointConnectionProvisioningState; +import com.azure.resourcemanager.keyvault.generated.models.MhsmPrivateEndpoint; +import com.azure.resourcemanager.keyvault.generated.models.MhsmPrivateEndpointConnection; +import com.azure.resourcemanager.keyvault.generated.models.MhsmPrivateLinkServiceConnectionState; +import java.util.Collections; +import java.util.Map; + +public final class MhsmPrivateEndpointConnectionImpl implements MhsmPrivateEndpointConnection, + MhsmPrivateEndpointConnection.Definition, MhsmPrivateEndpointConnection.Update { + private MhsmPrivateEndpointConnectionInner innerObject; + + private final com.azure.resourcemanager.keyvault.generated.KeyvaultManager 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 String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public MhsmPrivateEndpoint privateEndpoint() { + return this.innerModel().privateEndpoint(); + } + + public MhsmPrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.innerModel().privateLinkServiceConnectionState(); + } + + public ManagedHsmPrivateEndpointConnectionProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public MhsmPrivateEndpointConnectionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String name; + + private String privateEndpointConnectionName; + + public MhsmPrivateEndpointConnectionImpl withExistingManagedHSM(String resourceGroupName, String name) { + this.resourceGroupName = resourceGroupName; + this.name = name; + return this; + } + + public MhsmPrivateEndpointConnection create() { + this.innerObject = serviceManager.serviceClient() + .getMhsmPrivateEndpointConnections() + .putWithResponse(resourceGroupName, name, privateEndpointConnectionName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public MhsmPrivateEndpointConnection create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getMhsmPrivateEndpointConnections() + .putWithResponse(resourceGroupName, name, privateEndpointConnectionName, this.innerModel(), context) + .getValue(); + return this; + } + + MhsmPrivateEndpointConnectionImpl(String name, + com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager) { + this.innerObject = new MhsmPrivateEndpointConnectionInner(); + this.serviceManager = serviceManager; + this.privateEndpointConnectionName = name; + } + + public MhsmPrivateEndpointConnectionImpl update() { + return this; + } + + public MhsmPrivateEndpointConnection apply() { + this.innerObject = serviceManager.serviceClient() + .getMhsmPrivateEndpointConnections() + .putWithResponse(resourceGroupName, name, privateEndpointConnectionName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public MhsmPrivateEndpointConnection apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getMhsmPrivateEndpointConnections() + .putWithResponse(resourceGroupName, name, privateEndpointConnectionName, this.innerModel(), context) + .getValue(); + return this; + } + + MhsmPrivateEndpointConnectionImpl(MhsmPrivateEndpointConnectionInner innerObject, + com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.name = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "managedHSMs"); + this.privateEndpointConnectionName + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "privateEndpointConnections"); + } + + public MhsmPrivateEndpointConnection refresh() { + this.innerObject = serviceManager.serviceClient() + .getMhsmPrivateEndpointConnections() + .getWithResponse(resourceGroupName, name, privateEndpointConnectionName, Context.NONE) + .getValue(); + return this; + } + + public MhsmPrivateEndpointConnection refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getMhsmPrivateEndpointConnections() + .getWithResponse(resourceGroupName, name, privateEndpointConnectionName, context) + .getValue(); + return this; + } + + public MhsmPrivateEndpointConnectionImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public MhsmPrivateEndpointConnectionImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public MhsmPrivateEndpointConnectionImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public MhsmPrivateEndpointConnectionImpl withEtag(String etag) { + this.innerModel().withEtag(etag); + return this; + } + + public MhsmPrivateEndpointConnectionImpl withPrivateEndpoint(MhsmPrivateEndpoint privateEndpoint) { + this.innerModel().withPrivateEndpoint(privateEndpoint); + return this; + } + + public MhsmPrivateEndpointConnectionImpl + withPrivateLinkServiceConnectionState(MhsmPrivateLinkServiceConnectionState privateLinkServiceConnectionState) { + this.innerModel().withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState); + return this; + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/MhsmPrivateEndpointConnectionsClientImpl.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/MhsmPrivateEndpointConnectionsClientImpl.java new file mode 100644 index 000000000000..f7fad9e63c17 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/MhsmPrivateEndpointConnectionsClientImpl.java @@ -0,0 +1,864 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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.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.keyvault.generated.fluent.MhsmPrivateEndpointConnectionsClient; +import com.azure.resourcemanager.keyvault.generated.fluent.models.MhsmPrivateEndpointConnectionInner; +import com.azure.resourcemanager.keyvault.generated.models.MhsmPrivateEndpointConnectionListResult; +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 MhsmPrivateEndpointConnectionsClient. + */ +public final class MhsmPrivateEndpointConnectionsClientImpl implements MhsmPrivateEndpointConnectionsClient { + /** + * The proxy service used to perform REST calls. + */ + private final MhsmPrivateEndpointConnectionsService service; + + /** + * The service client containing this operation class. + */ + private final AzureStorageResourceManagementApiImpl client; + + /** + * Initializes an instance of MhsmPrivateEndpointConnectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MhsmPrivateEndpointConnectionsClientImpl(AzureStorageResourceManagementApiImpl client) { + this.service = RestProxy.create(MhsmPrivateEndpointConnectionsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureStorageResourceManagementApiMhsmPrivateEndpointConnections to be + * used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureStorageResource") + public interface MhsmPrivateEndpointConnectionsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResource(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("name") String name, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("name") String name, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> put(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("name") String name, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @BodyParam("application/json") MhsmPrivateEndpointConnectionInner resource, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({ 200, 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("name") String name, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceNext( + @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 managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 response of a MhsmPrivateEndpointConnection list operation along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByResourceSinglePageAsync(String resourceGroupName, String name) { + 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 (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResource(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, name, 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 managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 response of a MhsmPrivateEndpointConnection list operation along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByResourceSinglePageAsync(String resourceGroupName, String name, 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 (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResource(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, name, 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 managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 response of a MhsmPrivateEndpointConnection list operation as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceAsync(String resourceGroupName, String name) { + return new PagedFlux<>(() -> listByResourceSinglePageAsync(resourceGroupName, name), + nextLink -> listByResourceNextSinglePageAsync(nextLink)); + } + + /** + * The List operation gets information about the private endpoint connections associated with the managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 response of a MhsmPrivateEndpointConnection list operation as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceAsync(String resourceGroupName, String name, + Context context) { + return new PagedFlux<>(() -> listByResourceSinglePageAsync(resourceGroupName, name, context), + nextLink -> listByResourceNextSinglePageAsync(nextLink, context)); + } + + /** + * The List operation gets information about the private endpoint connections associated with the managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 response of a MhsmPrivateEndpointConnection list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResource(String resourceGroupName, String name) { + return new PagedIterable<>(listByResourceAsync(resourceGroupName, name)); + } + + /** + * The List operation gets information about the private endpoint connections associated with the managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 response of a MhsmPrivateEndpointConnection list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResource(String resourceGroupName, String name, + Context context) { + return new PagedIterable<>(listByResourceAsync(resourceGroupName, name, context)); + } + + /** + * Gets the specified private endpoint connection associated with the managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the managed hsm + * pool. + * @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 private endpoint connection associated with the managed HSM Pool along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String name, String privateEndpointConnectionName) { + 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 (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, name, privateEndpointConnectionName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the specified private endpoint connection associated with the managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the managed hsm + * pool. + * @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 private endpoint connection associated with the managed HSM Pool along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String name, String privateEndpointConnectionName, 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 (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, name, privateEndpointConnectionName, accept, context); + } + + /** + * Gets the specified private endpoint connection associated with the managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the managed hsm + * pool. + * @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 private endpoint connection associated with the managed HSM Pool on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String name, + String privateEndpointConnectionName) { + return getWithResponseAsync(resourceGroupName, name, privateEndpointConnectionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the specified private endpoint connection associated with the managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the managed hsm + * pool. + * @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 private endpoint connection associated with the managed HSM Pool along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String name, + String privateEndpointConnectionName, Context context) { + return getWithResponseAsync(resourceGroupName, name, privateEndpointConnectionName, context).block(); + } + + /** + * Gets the specified private endpoint connection associated with the managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the managed hsm + * pool. + * @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 private endpoint connection associated with the managed HSM Pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MhsmPrivateEndpointConnectionInner get(String resourceGroupName, String name, + String privateEndpointConnectionName) { + return getWithResponse(resourceGroupName, name, privateEndpointConnectionName, Context.NONE).getValue(); + } + + /** + * Updates the specified private endpoint connection associated with the managed hsm pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the managed hsm + * pool. + * @param resource The intended state of private endpoint connection. + * @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 private endpoint connection resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> putWithResponseAsync(String resourceGroupName, + String name, String privateEndpointConnectionName, MhsmPrivateEndpointConnectionInner resource) { + 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 (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, name, privateEndpointConnectionName, resource, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates the specified private endpoint connection associated with the managed hsm pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the managed hsm + * pool. + * @param resource The intended state of private endpoint connection. + * @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 private endpoint connection resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> putWithResponseAsync(String resourceGroupName, + String name, String privateEndpointConnectionName, MhsmPrivateEndpointConnectionInner resource, + 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 (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.put(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, name, privateEndpointConnectionName, resource, accept, context); + } + + /** + * Updates the specified private endpoint connection associated with the managed hsm pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the managed hsm + * pool. + * @param resource The intended state of private endpoint connection. + * @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 private endpoint connection resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono putAsync(String resourceGroupName, String name, + String privateEndpointConnectionName, MhsmPrivateEndpointConnectionInner resource) { + return putWithResponseAsync(resourceGroupName, name, privateEndpointConnectionName, resource) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates the specified private endpoint connection associated with the managed hsm pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the managed hsm + * pool. + * @param resource The intended state of private endpoint connection. + * @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 private endpoint connection resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(String resourceGroupName, String name, + String privateEndpointConnectionName, MhsmPrivateEndpointConnectionInner resource, Context context) { + return putWithResponseAsync(resourceGroupName, name, privateEndpointConnectionName, resource, context).block(); + } + + /** + * Updates the specified private endpoint connection associated with the managed hsm pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the managed hsm + * pool. + * @param resource The intended state of private endpoint connection. + * @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 private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MhsmPrivateEndpointConnectionInner put(String resourceGroupName, String name, + String privateEndpointConnectionName, MhsmPrivateEndpointConnectionInner resource) { + return putWithResponse(resourceGroupName, name, privateEndpointConnectionName, resource, Context.NONE) + .getValue(); + } + + /** + * Deletes the specified private endpoint connection associated with the managed hsm pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the managed hsm + * pool. + * @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 private endpoint connection resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String name, + String privateEndpointConnectionName) { + 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 (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, name, privateEndpointConnectionName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the specified private endpoint connection associated with the managed hsm pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the managed hsm + * pool. + * @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 private endpoint connection resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String name, + String privateEndpointConnectionName, 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 (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, name, privateEndpointConnectionName, accept, context); + } + + /** + * Deletes the specified private endpoint connection associated with the managed hsm pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the managed hsm + * pool. + * @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 private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, MhsmPrivateEndpointConnectionInner> + beginDeleteAsync(String resourceGroupName, String name, String privateEndpointConnectionName) { + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, name, privateEndpointConnectionName); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), MhsmPrivateEndpointConnectionInner.class, + MhsmPrivateEndpointConnectionInner.class, this.client.getContext()); + } + + /** + * Deletes the specified private endpoint connection associated with the managed hsm pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the managed hsm + * pool. + * @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 private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, MhsmPrivateEndpointConnectionInner> + beginDeleteAsync(String resourceGroupName, String name, String privateEndpointConnectionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, name, privateEndpointConnectionName, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), MhsmPrivateEndpointConnectionInner.class, + MhsmPrivateEndpointConnectionInner.class, context); + } + + /** + * Deletes the specified private endpoint connection associated with the managed hsm pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the managed hsm + * pool. + * @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 private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, MhsmPrivateEndpointConnectionInner> + beginDelete(String resourceGroupName, String name, String privateEndpointConnectionName) { + return this.beginDeleteAsync(resourceGroupName, name, privateEndpointConnectionName).getSyncPoller(); + } + + /** + * Deletes the specified private endpoint connection associated with the managed hsm pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the managed hsm + * pool. + * @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 private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, MhsmPrivateEndpointConnectionInner> + beginDelete(String resourceGroupName, String name, String privateEndpointConnectionName, Context context) { + return this.beginDeleteAsync(resourceGroupName, name, privateEndpointConnectionName, context).getSyncPoller(); + } + + /** + * Deletes the specified private endpoint connection associated with the managed hsm pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the managed hsm + * pool. + * @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 private endpoint connection resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String name, + String privateEndpointConnectionName) { + return beginDeleteAsync(resourceGroupName, name, privateEndpointConnectionName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the specified private endpoint connection associated with the managed hsm pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the managed hsm + * pool. + * @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 private endpoint connection resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String name, + String privateEndpointConnectionName, Context context) { + return beginDeleteAsync(resourceGroupName, name, privateEndpointConnectionName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the specified private endpoint connection associated with the managed hsm pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the managed hsm + * pool. + * @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 private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MhsmPrivateEndpointConnectionInner delete(String resourceGroupName, String name, + String privateEndpointConnectionName) { + return deleteAsync(resourceGroupName, name, privateEndpointConnectionName).block(); + } + + /** + * Deletes the specified private endpoint connection associated with the managed hsm pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the managed hsm + * pool. + * @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 private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MhsmPrivateEndpointConnectionInner delete(String resourceGroupName, String name, + String privateEndpointConnectionName, Context context) { + return deleteAsync(resourceGroupName, name, privateEndpointConnectionName, 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 the response of a MhsmPrivateEndpointConnection list operation along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceNextSinglePageAsync(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.listByResourceNext(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 the response of a MhsmPrivateEndpointConnection list operation along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceNextSinglePageAsync(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.listByResourceNext(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/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/MhsmPrivateEndpointConnectionsImpl.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/MhsmPrivateEndpointConnectionsImpl.java new file mode 100644 index 000000000000..98e1c70c063e --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/MhsmPrivateEndpointConnectionsImpl.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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.keyvault.generated.fluent.MhsmPrivateEndpointConnectionsClient; +import com.azure.resourcemanager.keyvault.generated.fluent.models.MhsmPrivateEndpointConnectionInner; +import com.azure.resourcemanager.keyvault.generated.models.MhsmPrivateEndpointConnection; +import com.azure.resourcemanager.keyvault.generated.models.MhsmPrivateEndpointConnections; + +public final class MhsmPrivateEndpointConnectionsImpl implements MhsmPrivateEndpointConnections { + private static final ClientLogger LOGGER = new ClientLogger(MhsmPrivateEndpointConnectionsImpl.class); + + private final MhsmPrivateEndpointConnectionsClient innerClient; + + private final com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager; + + public MhsmPrivateEndpointConnectionsImpl(MhsmPrivateEndpointConnectionsClient innerClient, + com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByResource(String resourceGroupName, String name) { + PagedIterable inner + = this.serviceClient().listByResource(resourceGroupName, name); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new MhsmPrivateEndpointConnectionImpl(inner1, this.manager())); + } + + public PagedIterable listByResource(String resourceGroupName, String name, + Context context) { + PagedIterable inner + = this.serviceClient().listByResource(resourceGroupName, name, context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new MhsmPrivateEndpointConnectionImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String name, + String privateEndpointConnectionName, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, name, privateEndpointConnectionName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new MhsmPrivateEndpointConnectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public MhsmPrivateEndpointConnection get(String resourceGroupName, String name, + String privateEndpointConnectionName) { + MhsmPrivateEndpointConnectionInner inner + = this.serviceClient().get(resourceGroupName, name, privateEndpointConnectionName); + if (inner != null) { + return new MhsmPrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public MhsmPrivateEndpointConnection delete(String resourceGroupName, String name, + String privateEndpointConnectionName) { + MhsmPrivateEndpointConnectionInner inner + = this.serviceClient().delete(resourceGroupName, name, privateEndpointConnectionName); + if (inner != null) { + return new MhsmPrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public MhsmPrivateEndpointConnection delete(String resourceGroupName, String name, + String privateEndpointConnectionName, Context context) { + MhsmPrivateEndpointConnectionInner inner + = this.serviceClient().delete(resourceGroupName, name, privateEndpointConnectionName, context); + if (inner != null) { + return new MhsmPrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public MhsmPrivateEndpointConnection 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 name = ResourceManagerUtils.getValueFromIdByName(id, "managedHSMs"); + if (name == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'managedHSMs'.", id))); + } + String privateEndpointConnectionName + = ResourceManagerUtils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", id))); + } + return this.getWithResponse(resourceGroupName, name, privateEndpointConnectionName, 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 name = ResourceManagerUtils.getValueFromIdByName(id, "managedHSMs"); + if (name == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'managedHSMs'.", id))); + } + String privateEndpointConnectionName + = ResourceManagerUtils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", id))); + } + return this.getWithResponse(resourceGroupName, name, privateEndpointConnectionName, context); + } + + public MhsmPrivateEndpointConnection 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 name = ResourceManagerUtils.getValueFromIdByName(id, "managedHSMs"); + if (name == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'managedHSMs'.", id))); + } + String privateEndpointConnectionName + = ResourceManagerUtils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", id))); + } + return this.delete(resourceGroupName, name, privateEndpointConnectionName, Context.NONE); + } + + public MhsmPrivateEndpointConnection 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 name = ResourceManagerUtils.getValueFromIdByName(id, "managedHSMs"); + if (name == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'managedHSMs'.", id))); + } + String privateEndpointConnectionName + = ResourceManagerUtils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", id))); + } + return this.delete(resourceGroupName, name, privateEndpointConnectionName, context); + } + + private MhsmPrivateEndpointConnectionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager() { + return this.serviceManager; + } + + public MhsmPrivateEndpointConnectionImpl define(String name) { + return new MhsmPrivateEndpointConnectionImpl(name, this.manager()); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/MhsmPrivateLinkResourceListResultImpl.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/MhsmPrivateLinkResourceListResultImpl.java new file mode 100644 index 000000000000..26bce0070f10 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/MhsmPrivateLinkResourceListResultImpl.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.keyvault.generated.implementation; + +import com.azure.resourcemanager.keyvault.generated.fluent.models.MhsmPrivateLinkResourceListResultInner; +import com.azure.resourcemanager.keyvault.generated.models.MhsmPrivateLinkResource; +import com.azure.resourcemanager.keyvault.generated.models.MhsmPrivateLinkResourceListResult; +import java.util.Collections; +import java.util.List; + +public final class MhsmPrivateLinkResourceListResultImpl implements MhsmPrivateLinkResourceListResult { + private MhsmPrivateLinkResourceListResultInner innerObject; + + private final com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager; + + MhsmPrivateLinkResourceListResultImpl(MhsmPrivateLinkResourceListResultInner innerObject, + com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public MhsmPrivateLinkResourceListResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/MhsmPrivateLinkResourcesClientImpl.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/MhsmPrivateLinkResourcesClientImpl.java new file mode 100644 index 000000000000..1a04982bd9cc --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/MhsmPrivateLinkResourcesClientImpl.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.keyvault.generated.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.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.keyvault.generated.fluent.MhsmPrivateLinkResourcesClient; +import com.azure.resourcemanager.keyvault.generated.fluent.models.MhsmPrivateLinkResourceListResultInner; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in MhsmPrivateLinkResourcesClient. + */ +public final class MhsmPrivateLinkResourcesClientImpl implements MhsmPrivateLinkResourcesClient { + /** + * The proxy service used to perform REST calls. + */ + private final MhsmPrivateLinkResourcesService service; + + /** + * The service client containing this operation class. + */ + private final AzureStorageResourceManagementApiImpl client; + + /** + * Initializes an instance of MhsmPrivateLinkResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MhsmPrivateLinkResourcesClientImpl(AzureStorageResourceManagementApiImpl client) { + this.service = RestProxy.create(MhsmPrivateLinkResourcesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureStorageResourceManagementApiMhsmPrivateLinkResources to be used + * by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureStorageResource") + public interface MhsmPrivateLinkResourcesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateLinkResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByMhsmResource(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("name") String name, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets the private link resources supported for the managed hsm pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 managed hsm pool along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByMhsmResourceWithResponseAsync(String resourceGroupName, String name) { + 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 (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByMhsmResource(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, name, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the private link resources supported for the managed hsm pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 managed hsm pool along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByMhsmResourceWithResponseAsync(String resourceGroupName, String name, 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 (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listByMhsmResource(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, name, accept, context); + } + + /** + * Gets the private link resources supported for the managed hsm pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 managed hsm pool on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listByMhsmResourceAsync(String resourceGroupName, + String name) { + return listByMhsmResourceWithResponseAsync(resourceGroupName, name) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the private link resources supported for the managed hsm pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 managed hsm pool along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listByMhsmResourceWithResponse(String resourceGroupName, + String name, Context context) { + return listByMhsmResourceWithResponseAsync(resourceGroupName, name, context).block(); + } + + /** + * Gets the private link resources supported for the managed hsm pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 managed hsm pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MhsmPrivateLinkResourceListResultInner listByMhsmResource(String resourceGroupName, String name) { + return listByMhsmResourceWithResponse(resourceGroupName, name, Context.NONE).getValue(); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/MhsmPrivateLinkResourcesImpl.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/MhsmPrivateLinkResourcesImpl.java new file mode 100644 index 000000000000..cd8c097703f0 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/MhsmPrivateLinkResourcesImpl.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.keyvault.generated.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.keyvault.generated.fluent.MhsmPrivateLinkResourcesClient; +import com.azure.resourcemanager.keyvault.generated.fluent.models.MhsmPrivateLinkResourceListResultInner; +import com.azure.resourcemanager.keyvault.generated.models.MhsmPrivateLinkResourceListResult; +import com.azure.resourcemanager.keyvault.generated.models.MhsmPrivateLinkResources; + +public final class MhsmPrivateLinkResourcesImpl implements MhsmPrivateLinkResources { + private static final ClientLogger LOGGER = new ClientLogger(MhsmPrivateLinkResourcesImpl.class); + + private final MhsmPrivateLinkResourcesClient innerClient; + + private final com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager; + + public MhsmPrivateLinkResourcesImpl(MhsmPrivateLinkResourcesClient innerClient, + com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response listByMhsmResourceWithResponse(String resourceGroupName, + String name, Context context) { + Response inner + = this.serviceClient().listByMhsmResourceWithResponse(resourceGroupName, name, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new MhsmPrivateLinkResourceListResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public MhsmPrivateLinkResourceListResult listByMhsmResource(String resourceGroupName, String name) { + MhsmPrivateLinkResourceListResultInner inner = this.serviceClient().listByMhsmResource(resourceGroupName, name); + if (inner != null) { + return new MhsmPrivateLinkResourceListResultImpl(inner, this.manager()); + } else { + return null; + } + } + + private MhsmPrivateLinkResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/MhsmRegionsClientImpl.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/MhsmRegionsClientImpl.java new file mode 100644 index 000000000000..3471e0625d1f --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/MhsmRegionsClientImpl.java @@ -0,0 +1,280 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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.keyvault.generated.fluent.MhsmRegionsClient; +import com.azure.resourcemanager.keyvault.generated.fluent.models.MhsmGeoReplicatedRegionInner; +import com.azure.resourcemanager.keyvault.generated.models.MhsmRegionsListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in MhsmRegionsClient. + */ +public final class MhsmRegionsClientImpl implements MhsmRegionsClient { + /** + * The proxy service used to perform REST calls. + */ + private final MhsmRegionsService service; + + /** + * The service client containing this operation class. + */ + private final AzureStorageResourceManagementApiImpl client; + + /** + * Initializes an instance of MhsmRegionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MhsmRegionsClientImpl(AzureStorageResourceManagementApiImpl client) { + this.service + = RestProxy.create(MhsmRegionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureStorageResourceManagementApiMhsmRegions to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureStorageResource") + public interface MhsmRegionsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/regions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResource(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("name") String name, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * The List operation gets information about the regions associated with the managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 regions associated with a managed HSM Pools along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceSinglePageAsync(String resourceGroupName, + String name) { + 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 (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResource(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, name, 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 regions associated with the managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 regions associated with a managed HSM Pools along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceSinglePageAsync(String resourceGroupName, + String name, 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 (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResource(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, name, 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 regions associated with the managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 regions associated with a managed HSM Pools as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceAsync(String resourceGroupName, String name) { + return new PagedFlux<>(() -> listByResourceSinglePageAsync(resourceGroupName, name), + nextLink -> listByResourceNextSinglePageAsync(nextLink)); + } + + /** + * The List operation gets information about the regions associated with the managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 regions associated with a managed HSM Pools as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceAsync(String resourceGroupName, String name, + Context context) { + return new PagedFlux<>(() -> listByResourceSinglePageAsync(resourceGroupName, name, context), + nextLink -> listByResourceNextSinglePageAsync(nextLink, context)); + } + + /** + * The List operation gets information about the regions associated with the managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 regions associated with a managed HSM Pools as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResource(String resourceGroupName, String name) { + return new PagedIterable<>(listByResourceAsync(resourceGroupName, name)); + } + + /** + * The List operation gets information about the regions associated with the managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 regions associated with a managed HSM Pools as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResource(String resourceGroupName, String name, + Context context) { + return new PagedIterable<>(listByResourceAsync(resourceGroupName, name, 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 regions associated with a managed HSM Pools along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceNextSinglePageAsync(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.listByResourceNext(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 regions associated with a managed HSM Pools along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceNextSinglePageAsync(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.listByResourceNext(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/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/MhsmRegionsImpl.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/MhsmRegionsImpl.java new file mode 100644 index 000000000000..89644fedf2c7 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/MhsmRegionsImpl.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.keyvault.generated.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.keyvault.generated.fluent.MhsmRegionsClient; +import com.azure.resourcemanager.keyvault.generated.fluent.models.MhsmGeoReplicatedRegionInner; +import com.azure.resourcemanager.keyvault.generated.models.MhsmGeoReplicatedRegion; +import com.azure.resourcemanager.keyvault.generated.models.MhsmRegions; + +public final class MhsmRegionsImpl implements MhsmRegions { + private static final ClientLogger LOGGER = new ClientLogger(MhsmRegionsImpl.class); + + private final MhsmRegionsClient innerClient; + + private final com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager; + + public MhsmRegionsImpl(MhsmRegionsClient innerClient, + com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByResource(String resourceGroupName, String name) { + PagedIterable inner + = this.serviceClient().listByResource(resourceGroupName, name); + return ResourceManagerUtils.mapPage(inner, inner1 -> new MhsmGeoReplicatedRegionImpl(inner1, this.manager())); + } + + public PagedIterable listByResource(String resourceGroupName, String name, + Context context) { + PagedIterable inner + = this.serviceClient().listByResource(resourceGroupName, name, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new MhsmGeoReplicatedRegionImpl(inner1, this.manager())); + } + + private MhsmRegionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/OperationImpl.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/OperationImpl.java new file mode 100644 index 000000000000..d83fd606637b --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/OperationImpl.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.implementation; + +import com.azure.resourcemanager.keyvault.generated.fluent.models.OperationInner; +import com.azure.resourcemanager.keyvault.generated.models.ActionType; +import com.azure.resourcemanager.keyvault.generated.models.Operation; +import com.azure.resourcemanager.keyvault.generated.models.OperationDisplay; +import com.azure.resourcemanager.keyvault.generated.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager; + + OperationImpl(OperationInner innerObject, + com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public Origin origin() { + return this.innerModel().origin(); + } + + public ActionType actionType() { + return this.innerModel().actionType(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/OperationsClientImpl.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..e6dd1f44a330 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/OperationsClientImpl.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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.keyvault.generated.fluent.OperationsClient; +import com.azure.resourcemanager.keyvault.generated.fluent.models.OperationInner; +import com.azure.resourcemanager.keyvault.generated.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ +public final class OperationsClientImpl implements OperationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final OperationsService service; + + /** + * The service client containing this operation class. + */ + private final AzureStorageResourceManagementApiImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(AzureStorageResourceManagementApiImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureStorageResourceManagementApiOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureStorageResource") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.KeyVault/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * List the operations for the provider. + * + * @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 REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + 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.list(this.client.getEndpoint(), 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())); + } + + /** + * List the operations for the provider. + * + * @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 REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List the operations for the provider. + * + * @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 REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the operations for the provider. + * + * @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 REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List the operations for the provider. + * + * @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 REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List the operations for the provider. + * + * @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 REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(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 REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(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.listNext(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 REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(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.listNext(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/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/OperationsImpl.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/OperationsImpl.java new file mode 100644 index 000000000000..2407288c3869 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/OperationsImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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.keyvault.generated.fluent.OperationsClient; +import com.azure.resourcemanager.keyvault.generated.fluent.models.OperationInner; +import com.azure.resourcemanager.keyvault.generated.models.Operation; +import com.azure.resourcemanager.keyvault.generated.models.Operations; + +public final class OperationsImpl implements Operations { + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, + com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + 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 OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/PrivateEndpointConnectionImpl.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/PrivateEndpointConnectionImpl.java new file mode 100644 index 000000000000..2bf68527f275 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/PrivateEndpointConnectionImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.keyvault.generated.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.keyvault.generated.models.PrivateEndpoint; +import com.azure.resourcemanager.keyvault.generated.models.PrivateEndpointConnection; +import com.azure.resourcemanager.keyvault.generated.models.PrivateEndpointConnectionProvisioningState; +import com.azure.resourcemanager.keyvault.generated.models.PrivateLinkServiceConnectionState; +import java.util.Collections; +import java.util.Map; + +public final class PrivateEndpointConnectionImpl + implements PrivateEndpointConnection, PrivateEndpointConnection.Definition, PrivateEndpointConnection.Update { + private PrivateEndpointConnectionInner innerObject; + + private final com.azure.resourcemanager.keyvault.generated.KeyvaultManager 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 String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public PrivateEndpoint privateEndpoint() { + return this.innerModel().privateEndpoint(); + } + + public PrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.innerModel().privateLinkServiceConnectionState(); + } + + public PrivateEndpointConnectionProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public PrivateEndpointConnectionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String vaultName; + + private String privateEndpointConnectionName; + + public PrivateEndpointConnectionImpl withExistingVault(String resourceGroupName, String vaultName) { + this.resourceGroupName = resourceGroupName; + this.vaultName = vaultName; + return this; + } + + public PrivateEndpointConnection create() { + this.innerObject = serviceManager.serviceClient() + .getPrivateEndpointConnections() + .putWithResponse(resourceGroupName, vaultName, privateEndpointConnectionName, this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public PrivateEndpointConnection create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getPrivateEndpointConnections() + .putWithResponse(resourceGroupName, vaultName, privateEndpointConnectionName, this.innerModel(), context) + .getValue(); + return this; + } + + PrivateEndpointConnectionImpl(String name, + com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager) { + this.innerObject = new PrivateEndpointConnectionInner(); + this.serviceManager = serviceManager; + this.privateEndpointConnectionName = name; + } + + public PrivateEndpointConnectionImpl update() { + return this; + } + + public PrivateEndpointConnection apply() { + this.innerObject = serviceManager.serviceClient() + .getPrivateEndpointConnections() + .putWithResponse(resourceGroupName, vaultName, privateEndpointConnectionName, this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public PrivateEndpointConnection apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getPrivateEndpointConnections() + .putWithResponse(resourceGroupName, vaultName, privateEndpointConnectionName, this.innerModel(), context) + .getValue(); + return this; + } + + PrivateEndpointConnectionImpl(PrivateEndpointConnectionInner innerObject, + com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.vaultName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "vaults"); + this.privateEndpointConnectionName + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "privateEndpointConnections"); + } + + public PrivateEndpointConnection refresh() { + this.innerObject = serviceManager.serviceClient() + .getPrivateEndpointConnections() + .getWithResponse(resourceGroupName, vaultName, privateEndpointConnectionName, Context.NONE) + .getValue(); + return this; + } + + public PrivateEndpointConnection refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getPrivateEndpointConnections() + .getWithResponse(resourceGroupName, vaultName, privateEndpointConnectionName, context) + .getValue(); + return this; + } + + public PrivateEndpointConnectionImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public PrivateEndpointConnectionImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public PrivateEndpointConnectionImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public PrivateEndpointConnectionImpl withEtag(String etag) { + this.innerModel().withEtag(etag); + return this; + } + + public PrivateEndpointConnectionImpl withPrivateEndpoint(PrivateEndpoint privateEndpoint) { + this.innerModel().withPrivateEndpoint(privateEndpoint); + return this; + } + + public PrivateEndpointConnectionImpl + withPrivateLinkServiceConnectionState(PrivateLinkServiceConnectionState privateLinkServiceConnectionState) { + this.innerModel().withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState); + return this; + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/PrivateEndpointConnectionsClientImpl.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/PrivateEndpointConnectionsClientImpl.java new file mode 100644 index 000000000000..95a36c6bd5b1 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/PrivateEndpointConnectionsClientImpl.java @@ -0,0 +1,847 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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.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.keyvault.generated.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.keyvault.generated.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.keyvault.generated.models.PrivateEndpointConnectionListResult; +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 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 AzureStorageResourceManagementApiImpl client; + + /** + * Initializes an instance of PrivateEndpointConnectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateEndpointConnectionsClientImpl(AzureStorageResourceManagementApiImpl client) { + this.service = RestProxy.create(PrivateEndpointConnectionsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureStorageResourceManagementApiPrivateEndpointConnections to be + * used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureStorageResource") + public interface PrivateEndpointConnectionsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResource(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("vaultName") String vaultName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("vaultName") String vaultName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> put(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("vaultName") String vaultName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @BodyParam("application/json") PrivateEndpointConnectionInner resource, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({ 200, 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("vaultName") String vaultName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceNext( + @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 vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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 response of a PrivateEndpointConnection list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceSinglePageAsync(String resourceGroupName, + String vaultName) { + 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 (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResource(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, vaultName, 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 vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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 response of a PrivateEndpointConnection list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceSinglePageAsync(String resourceGroupName, + String vaultName, 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 (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResource(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, vaultName, 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 vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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 response of a PrivateEndpointConnection list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceAsync(String resourceGroupName, String vaultName) { + return new PagedFlux<>(() -> listByResourceSinglePageAsync(resourceGroupName, vaultName), + nextLink -> listByResourceNextSinglePageAsync(nextLink)); + } + + /** + * The List operation gets information about the private endpoint connections associated with the vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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 response of a PrivateEndpointConnection list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceAsync(String resourceGroupName, String vaultName, + Context context) { + return new PagedFlux<>(() -> listByResourceSinglePageAsync(resourceGroupName, vaultName, context), + nextLink -> listByResourceNextSinglePageAsync(nextLink, context)); + } + + /** + * The List operation gets information about the private endpoint connections associated with the vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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 response of a PrivateEndpointConnection list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResource(String resourceGroupName, String vaultName) { + return new PagedIterable<>(listByResourceAsync(resourceGroupName, vaultName)); + } + + /** + * The List operation gets information about the private endpoint connections associated with the vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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 response of a PrivateEndpointConnection list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResource(String resourceGroupName, String vaultName, + Context context) { + return new PagedIterable<>(listByResourceAsync(resourceGroupName, vaultName, context)); + } + + /** + * Gets the specified private endpoint connection associated with the key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the key vault. + * @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 private endpoint connection associated with the key vault along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String vaultName, String privateEndpointConnectionName) { + 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 (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, vaultName, privateEndpointConnectionName, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the specified private endpoint connection associated with the key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the key vault. + * @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 private endpoint connection associated with the key vault along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String vaultName, String privateEndpointConnectionName, 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 (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, vaultName, privateEndpointConnectionName, accept, context); + } + + /** + * Gets the specified private endpoint connection associated with the key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the key vault. + * @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 private endpoint connection associated with the key vault on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String vaultName, + String privateEndpointConnectionName) { + return getWithResponseAsync(resourceGroupName, vaultName, privateEndpointConnectionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the specified private endpoint connection associated with the key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the key vault. + * @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 private endpoint connection associated with the key vault along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String vaultName, + String privateEndpointConnectionName, Context context) { + return getWithResponseAsync(resourceGroupName, vaultName, privateEndpointConnectionName, context).block(); + } + + /** + * Gets the specified private endpoint connection associated with the key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the key vault. + * @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 private endpoint connection associated with the key vault. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner get(String resourceGroupName, String vaultName, + String privateEndpointConnectionName) { + return getWithResponse(resourceGroupName, vaultName, privateEndpointConnectionName, Context.NONE).getValue(); + } + + /** + * Updates the specified private endpoint connection associated with the key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the key vault. + * @param resource The intended state of private endpoint connection. + * @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 private endpoint connection resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> putWithResponseAsync(String resourceGroupName, + String vaultName, String privateEndpointConnectionName, PrivateEndpointConnectionInner resource) { + 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 (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, vaultName, privateEndpointConnectionName, resource, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates the specified private endpoint connection associated with the key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the key vault. + * @param resource The intended state of private endpoint connection. + * @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 private endpoint connection resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> putWithResponseAsync(String resourceGroupName, + String vaultName, String privateEndpointConnectionName, PrivateEndpointConnectionInner resource, + 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 (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.put(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, vaultName, privateEndpointConnectionName, resource, accept, context); + } + + /** + * Updates the specified private endpoint connection associated with the key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the key vault. + * @param resource The intended state of private endpoint connection. + * @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 private endpoint connection resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono putAsync(String resourceGroupName, String vaultName, + String privateEndpointConnectionName, PrivateEndpointConnectionInner resource) { + return putWithResponseAsync(resourceGroupName, vaultName, privateEndpointConnectionName, resource) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates the specified private endpoint connection associated with the key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the key vault. + * @param resource The intended state of private endpoint connection. + * @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 private endpoint connection resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(String resourceGroupName, String vaultName, + String privateEndpointConnectionName, PrivateEndpointConnectionInner resource, Context context) { + return putWithResponseAsync(resourceGroupName, vaultName, privateEndpointConnectionName, resource, context) + .block(); + } + + /** + * Updates the specified private endpoint connection associated with the key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the key vault. + * @param resource The intended state of private endpoint connection. + * @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 private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner put(String resourceGroupName, String vaultName, + String privateEndpointConnectionName, PrivateEndpointConnectionInner resource) { + return putWithResponse(resourceGroupName, vaultName, privateEndpointConnectionName, resource, Context.NONE) + .getValue(); + } + + /** + * Deletes the specified private endpoint connection associated with the key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the key vault. + * @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 private endpoint connection resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String vaultName, + String privateEndpointConnectionName) { + 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 (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, vaultName, privateEndpointConnectionName, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the specified private endpoint connection associated with the key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the key vault. + * @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 private endpoint connection resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String vaultName, + String privateEndpointConnectionName, 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 (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, vaultName, privateEndpointConnectionName, accept, context); + } + + /** + * Deletes the specified private endpoint connection associated with the key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the key vault. + * @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 private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PrivateEndpointConnectionInner> + beginDeleteAsync(String resourceGroupName, String vaultName, String privateEndpointConnectionName) { + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, vaultName, privateEndpointConnectionName); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), PrivateEndpointConnectionInner.class, PrivateEndpointConnectionInner.class, + this.client.getContext()); + } + + /** + * Deletes the specified private endpoint connection associated with the key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the key vault. + * @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 private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PrivateEndpointConnectionInner> beginDeleteAsync( + String resourceGroupName, String vaultName, String privateEndpointConnectionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, vaultName, privateEndpointConnectionName, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), PrivateEndpointConnectionInner.class, PrivateEndpointConnectionInner.class, + context); + } + + /** + * Deletes the specified private endpoint connection associated with the key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the key vault. + * @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 private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PrivateEndpointConnectionInner> + beginDelete(String resourceGroupName, String vaultName, String privateEndpointConnectionName) { + return this.beginDeleteAsync(resourceGroupName, vaultName, privateEndpointConnectionName).getSyncPoller(); + } + + /** + * Deletes the specified private endpoint connection associated with the key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the key vault. + * @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 private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PrivateEndpointConnectionInner> + beginDelete(String resourceGroupName, String vaultName, String privateEndpointConnectionName, Context context) { + return this.beginDeleteAsync(resourceGroupName, vaultName, privateEndpointConnectionName, context) + .getSyncPoller(); + } + + /** + * Deletes the specified private endpoint connection associated with the key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the key vault. + * @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 private endpoint connection resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String vaultName, + String privateEndpointConnectionName) { + return beginDeleteAsync(resourceGroupName, vaultName, privateEndpointConnectionName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the specified private endpoint connection associated with the key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the key vault. + * @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 private endpoint connection resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String vaultName, + String privateEndpointConnectionName, Context context) { + return beginDeleteAsync(resourceGroupName, vaultName, privateEndpointConnectionName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the specified private endpoint connection associated with the key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the key vault. + * @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 private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner delete(String resourceGroupName, String vaultName, + String privateEndpointConnectionName) { + return deleteAsync(resourceGroupName, vaultName, privateEndpointConnectionName).block(); + } + + /** + * Deletes the specified private endpoint connection associated with the key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the key vault. + * @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 private endpoint connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner delete(String resourceGroupName, String vaultName, + String privateEndpointConnectionName, Context context) { + return deleteAsync(resourceGroupName, vaultName, privateEndpointConnectionName, 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 the response of a PrivateEndpointConnection list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceNextSinglePageAsync(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.listByResourceNext(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 the response of a PrivateEndpointConnection list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceNextSinglePageAsync(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.listByResourceNext(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/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/PrivateEndpointConnectionsImpl.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/PrivateEndpointConnectionsImpl.java new file mode 100644 index 000000000000..b30e175b832c --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/PrivateEndpointConnectionsImpl.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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.keyvault.generated.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.keyvault.generated.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.keyvault.generated.models.PrivateEndpointConnection; +import com.azure.resourcemanager.keyvault.generated.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.keyvault.generated.KeyvaultManager serviceManager; + + public PrivateEndpointConnectionsImpl(PrivateEndpointConnectionsClient innerClient, + com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByResource(String resourceGroupName, String vaultName) { + PagedIterable inner + = this.serviceClient().listByResource(resourceGroupName, vaultName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())); + } + + public PagedIterable listByResource(String resourceGroupName, String vaultName, + Context context) { + PagedIterable inner + = this.serviceClient().listByResource(resourceGroupName, vaultName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String vaultName, + String privateEndpointConnectionName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, vaultName, privateEndpointConnectionName, 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 vaultName, + String privateEndpointConnectionName) { + PrivateEndpointConnectionInner inner + = this.serviceClient().get(resourceGroupName, vaultName, privateEndpointConnectionName); + if (inner != null) { + return new PrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public PrivateEndpointConnection delete(String resourceGroupName, String vaultName, + String privateEndpointConnectionName) { + PrivateEndpointConnectionInner inner + = this.serviceClient().delete(resourceGroupName, vaultName, privateEndpointConnectionName); + if (inner != null) { + return new PrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public PrivateEndpointConnection delete(String resourceGroupName, String vaultName, + String privateEndpointConnectionName, Context context) { + PrivateEndpointConnectionInner inner + = this.serviceClient().delete(resourceGroupName, vaultName, privateEndpointConnectionName, context); + 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 vaultName = ResourceManagerUtils.getValueFromIdByName(id, "vaults"); + if (vaultName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'vaults'.", id))); + } + String privateEndpointConnectionName + = ResourceManagerUtils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", id))); + } + return this.getWithResponse(resourceGroupName, vaultName, privateEndpointConnectionName, 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 vaultName = ResourceManagerUtils.getValueFromIdByName(id, "vaults"); + if (vaultName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'vaults'.", id))); + } + String privateEndpointConnectionName + = ResourceManagerUtils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", id))); + } + return this.getWithResponse(resourceGroupName, vaultName, privateEndpointConnectionName, context); + } + + public PrivateEndpointConnection 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 vaultName = ResourceManagerUtils.getValueFromIdByName(id, "vaults"); + if (vaultName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'vaults'.", id))); + } + String privateEndpointConnectionName + = ResourceManagerUtils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", id))); + } + return this.delete(resourceGroupName, vaultName, privateEndpointConnectionName, Context.NONE); + } + + public PrivateEndpointConnection 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 vaultName = ResourceManagerUtils.getValueFromIdByName(id, "vaults"); + if (vaultName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'vaults'.", id))); + } + String privateEndpointConnectionName + = ResourceManagerUtils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", id))); + } + return this.delete(resourceGroupName, vaultName, privateEndpointConnectionName, context); + } + + private PrivateEndpointConnectionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager() { + return this.serviceManager; + } + + public PrivateEndpointConnectionImpl define(String name) { + return new PrivateEndpointConnectionImpl(name, this.manager()); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/PrivateLinkResourceListResultImpl.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/PrivateLinkResourceListResultImpl.java new file mode 100644 index 000000000000..a067ba96d11c --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/PrivateLinkResourceListResultImpl.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.keyvault.generated.implementation; + +import com.azure.resourcemanager.keyvault.generated.fluent.models.PrivateLinkResourceListResultInner; +import com.azure.resourcemanager.keyvault.generated.models.PrivateLinkResource; +import com.azure.resourcemanager.keyvault.generated.models.PrivateLinkResourceListResult; +import java.util.Collections; +import java.util.List; + +public final class PrivateLinkResourceListResultImpl implements PrivateLinkResourceListResult { + private PrivateLinkResourceListResultInner innerObject; + + private final com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager; + + PrivateLinkResourceListResultImpl(PrivateLinkResourceListResultInner innerObject, + com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public PrivateLinkResourceListResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/PrivateLinkResourcesClientImpl.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/PrivateLinkResourcesClientImpl.java new file mode 100644 index 000000000000..28c2d98709a4 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/PrivateLinkResourcesClientImpl.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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.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.keyvault.generated.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.keyvault.generated.fluent.models.PrivateLinkResourceListResultInner; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in PrivateLinkResourcesClient. + */ +public final class PrivateLinkResourcesClientImpl implements PrivateLinkResourcesClient { + /** + * The proxy service used to perform REST calls. + */ + private final PrivateLinkResourcesService service; + + /** + * The service client containing this operation class. + */ + private final AzureStorageResourceManagementApiImpl client; + + /** + * Initializes an instance of PrivateLinkResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateLinkResourcesClientImpl(AzureStorageResourceManagementApiImpl client) { + this.service = RestProxy.create(PrivateLinkResourcesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureStorageResourceManagementApiPrivateLinkResources to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureStorageResource") + public interface PrivateLinkResourcesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByVault(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("vaultName") String vaultName, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets the private link resources supported for the key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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 key vault along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByVaultWithResponseAsync(String resourceGroupName, + String vaultName) { + 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 (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByVault(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, vaultName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the private link resources supported for the key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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 key vault along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByVaultWithResponseAsync(String resourceGroupName, + String vaultName, 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 (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listByVault(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, vaultName, accept, context); + } + + /** + * Gets the private link resources supported for the key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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 key vault on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listByVaultAsync(String resourceGroupName, String vaultName) { + return listByVaultWithResponseAsync(resourceGroupName, vaultName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the private link resources supported for the key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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 key vault along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listByVaultWithResponse(String resourceGroupName, + String vaultName, Context context) { + return listByVaultWithResponseAsync(resourceGroupName, vaultName, context).block(); + } + + /** + * Gets the private link resources supported for the key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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 key vault. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateLinkResourceListResultInner listByVault(String resourceGroupName, String vaultName) { + return listByVaultWithResponse(resourceGroupName, vaultName, Context.NONE).getValue(); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/PrivateLinkResourcesImpl.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/PrivateLinkResourcesImpl.java new file mode 100644 index 000000000000..33305f25b567 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/PrivateLinkResourcesImpl.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.keyvault.generated.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.keyvault.generated.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.keyvault.generated.fluent.models.PrivateLinkResourceListResultInner; +import com.azure.resourcemanager.keyvault.generated.models.PrivateLinkResourceListResult; +import com.azure.resourcemanager.keyvault.generated.models.PrivateLinkResources; + +public final class PrivateLinkResourcesImpl implements PrivateLinkResources { + private static final ClientLogger LOGGER = new ClientLogger(PrivateLinkResourcesImpl.class); + + private final PrivateLinkResourcesClient innerClient; + + private final com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager; + + public PrivateLinkResourcesImpl(PrivateLinkResourcesClient innerClient, + com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response listByVaultWithResponse(String resourceGroupName, String vaultName, + Context context) { + Response inner + = this.serviceClient().listByVaultWithResponse(resourceGroupName, vaultName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new PrivateLinkResourceListResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PrivateLinkResourceListResult listByVault(String resourceGroupName, String vaultName) { + PrivateLinkResourceListResultInner inner = this.serviceClient().listByVault(resourceGroupName, vaultName); + if (inner != null) { + return new PrivateLinkResourceListResultImpl(inner, this.manager()); + } else { + return null; + } + } + + private PrivateLinkResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/ResourceManagerUtils.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/ResourceManagerUtils.java new file mode 100644 index 000000000000..8712056e3cfa --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/ResourceManagerUtils.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.implementation; + +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.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class ResourceManagerUtils { + private ResourceManagerUtils() { + } + + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (!segments.isEmpty() && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl<>(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super(PagedFlux.create(() -> (continuationToken, pageSize) -> Flux + .fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> new PagedResponseBase(page.getRequest(), page.getStatusCode(), page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/SecretImpl.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/SecretImpl.java new file mode 100644 index 000000000000..82a598b27659 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/SecretImpl.java @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.keyvault.generated.fluent.models.SecretInner; +import com.azure.resourcemanager.keyvault.generated.models.Secret; +import com.azure.resourcemanager.keyvault.generated.models.SecretAttributes; +import com.azure.resourcemanager.keyvault.generated.models.SecretPatchParameters; +import com.azure.resourcemanager.keyvault.generated.models.SecretPatchProperties; +import java.util.Collections; +import java.util.Map; + +public final class SecretImpl implements Secret, Secret.Definition, Secret.Update { + private SecretInner innerObject; + + private final com.azure.resourcemanager.keyvault.generated.KeyvaultManager 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public String value() { + return this.innerModel().value(); + } + + public String contentType() { + return this.innerModel().contentType(); + } + + public SecretAttributes attributes() { + return this.innerModel().attributes(); + } + + public String secretUri() { + return this.innerModel().secretUri(); + } + + public String secretUriWithVersion() { + return this.innerModel().secretUriWithVersion(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public SecretInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String vaultName; + + private String secretName; + + private SecretPatchParameters updateProperties; + + public SecretImpl withExistingVault(String resourceGroupName, String vaultName) { + this.resourceGroupName = resourceGroupName; + this.vaultName = vaultName; + return this; + } + + public Secret create() { + this.innerObject = serviceManager.serviceClient() + .getSecrets() + .createOrUpdateWithResponse(resourceGroupName, vaultName, secretName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Secret create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSecrets() + .createOrUpdateWithResponse(resourceGroupName, vaultName, secretName, this.innerModel(), context) + .getValue(); + return this; + } + + SecretImpl(String name, com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager) { + this.innerObject = new SecretInner(); + this.serviceManager = serviceManager; + this.secretName = name; + } + + public SecretImpl update() { + this.updateProperties = new SecretPatchParameters(); + return this; + } + + public Secret apply() { + this.innerObject = serviceManager.serviceClient() + .getSecrets() + .updateWithResponse(resourceGroupName, vaultName, secretName, updateProperties, Context.NONE) + .getValue(); + return this; + } + + public Secret apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSecrets() + .updateWithResponse(resourceGroupName, vaultName, secretName, updateProperties, context) + .getValue(); + return this; + } + + SecretImpl(SecretInner innerObject, com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.vaultName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "vaults"); + this.secretName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "secrets"); + } + + public Secret refresh() { + this.innerObject = serviceManager.serviceClient() + .getSecrets() + .getWithResponse(resourceGroupName, vaultName, secretName, Context.NONE) + .getValue(); + return this; + } + + public Secret refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSecrets() + .getWithResponse(resourceGroupName, vaultName, secretName, context) + .getValue(); + return this; + } + + public SecretImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public SecretImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public SecretImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public SecretImpl withValue(String value) { + this.innerModel().withValue(value); + return this; + } + + public SecretImpl withContentType(String contentType) { + this.innerModel().withContentType(contentType); + return this; + } + + public SecretImpl withAttributes(SecretAttributes attributes) { + this.innerModel().withAttributes(attributes); + return this; + } + + public SecretImpl withProperties(SecretPatchProperties properties) { + this.updateProperties.withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/SecretsClientImpl.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/SecretsClientImpl.java new file mode 100644 index 000000000000..14f4cafc68af --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/SecretsClientImpl.java @@ -0,0 +1,777 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.implementation; + +import com.azure.core.annotation.BodyParam; +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.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.keyvault.generated.fluent.SecretsClient; +import com.azure.resourcemanager.keyvault.generated.fluent.models.SecretInner; +import com.azure.resourcemanager.keyvault.generated.models.SecretListResult; +import com.azure.resourcemanager.keyvault.generated.models.SecretPatchParameters; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SecretsClient. + */ +public final class SecretsClientImpl implements SecretsClient { + /** + * The proxy service used to perform REST calls. + */ + private final SecretsService service; + + /** + * The service client containing this operation class. + */ + private final AzureStorageResourceManagementApiImpl client; + + /** + * Initializes an instance of SecretsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SecretsClientImpl(AzureStorageResourceManagementApiImpl client) { + this.service = RestProxy.create(SecretsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureStorageResourceManagementApiSecrets to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureStorageResource") + public interface SecretsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("vaultName") String vaultName, + @QueryParam("$top") Integer top, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("vaultName") String vaultName, + @PathParam("secretName") String secretName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("vaultName") String vaultName, + @PathParam("secretName") String secretName, @BodyParam("application/json") SecretInner resource, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("vaultName") String vaultName, + @PathParam("secretName") String secretName, @BodyParam("application/json") SecretPatchParameters properties, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in + * ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param top Maximum number of results to return. + * @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 response of a Secret list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String vaultName, + Integer top) { + 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 (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, vaultName, top, 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 secrets in a vault. NOTE: This API is intended for internal use in + * ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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. + * @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 response of a Secret list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String vaultName, + Integer top, 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 (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, vaultName, top, 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 secrets in a vault. NOTE: This API is intended for internal use in + * ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param top Maximum number of results to return. + * @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 response of a Secret list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String vaultName, Integer top) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, vaultName, top), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in + * ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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 response of a Secret list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String vaultName) { + final Integer top = null; + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, vaultName, top), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in + * ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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. + * @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 response of a Secret list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String vaultName, Integer top, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, vaultName, top, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in + * ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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 response of a Secret list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String vaultName) { + final Integer top = null; + return new PagedIterable<>(listAsync(resourceGroupName, vaultName, top)); + } + + /** + * The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in + * ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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. + * @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 response of a Secret list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String vaultName, Integer top, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, vaultName, top, context)); + } + + /** + * Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the + * data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param secretName The name of the secret. + * @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 secret along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String vaultName, + String secretName) { + 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 (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (secretName == null) { + return Mono.error(new IllegalArgumentException("Parameter secretName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, vaultName, secretName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the + * data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param secretName The name of the secret. + * @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 secret along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String vaultName, + String secretName, 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 (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (secretName == null) { + return Mono.error(new IllegalArgumentException("Parameter secretName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, vaultName, secretName, accept, context); + } + + /** + * Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the + * data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param secretName The name of the secret. + * @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 secret on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String vaultName, String secretName) { + return getWithResponseAsync(resourceGroupName, vaultName, secretName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the + * data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param secretName The name of the secret. + * @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 secret along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String vaultName, String secretName, + Context context) { + return getWithResponseAsync(resourceGroupName, vaultName, secretName, context).block(); + } + + /** + * Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the + * data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param secretName The name of the secret. + * @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 secret. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SecretInner get(String resourceGroupName, String vaultName, String secretName) { + return getWithResponse(resourceGroupName, vaultName, secretName, Context.NONE).getValue(); + } + + /** + * Create or update a secret in a key vault in the specified subscription. NOTE: This API is intended for internal + * use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param secretName The name of the secret. + * @param resource Parameters to create or update the secret. + * @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 vaultName, + String secretName, SecretInner resource) { + 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 (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (secretName == null) { + return Mono.error(new IllegalArgumentException("Parameter secretName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, vaultName, secretName, resource, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update a secret in a key vault in the specified subscription. NOTE: This API is intended for internal + * use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param secretName The name of the secret. + * @param resource Parameters to create or update the secret. + * @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 vaultName, + String secretName, SecretInner resource, 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 (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (secretName == null) { + return Mono.error(new IllegalArgumentException("Parameter secretName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, vaultName, secretName, resource, accept, context); + } + + /** + * Create or update a secret in a key vault in the specified subscription. NOTE: This API is intended for internal + * use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param secretName The name of the secret. + * @param resource Parameters to create or update the secret. + * @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 vaultName, String secretName, + SecretInner resource) { + return createOrUpdateWithResponseAsync(resourceGroupName, vaultName, secretName, resource) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create or update a secret in a key vault in the specified subscription. NOTE: This API is intended for internal + * use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param secretName The name of the secret. + * @param resource Parameters to create or update the secret. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String resourceGroupName, String vaultName, + String secretName, SecretInner resource, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, vaultName, secretName, resource, context).block(); + } + + /** + * Create or update a secret in a key vault in the specified subscription. NOTE: This API is intended for internal + * use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param secretName The name of the secret. + * @param resource Parameters to create or update the secret. + * @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 SecretInner createOrUpdate(String resourceGroupName, String vaultName, String secretName, + SecretInner resource) { + return createOrUpdateWithResponse(resourceGroupName, vaultName, secretName, resource, Context.NONE).getValue(); + } + + /** + * Update a secret in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. + * Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param secretName The name of the secret. + * @param properties Parameters to patch the secret. + * @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 vaultName, + String secretName, SecretPatchParameters 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 (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (secretName == null) { + return Mono.error(new IllegalArgumentException("Parameter secretName 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.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, vaultName, secretName, properties, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a secret in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. + * Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param secretName The name of the secret. + * @param properties Parameters to patch the secret. + * @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 vaultName, + String secretName, SecretPatchParameters 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 (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (secretName == null) { + return Mono.error(new IllegalArgumentException("Parameter secretName 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.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, vaultName, secretName, properties, accept, context); + } + + /** + * Update a secret in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. + * Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param secretName The name of the secret. + * @param properties Parameters to patch the secret. + * @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 vaultName, String secretName, + SecretPatchParameters properties) { + return updateWithResponseAsync(resourceGroupName, vaultName, secretName, properties) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Update a secret in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. + * Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param secretName The name of the secret. + * @param properties Parameters to patch the secret. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String resourceGroupName, String vaultName, String secretName, + SecretPatchParameters properties, Context context) { + return updateWithResponseAsync(resourceGroupName, vaultName, secretName, properties, context).block(); + } + + /** + * Update a secret in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. + * Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param secretName The name of the secret. + * @param properties Parameters to patch the secret. + * @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 SecretInner update(String resourceGroupName, String vaultName, String secretName, + SecretPatchParameters properties) { + return updateWithResponse(resourceGroupName, vaultName, secretName, properties, Context.NONE).getValue(); + } + + /** + * 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 the response of a Secret list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(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.listNext(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 the response of a Secret list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(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.listNext(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/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/SecretsImpl.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/SecretsImpl.java new file mode 100644 index 000000000000..61564d430445 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/SecretsImpl.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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.keyvault.generated.fluent.SecretsClient; +import com.azure.resourcemanager.keyvault.generated.fluent.models.SecretInner; +import com.azure.resourcemanager.keyvault.generated.models.Secret; +import com.azure.resourcemanager.keyvault.generated.models.Secrets; + +public final class SecretsImpl implements Secrets { + private static final ClientLogger LOGGER = new ClientLogger(SecretsImpl.class); + + private final SecretsClient innerClient; + + private final com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager; + + public SecretsImpl(SecretsClient innerClient, + com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String vaultName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, vaultName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SecretImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String vaultName, Integer top, Context context) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, vaultName, top, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SecretImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String vaultName, String secretName, + Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, vaultName, secretName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SecretImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Secret get(String resourceGroupName, String vaultName, String secretName) { + SecretInner inner = this.serviceClient().get(resourceGroupName, vaultName, secretName); + if (inner != null) { + return new SecretImpl(inner, this.manager()); + } else { + return null; + } + } + + public Secret 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 vaultName = ResourceManagerUtils.getValueFromIdByName(id, "vaults"); + if (vaultName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'vaults'.", id))); + } + String secretName = ResourceManagerUtils.getValueFromIdByName(id, "secrets"); + if (secretName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'secrets'.", id))); + } + return this.getWithResponse(resourceGroupName, vaultName, secretName, 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 vaultName = ResourceManagerUtils.getValueFromIdByName(id, "vaults"); + if (vaultName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'vaults'.", id))); + } + String secretName = ResourceManagerUtils.getValueFromIdByName(id, "secrets"); + if (secretName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'secrets'.", id))); + } + return this.getWithResponse(resourceGroupName, vaultName, secretName, context); + } + + private SecretsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager() { + return this.serviceManager; + } + + public SecretImpl define(String name) { + return new SecretImpl(name, this.manager()); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/VaultAccessPolicyParametersImpl.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/VaultAccessPolicyParametersImpl.java new file mode 100644 index 000000000000..22ed77ad0f89 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/VaultAccessPolicyParametersImpl.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.keyvault.generated.implementation; + +import com.azure.resourcemanager.keyvault.generated.fluent.models.VaultAccessPolicyParametersInner; +import com.azure.resourcemanager.keyvault.generated.models.VaultAccessPolicyParameters; +import com.azure.resourcemanager.keyvault.generated.models.VaultAccessPolicyProperties; + +public final class VaultAccessPolicyParametersImpl implements VaultAccessPolicyParameters { + private VaultAccessPolicyParametersInner innerObject; + + private final com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager; + + VaultAccessPolicyParametersImpl(VaultAccessPolicyParametersInner innerObject, + com.azure.resourcemanager.keyvault.generated.KeyvaultManager 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 String location() { + return this.innerModel().location(); + } + + public VaultAccessPolicyProperties properties() { + return this.innerModel().properties(); + } + + public VaultAccessPolicyParametersInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/VaultImpl.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/VaultImpl.java new file mode 100644 index 000000000000..86164acc3530 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/VaultImpl.java @@ -0,0 +1,335 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.keyvault.generated.fluent.models.VaultInner; +import com.azure.resourcemanager.keyvault.generated.models.AccessPolicyEntry; +import com.azure.resourcemanager.keyvault.generated.models.KeyVaultCreateMode; +import com.azure.resourcemanager.keyvault.generated.models.KeyVaultProvisioningState; +import com.azure.resourcemanager.keyvault.generated.models.NetworkRuleSet; +import com.azure.resourcemanager.keyvault.generated.models.PrivateEndpointConnectionItem; +import com.azure.resourcemanager.keyvault.generated.models.Sku; +import com.azure.resourcemanager.keyvault.generated.models.Vault; +import com.azure.resourcemanager.keyvault.generated.models.VaultPatchParameters; +import com.azure.resourcemanager.keyvault.generated.models.VaultPatchProperties; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public final class VaultImpl implements Vault, Vault.Definition, Vault.Update { + private VaultInner innerObject; + + private final com.azure.resourcemanager.keyvault.generated.KeyvaultManager 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public UUID tenantId() { + return this.innerModel().tenantId(); + } + + public Sku sku() { + return this.innerModel().sku(); + } + + public List accessPolicies() { + List inner = this.innerModel().accessPolicies(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String vaultUri() { + return this.innerModel().vaultUri(); + } + + public String hsmPoolResourceId() { + return this.innerModel().hsmPoolResourceId(); + } + + public Boolean enabledForDeployment() { + return this.innerModel().enabledForDeployment(); + } + + public Boolean enabledForDiskEncryption() { + return this.innerModel().enabledForDiskEncryption(); + } + + public Boolean enabledForTemplateDeployment() { + return this.innerModel().enabledForTemplateDeployment(); + } + + public Boolean enableSoftDelete() { + return this.innerModel().enableSoftDelete(); + } + + public Integer softDeleteRetentionInDays() { + return this.innerModel().softDeleteRetentionInDays(); + } + + public Boolean enableRbacAuthorization() { + return this.innerModel().enableRbacAuthorization(); + } + + public KeyVaultCreateMode createMode() { + return this.innerModel().createMode(); + } + + public Boolean enablePurgeProtection() { + return this.innerModel().enablePurgeProtection(); + } + + public NetworkRuleSet networkAcls() { + return this.innerModel().networkAcls(); + } + + public KeyVaultProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public List privateEndpointConnections() { + List inner = this.innerModel().privateEndpointConnections(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String publicNetworkAccess() { + return this.innerModel().publicNetworkAccess(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public VaultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String vaultName; + + private VaultPatchParameters updateProperties; + + public VaultImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Vault create() { + this.innerObject = serviceManager.serviceClient() + .getVaults() + .createOrUpdate(resourceGroupName, vaultName, this.innerModel(), Context.NONE); + return this; + } + + public Vault create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getVaults() + .createOrUpdate(resourceGroupName, vaultName, this.innerModel(), context); + return this; + } + + VaultImpl(String name, com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager) { + this.innerObject = new VaultInner(); + this.serviceManager = serviceManager; + this.vaultName = name; + } + + public VaultImpl update() { + this.updateProperties = new VaultPatchParameters(); + return this; + } + + public Vault apply() { + this.innerObject = serviceManager.serviceClient() + .getVaults() + .updateWithResponse(resourceGroupName, vaultName, updateProperties, Context.NONE) + .getValue(); + return this; + } + + public Vault apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getVaults() + .updateWithResponse(resourceGroupName, vaultName, updateProperties, context) + .getValue(); + return this; + } + + VaultImpl(VaultInner innerObject, com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.vaultName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "vaults"); + } + + public Vault refresh() { + this.innerObject = serviceManager.serviceClient() + .getVaults() + .getByResourceGroupWithResponse(resourceGroupName, vaultName, Context.NONE) + .getValue(); + return this; + } + + public Vault refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getVaults() + .getByResourceGroupWithResponse(resourceGroupName, vaultName, context) + .getValue(); + return this; + } + + public VaultImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public VaultImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public VaultImpl withTenantId(UUID tenantId) { + this.innerModel().withTenantId(tenantId); + return this; + } + + public VaultImpl withSku(Sku sku) { + this.innerModel().withSku(sku); + return this; + } + + public VaultImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public VaultImpl withAccessPolicies(List accessPolicies) { + this.innerModel().withAccessPolicies(accessPolicies); + return this; + } + + public VaultImpl withVaultUri(String vaultUri) { + this.innerModel().withVaultUri(vaultUri); + return this; + } + + public VaultImpl withEnabledForDeployment(Boolean enabledForDeployment) { + this.innerModel().withEnabledForDeployment(enabledForDeployment); + return this; + } + + public VaultImpl withEnabledForDiskEncryption(Boolean enabledForDiskEncryption) { + this.innerModel().withEnabledForDiskEncryption(enabledForDiskEncryption); + return this; + } + + public VaultImpl withEnabledForTemplateDeployment(Boolean enabledForTemplateDeployment) { + this.innerModel().withEnabledForTemplateDeployment(enabledForTemplateDeployment); + return this; + } + + public VaultImpl withEnableSoftDelete(Boolean enableSoftDelete) { + this.innerModel().withEnableSoftDelete(enableSoftDelete); + return this; + } + + public VaultImpl withSoftDeleteRetentionInDays(Integer softDeleteRetentionInDays) { + this.innerModel().withSoftDeleteRetentionInDays(softDeleteRetentionInDays); + return this; + } + + public VaultImpl withEnableRbacAuthorization(Boolean enableRbacAuthorization) { + this.innerModel().withEnableRbacAuthorization(enableRbacAuthorization); + return this; + } + + public VaultImpl withCreateMode(KeyVaultCreateMode createMode) { + this.innerModel().withCreateMode(createMode); + return this; + } + + public VaultImpl withEnablePurgeProtection(Boolean enablePurgeProtection) { + this.innerModel().withEnablePurgeProtection(enablePurgeProtection); + return this; + } + + public VaultImpl withNetworkAcls(NetworkRuleSet networkAcls) { + this.innerModel().withNetworkAcls(networkAcls); + return this; + } + + public VaultImpl withProvisioningState(KeyVaultProvisioningState provisioningState) { + this.innerModel().withProvisioningState(provisioningState); + return this; + } + + public VaultImpl withPublicNetworkAccess(String publicNetworkAccess) { + this.innerModel().withPublicNetworkAccess(publicNetworkAccess); + return this; + } + + public VaultImpl withProperties(VaultPatchProperties properties) { + this.updateProperties.withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/VaultsClientImpl.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/VaultsClientImpl.java new file mode 100644 index 000000000000..9f68c0046d9c --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/VaultsClientImpl.java @@ -0,0 +1,1930 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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.keyvault.generated.fluent.VaultsClient; +import com.azure.resourcemanager.keyvault.generated.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.keyvault.generated.fluent.models.DeletedVaultInner; +import com.azure.resourcemanager.keyvault.generated.fluent.models.VaultAccessPolicyParametersInner; +import com.azure.resourcemanager.keyvault.generated.fluent.models.VaultInner; +import com.azure.resourcemanager.keyvault.generated.models.AccessPolicyUpdateKind; +import com.azure.resourcemanager.keyvault.generated.models.DeletedVaultListResult; +import com.azure.resourcemanager.keyvault.generated.models.VaultCheckNameAvailabilityParameters; +import com.azure.resourcemanager.keyvault.generated.models.VaultListResult; +import com.azure.resourcemanager.keyvault.generated.models.VaultPatchParameters; +import com.azure.resourcemanager.keyvault.generated.models.VaultsUpdateAccessPolicyResponse; +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 VaultsClient. + */ +public final class VaultsClientImpl implements VaultsClient { + /** + * The proxy service used to perform REST calls. + */ + private final VaultsService service; + + /** + * The service client containing this operation class. + */ + private final AzureStorageResourceManagementApiImpl client; + + /** + * Initializes an instance of VaultsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VaultsClientImpl(AzureStorageResourceManagementApiImpl client) { + this.service = RestProxy.create(VaultsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureStorageResourceManagementApiVaults to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureStorageResource") + public interface VaultsService { + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkNameAvailability(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") VaultCheckNameAvailabilityParameters body, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getDeleted(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, @PathParam("vaultName") String vaultName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> purgeDeleted(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, @PathParam("vaultName") String vaultName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscription(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @QueryParam("$top") Integer top, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("$top") Integer top, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("vaultName") String vaultName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("vaultName") String vaultName, + @BodyParam("application/json") VaultInner resource, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("vaultName") String vaultName, + @BodyParam("application/json") VaultPatchParameters properties, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("vaultName") String vaultName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/{operationKind}/{operationKind}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono updateAccessPolicy(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("vaultName") String vaultName, + @PathParam("operationKind") AccessPolicyUpdateKind operationKind, + @BodyParam("application/json") VaultAccessPolicyParametersInner body, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listDeletedNext( + @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); + + @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); + } + + /** + * Checks that the vault name is valid and is not already in use. + * + * @param body The request body. + * @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 CheckNameAvailability operation response along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + checkNameAvailabilityWithResponseAsync(VaultCheckNameAvailabilityParameters 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 (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.checkNameAvailability(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), body, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Checks that the vault name is valid and is not already in use. + * + * @param body The request body. + * @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 CheckNameAvailability operation response along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + checkNameAvailabilityWithResponseAsync(VaultCheckNameAvailabilityParameters 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 (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.checkNameAvailability(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), body, accept, context); + } + + /** + * Checks that the vault name is valid and is not already in use. + * + * @param body The request body. + * @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 CheckNameAvailability operation response on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono + checkNameAvailabilityAsync(VaultCheckNameAvailabilityParameters body) { + return checkNameAvailabilityWithResponseAsync(body).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Checks that the vault name is valid and is not already in use. + * + * @param body The request body. + * @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 CheckNameAvailability operation response along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response + checkNameAvailabilityWithResponse(VaultCheckNameAvailabilityParameters body, Context context) { + return checkNameAvailabilityWithResponseAsync(body, context).block(); + } + + /** + * Checks that the vault name is valid and is not already in use. + * + * @param body The request body. + * @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 CheckNameAvailability operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CheckNameAvailabilityResultInner checkNameAvailability(VaultCheckNameAvailabilityParameters body) { + return checkNameAvailabilityWithResponse(body, Context.NONE).getValue(); + } + + /** + * Gets information about the deleted vaults in a 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 information about the deleted vaults in a subscription along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + 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.getApiVersion(), + this.client.getSubscriptionId(), 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 information about the deleted vaults in a subscription. + * + * @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 information about the deleted vaults in a subscription along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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.")); + } + 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.getApiVersion(), this.client.getSubscriptionId(), accept, + context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets information about the deleted vaults in a 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 information about the deleted vaults in a subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listDeletedNextSinglePageAsync(nextLink)); + } + + /** + * Gets information about the deleted vaults in a subscription. + * + * @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 information about the deleted vaults in a subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listDeletedNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets information about the deleted vaults in a 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 information about the deleted vaults in a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets information about the deleted vaults in a subscription. + * + * @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 information about the deleted vaults in a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Gets the deleted Azure key vault. + * + * @param location The name of the Azure region. + * @param vaultName The name of the vault. + * @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 deleted Azure key vault along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDeletedWithResponseAsync(String location, String vaultName) { + 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getDeleted(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, vaultName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the deleted Azure key vault. + * + * @param location The name of the Azure region. + * @param vaultName The name of the vault. + * @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 deleted Azure key vault along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDeletedWithResponseAsync(String location, String vaultName, + 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getDeleted(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, vaultName, accept, context); + } + + /** + * Gets the deleted Azure key vault. + * + * @param location The name of the Azure region. + * @param vaultName The name of the vault. + * @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 deleted Azure key vault on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getDeletedAsync(String location, String vaultName) { + return getDeletedWithResponseAsync(location, vaultName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the deleted Azure key vault. + * + * @param location The name of the Azure region. + * @param vaultName The name of the vault. + * @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 deleted Azure key vault along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDeletedWithResponse(String location, String vaultName, Context context) { + return getDeletedWithResponseAsync(location, vaultName, context).block(); + } + + /** + * Gets the deleted Azure key vault. + * + * @param location The name of the Azure region. + * @param vaultName The name of the vault. + * @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 deleted Azure key vault. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeletedVaultInner getDeleted(String location, String vaultName) { + return getDeletedWithResponse(location, vaultName, Context.NONE).getValue(); + } + + /** + * Permanently deletes the specified vault. aka Purges the deleted Azure key vault. + * + * @param location The name of the Azure region. + * @param vaultName The name of the vault. + * @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>> purgeDeletedWithResponseAsync(String location, String vaultName) { + 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.purgeDeleted(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, vaultName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Permanently deletes the specified vault. aka Purges the deleted Azure key vault. + * + * @param location The name of the Azure region. + * @param vaultName The name of the vault. + * @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>> purgeDeletedWithResponseAsync(String location, String vaultName, + 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.purgeDeleted(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, vaultName, accept, context); + } + + /** + * Permanently deletes the specified vault. aka Purges the deleted Azure key vault. + * + * @param location The name of the Azure region. + * @param vaultName The name of the vault. + * @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> beginPurgeDeletedAsync(String location, String vaultName) { + Mono>> mono = purgeDeletedWithResponseAsync(location, vaultName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Permanently deletes the specified vault. aka Purges the deleted Azure key vault. + * + * @param location The name of the Azure region. + * @param vaultName The name of the vault. + * @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> beginPurgeDeletedAsync(String location, String vaultName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = purgeDeletedWithResponseAsync(location, vaultName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Permanently deletes the specified vault. aka Purges the deleted Azure key vault. + * + * @param location The name of the Azure region. + * @param vaultName The name of the vault. + * @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> beginPurgeDeleted(String location, String vaultName) { + return this.beginPurgeDeletedAsync(location, vaultName).getSyncPoller(); + } + + /** + * Permanently deletes the specified vault. aka Purges the deleted Azure key vault. + * + * @param location The name of the Azure region. + * @param vaultName The name of the vault. + * @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> beginPurgeDeleted(String location, String vaultName, Context context) { + return this.beginPurgeDeletedAsync(location, vaultName, context).getSyncPoller(); + } + + /** + * Permanently deletes the specified vault. aka Purges the deleted Azure key vault. + * + * @param location The name of the Azure region. + * @param vaultName The name of the vault. + * @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 purgeDeletedAsync(String location, String vaultName) { + return beginPurgeDeletedAsync(location, vaultName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Permanently deletes the specified vault. aka Purges the deleted Azure key vault. + * + * @param location The name of the Azure region. + * @param vaultName The name of the vault. + * @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 purgeDeletedAsync(String location, String vaultName, Context context) { + return beginPurgeDeletedAsync(location, vaultName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Permanently deletes the specified vault. aka Purges the deleted Azure key vault. + * + * @param location The name of the Azure region. + * @param vaultName The name of the vault. + * @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 purgeDeleted(String location, String vaultName) { + purgeDeletedAsync(location, vaultName).block(); + } + + /** + * Permanently deletes the specified vault. aka Purges the deleted Azure key vault. + * + * @param location The name of the Azure region. + * @param vaultName The name of the vault. + * @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 purgeDeleted(String location, String vaultName, Context context) { + purgeDeletedAsync(location, vaultName, context).block(); + } + + /** + * The List operation gets information about the vaults associated with the subscription. + * + * @param top Maximum number of results to return. + * @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 response of a Vault list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionSinglePageAsync(Integer top) { + 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.listBySubscription(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), top, 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 vaults associated with the subscription. + * + * @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. + * @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 response of a Vault list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionSinglePageAsync(Integer top, 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 + .listBySubscription(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + top, 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 vaults associated with the subscription. + * + * @param top Maximum number of results to return. + * @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 response of a Vault list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionAsync(Integer top) { + return new PagedFlux<>(() -> listBySubscriptionSinglePageAsync(top), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * The List operation gets information about the vaults 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 the response of a Vault list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionAsync() { + final Integer top = null; + return new PagedFlux<>(() -> listBySubscriptionSinglePageAsync(top), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * The List operation gets information about the vaults associated with the subscription. + * + * @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. + * @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 response of a Vault list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionAsync(Integer top, Context context) { + return new PagedFlux<>(() -> listBySubscriptionSinglePageAsync(top, context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * The List operation gets information about the vaults 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 the response of a Vault list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscription() { + final Integer top = null; + return new PagedIterable<>(listBySubscriptionAsync(top)); + } + + /** + * The List operation gets information about the vaults associated with the subscription. + * + * @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. + * @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 response of a Vault list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscription(Integer top, Context context) { + return new PagedIterable<>(listBySubscriptionAsync(top, context)); + } + + /** + * The List operation gets information about the vaults associated with the subscription and within the specified + * resource group. + * + * @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 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 response of a Vault list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, Integer top) { + 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.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, top, 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 vaults associated with the subscription and within the specified + * resource group. + * + * @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. + * @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 response of a Vault list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, Integer top, + 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.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, top, 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 vaults associated with the subscription and within the specified + * resource group. + * + * @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 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 response of a Vault list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Integer top) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, top), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * The List operation gets information about the vaults 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 the response of a Vault list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + final Integer top = null; + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, top), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * The List operation gets information about the vaults associated with the subscription and within the specified + * resource group. + * + * @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. + * @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 response of a Vault list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Integer top, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, top, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * The List operation gets information about the vaults 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 the response of a Vault list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + final Integer top = null; + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, top)); + } + + /** + * The List operation gets information about the vaults associated with the subscription and within the specified + * resource group. + * + * @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. + * @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 response of a Vault list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Integer top, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, top, context)); + } + + /** + * Gets the specified Azure key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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 Azure key vault along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, String vaultName) { + 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 (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, vaultName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the specified Azure key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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 Azure key vault along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, String vaultName, + 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 (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, vaultName, accept, context); + } + + /** + * Gets the specified Azure key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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 Azure key vault on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String vaultName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, vaultName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the specified Azure key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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 Azure key vault along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, String vaultName, + Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, vaultName, context).block(); + } + + /** + * Gets the specified Azure key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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 Azure key vault. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VaultInner getByResourceGroup(String resourceGroupName, String vaultName) { + return getByResourceGroupWithResponse(resourceGroupName, vaultName, Context.NONE).getValue(); + } + + /** + * Create or update a key vault in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param resource Parameters to create or update the vault. + * @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 vaultName, + VaultInner resource) { + 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 (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, vaultName, resource, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update a key vault in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param resource Parameters to create or update the vault. + * @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 vaultName, + VaultInner resource, 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 (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, vaultName, resource, accept, context); + } + + /** + * Create or update a key vault in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param resource Parameters to create or update the vault. + * @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, VaultInner> beginCreateOrUpdateAsync(String resourceGroupName, + String vaultName, VaultInner resource) { + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, vaultName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), VaultInner.class, + VaultInner.class, this.client.getContext()); + } + + /** + * Create or update a key vault in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param resource Parameters to create or update the vault. + * @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, VaultInner> beginCreateOrUpdateAsync(String resourceGroupName, + String vaultName, VaultInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, vaultName, resource, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), VaultInner.class, + VaultInner.class, context); + } + + /** + * Create or update a key vault in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param resource Parameters to create or update the vault. + * @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, VaultInner> beginCreateOrUpdate(String resourceGroupName, + String vaultName, VaultInner resource) { + return this.beginCreateOrUpdateAsync(resourceGroupName, vaultName, resource).getSyncPoller(); + } + + /** + * Create or update a key vault in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param resource Parameters to create or update the vault. + * @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, VaultInner> beginCreateOrUpdate(String resourceGroupName, + String vaultName, VaultInner resource, Context context) { + return this.beginCreateOrUpdateAsync(resourceGroupName, vaultName, resource, context).getSyncPoller(); + } + + /** + * Create or update a key vault in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param resource Parameters to create or update the vault. + * @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 vaultName, VaultInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, vaultName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a key vault in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param resource Parameters to create or update the vault. + * @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 vaultName, VaultInner resource, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, vaultName, resource, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a key vault in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param resource Parameters to create or update the vault. + * @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 VaultInner createOrUpdate(String resourceGroupName, String vaultName, VaultInner resource) { + return createOrUpdateAsync(resourceGroupName, vaultName, resource).block(); + } + + /** + * Create or update a key vault in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param resource Parameters to create or update the vault. + * @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 VaultInner createOrUpdate(String resourceGroupName, String vaultName, VaultInner resource, Context context) { + return createOrUpdateAsync(resourceGroupName, vaultName, resource, context).block(); + } + + /** + * Update a key vault in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param properties Parameters to patch the vault. + * @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 vaultName, + VaultPatchParameters 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 (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName 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.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, vaultName, properties, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a key vault in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param properties Parameters to patch the vault. + * @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 vaultName, + VaultPatchParameters 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 (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName 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.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, vaultName, properties, accept, context); + } + + /** + * Update a key vault in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param properties Parameters to patch the vault. + * @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 vaultName, VaultPatchParameters properties) { + return updateWithResponseAsync(resourceGroupName, vaultName, properties) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Update a key vault in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param properties Parameters to patch the vault. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String resourceGroupName, String vaultName, + VaultPatchParameters properties, Context context) { + return updateWithResponseAsync(resourceGroupName, vaultName, properties, context).block(); + } + + /** + * Update a key vault in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param properties Parameters to patch the vault. + * @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 VaultInner update(String resourceGroupName, String vaultName, VaultPatchParameters properties) { + return updateWithResponse(resourceGroupName, vaultName, properties, Context.NONE).getValue(); + } + + /** + * Deletes the specified Azure key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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 vaultName) { + 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 (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, vaultName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the specified Azure key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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 vaultName, 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 (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, vaultName, accept, context); + } + + /** + * Deletes the specified Azure key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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 vaultName) { + return deleteWithResponseAsync(resourceGroupName, vaultName).flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes the specified Azure key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String vaultName, Context context) { + return deleteWithResponseAsync(resourceGroupName, vaultName, context).block(); + } + + /** + * Deletes the specified Azure key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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 vaultName) { + deleteWithResponse(resourceGroupName, vaultName, Context.NONE); + } + + /** + * Update access policies in a key vault in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param operationKind Name of the operation. + * @param body Access policy to merge into the vault. + * @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 parameters for updating the access policy in a vault on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAccessPolicyWithResponseAsync(String resourceGroupName, + String vaultName, AccessPolicyUpdateKind operationKind, VaultAccessPolicyParametersInner 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 (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (operationKind == null) { + return Mono.error(new IllegalArgumentException("Parameter operationKind 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.updateAccessPolicy(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, vaultName, operationKind, body, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update access policies in a key vault in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param operationKind Name of the operation. + * @param body Access policy to merge into the vault. + * @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 parameters for updating the access policy in a vault on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAccessPolicyWithResponseAsync(String resourceGroupName, + String vaultName, AccessPolicyUpdateKind operationKind, VaultAccessPolicyParametersInner 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 (vaultName == null) { + return Mono.error(new IllegalArgumentException("Parameter vaultName is required and cannot be null.")); + } + if (operationKind == null) { + return Mono.error(new IllegalArgumentException("Parameter operationKind 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.updateAccessPolicy(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, vaultName, operationKind, body, accept, context); + } + + /** + * Update access policies in a key vault in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param operationKind Name of the operation. + * @param body Access policy to merge into the vault. + * @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 parameters for updating the access policy in a vault on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAccessPolicyAsync(String resourceGroupName, String vaultName, + AccessPolicyUpdateKind operationKind, VaultAccessPolicyParametersInner body) { + return updateAccessPolicyWithResponseAsync(resourceGroupName, vaultName, operationKind, body) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Update access policies in a key vault in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param operationKind Name of the operation. + * @param body Access policy to merge into the vault. + * @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 parameters for updating the access policy in a vault. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VaultsUpdateAccessPolicyResponse updateAccessPolicyWithResponse(String resourceGroupName, String vaultName, + AccessPolicyUpdateKind operationKind, VaultAccessPolicyParametersInner body, Context context) { + return updateAccessPolicyWithResponseAsync(resourceGroupName, vaultName, operationKind, body, context).block(); + } + + /** + * Update access policies in a key vault in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param operationKind Name of the operation. + * @param body Access policy to merge into the vault. + * @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 parameters for updating the access policy in a vault. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VaultAccessPolicyParametersInner updateAccessPolicy(String resourceGroupName, String vaultName, + AccessPolicyUpdateKind operationKind, VaultAccessPolicyParametersInner body) { + return updateAccessPolicyWithResponse(resourceGroupName, vaultName, operationKind, body, Context.NONE) + .getValue(); + } + + /** + * 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 the response of a DeletedVault list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listDeletedNextSinglePageAsync(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.listDeletedNext(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 the response of a DeletedVault list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listDeletedNextSinglePageAsync(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.listDeletedNext(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 the response of a Vault list operation 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 the response of a Vault list operation 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)); + } + + /** + * 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 the response of a Vault list operation 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 the response of a Vault list operation 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)); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/VaultsImpl.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/VaultsImpl.java new file mode 100644 index 000000000000..425b9fdd3f72 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/VaultsImpl.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.keyvault.generated.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.keyvault.generated.fluent.VaultsClient; +import com.azure.resourcemanager.keyvault.generated.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.keyvault.generated.fluent.models.DeletedVaultInner; +import com.azure.resourcemanager.keyvault.generated.fluent.models.VaultAccessPolicyParametersInner; +import com.azure.resourcemanager.keyvault.generated.fluent.models.VaultInner; +import com.azure.resourcemanager.keyvault.generated.models.AccessPolicyUpdateKind; +import com.azure.resourcemanager.keyvault.generated.models.CheckNameAvailabilityResult; +import com.azure.resourcemanager.keyvault.generated.models.DeletedVault; +import com.azure.resourcemanager.keyvault.generated.models.Vault; +import com.azure.resourcemanager.keyvault.generated.models.VaultAccessPolicyParameters; +import com.azure.resourcemanager.keyvault.generated.models.VaultCheckNameAvailabilityParameters; +import com.azure.resourcemanager.keyvault.generated.models.Vaults; +import com.azure.resourcemanager.keyvault.generated.models.VaultsUpdateAccessPolicyResponse; + +public final class VaultsImpl implements Vaults { + private static final ClientLogger LOGGER = new ClientLogger(VaultsImpl.class); + + private final VaultsClient innerClient; + + private final com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager; + + public VaultsImpl(VaultsClient innerClient, + com.azure.resourcemanager.keyvault.generated.KeyvaultManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response + checkNameAvailabilityWithResponse(VaultCheckNameAvailabilityParameters body, Context context) { + Response inner + = this.serviceClient().checkNameAvailabilityWithResponse(body, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new CheckNameAvailabilityResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CheckNameAvailabilityResult checkNameAvailability(VaultCheckNameAvailabilityParameters body) { + CheckNameAvailabilityResultInner inner = this.serviceClient().checkNameAvailability(body); + if (inner != null) { + return new CheckNameAvailabilityResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DeletedVaultImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DeletedVaultImpl(inner1, this.manager())); + } + + public Response getDeletedWithResponse(String location, String vaultName, Context context) { + Response inner = this.serviceClient().getDeletedWithResponse(location, vaultName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new DeletedVaultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DeletedVault getDeleted(String location, String vaultName) { + DeletedVaultInner inner = this.serviceClient().getDeleted(location, vaultName); + if (inner != null) { + return new DeletedVaultImpl(inner, this.manager()); + } else { + return null; + } + } + + public void purgeDeleted(String location, String vaultName) { + this.serviceClient().purgeDeleted(location, vaultName); + } + + public void purgeDeleted(String location, String vaultName, Context context) { + this.serviceClient().purgeDeleted(location, vaultName, context); + } + + public PagedIterable listBySubscription() { + PagedIterable inner = this.serviceClient().listBySubscription(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new VaultImpl(inner1, this.manager())); + } + + public PagedIterable listBySubscription(Integer top, Context context) { + PagedIterable inner = this.serviceClient().listBySubscription(top, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new VaultImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new VaultImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Integer top, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, top, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new VaultImpl(inner1, this.manager())); + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, String vaultName, Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, vaultName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new VaultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Vault getByResourceGroup(String resourceGroupName, String vaultName) { + VaultInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, vaultName); + if (inner != null) { + return new VaultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse(String resourceGroupName, String vaultName, + Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, vaultName, context); + } + + public void deleteByResourceGroup(String resourceGroupName, String vaultName) { + this.serviceClient().delete(resourceGroupName, vaultName); + } + + public Response updateAccessPolicyWithResponse(String resourceGroupName, + String vaultName, AccessPolicyUpdateKind operationKind, VaultAccessPolicyParametersInner body, + Context context) { + VaultsUpdateAccessPolicyResponse inner = this.serviceClient() + .updateAccessPolicyWithResponse(resourceGroupName, vaultName, operationKind, body, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new VaultAccessPolicyParametersImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public VaultAccessPolicyParameters updateAccessPolicy(String resourceGroupName, String vaultName, + AccessPolicyUpdateKind operationKind, VaultAccessPolicyParametersInner body) { + VaultAccessPolicyParametersInner inner + = this.serviceClient().updateAccessPolicy(resourceGroupName, vaultName, operationKind, body); + if (inner != null) { + return new VaultAccessPolicyParametersImpl(inner, this.manager()); + } else { + return null; + } + } + + public Vault 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 vaultName = ResourceManagerUtils.getValueFromIdByName(id, "vaults"); + if (vaultName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'vaults'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, vaultName, 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 vaultName = ResourceManagerUtils.getValueFromIdByName(id, "vaults"); + if (vaultName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'vaults'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, vaultName, 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 vaultName = ResourceManagerUtils.getValueFromIdByName(id, "vaults"); + if (vaultName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'vaults'.", id))); + } + this.deleteByResourceGroupWithResponse(resourceGroupName, vaultName, Context.NONE); + } + + public Response 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 vaultName = ResourceManagerUtils.getValueFromIdByName(id, "vaults"); + if (vaultName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'vaults'.", id))); + } + return this.deleteByResourceGroupWithResponse(resourceGroupName, vaultName, context); + } + + private VaultsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager() { + return this.serviceManager; + } + + public VaultImpl define(String name) { + return new VaultImpl(name, this.manager()); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/package-info.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/package-info.java new file mode 100644 index 000000000000..b8d1ead56c2f --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the implementations for AzureStorageResourceManagementApi. + * The Azure management API provides a RESTful set of web services that interact with Azure Key Vault. + */ +package com.azure.resourcemanager.keyvault.generated.implementation; diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/AccessPolicyEntry.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/AccessPolicyEntry.java new file mode 100644 index 000000000000..1851ba231a70 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/AccessPolicyEntry.java @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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.Objects; +import java.util.UUID; + +/** + * An identity that have access to the key vault. All identities in the array must use the same tenant ID as the key + * vault's tenant ID. + */ +@Fluent +public final class AccessPolicyEntry implements JsonSerializable { + /* + * The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault. + */ + private UUID tenantId; + + /* + * The object ID of a user, service principal or security group in the Azure Active Directory tenant for the vault. + * The object ID must be unique for the list of access policies. + */ + private String objectId; + + /* + * Application ID of the client making request on behalf of a principal + */ + private UUID applicationId; + + /* + * Permissions the identity has for keys, secrets and certificates. + */ + private Permissions permissions; + + /** + * Creates an instance of AccessPolicyEntry class. + */ + public AccessPolicyEntry() { + } + + /** + * Get the tenantId property: The Azure Active Directory tenant ID that should be used for authenticating requests + * to the key vault. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: The Azure Active Directory tenant ID that should be used for authenticating requests + * to the key vault. + * + * @param tenantId the tenantId value to set. + * @return the AccessPolicyEntry object itself. + */ + public AccessPolicyEntry withTenantId(UUID tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the objectId property: The object ID of a user, service principal or security group in the Azure Active + * Directory tenant for the vault. The object ID must be unique for the list of access policies. + * + * @return the objectId value. + */ + public String objectId() { + return this.objectId; + } + + /** + * Set the objectId property: The object ID of a user, service principal or security group in the Azure Active + * Directory tenant for the vault. The object ID must be unique for the list of access policies. + * + * @param objectId the objectId value to set. + * @return the AccessPolicyEntry object itself. + */ + public AccessPolicyEntry withObjectId(String objectId) { + this.objectId = objectId; + return this; + } + + /** + * Get the applicationId property: Application ID of the client making request on behalf of a principal. + * + * @return the applicationId value. + */ + public UUID applicationId() { + return this.applicationId; + } + + /** + * Set the applicationId property: Application ID of the client making request on behalf of a principal. + * + * @param applicationId the applicationId value to set. + * @return the AccessPolicyEntry object itself. + */ + public AccessPolicyEntry withApplicationId(UUID applicationId) { + this.applicationId = applicationId; + return this; + } + + /** + * Get the permissions property: Permissions the identity has for keys, secrets and certificates. + * + * @return the permissions value. + */ + public Permissions permissions() { + return this.permissions; + } + + /** + * Set the permissions property: Permissions the identity has for keys, secrets and certificates. + * + * @param permissions the permissions value to set. + * @return the AccessPolicyEntry object itself. + */ + public AccessPolicyEntry withPermissions(Permissions permissions) { + this.permissions = permissions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (tenantId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property tenantId in model AccessPolicyEntry")); + } + if (objectId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property objectId in model AccessPolicyEntry")); + } + if (permissions() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property permissions in model AccessPolicyEntry")); + } else { + permissions().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AccessPolicyEntry.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("tenantId", Objects.toString(this.tenantId, null)); + jsonWriter.writeStringField("objectId", this.objectId); + jsonWriter.writeJsonField("permissions", this.permissions); + jsonWriter.writeStringField("applicationId", Objects.toString(this.applicationId, null)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AccessPolicyEntry from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AccessPolicyEntry 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 AccessPolicyEntry. + */ + public static AccessPolicyEntry fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AccessPolicyEntry deserializedAccessPolicyEntry = new AccessPolicyEntry(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tenantId".equals(fieldName)) { + deserializedAccessPolicyEntry.tenantId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("objectId".equals(fieldName)) { + deserializedAccessPolicyEntry.objectId = reader.getString(); + } else if ("permissions".equals(fieldName)) { + deserializedAccessPolicyEntry.permissions = Permissions.fromJson(reader); + } else if ("applicationId".equals(fieldName)) { + deserializedAccessPolicyEntry.applicationId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedAccessPolicyEntry; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/AccessPolicyUpdateKind.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/AccessPolicyUpdateKind.java new file mode 100644 index 000000000000..720f86d0e270 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/AccessPolicyUpdateKind.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.keyvault.generated.models; + +/** + * Defines values for AccessPolicyUpdateKind. + */ +public enum AccessPolicyUpdateKind { + /** + * Enum value add. + */ + ADD("add"), + + /** + * Enum value replace. + */ + REPLACE("replace"), + + /** + * Enum value remove. + */ + REMOVE("remove"); + + /** + * The actual serialized value for a AccessPolicyUpdateKind instance. + */ + private final String value; + + AccessPolicyUpdateKind(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AccessPolicyUpdateKind instance. + * + * @param value the serialized value to parse. + * @return the parsed AccessPolicyUpdateKind object, or null if unable to parse. + */ + public static AccessPolicyUpdateKind fromString(String value) { + if (value == null) { + return null; + } + AccessPolicyUpdateKind[] items = AccessPolicyUpdateKind.values(); + for (AccessPolicyUpdateKind item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ActionType.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ActionType.java new file mode 100644 index 000000000000..e5809749c070 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/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.keyvault.generated.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/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ActionsRequired.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ActionsRequired.java new file mode 100644 index 000000000000..edb99e846b66 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ActionsRequired.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.keyvault.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * A message indicating if changes on the service provider require any updates on the consumer. + */ +public final class ActionsRequired extends ExpandableStringEnum { + /** + * Static value None for ActionsRequired. + */ + public static final ActionsRequired NONE = fromString("None"); + + /** + * Creates a new instance of ActionsRequired value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActionsRequired() { + } + + /** + * Creates or finds a ActionsRequired from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActionsRequired. + */ + public static ActionsRequired fromString(String name) { + return fromString(name, ActionsRequired.class); + } + + /** + * Gets known ActionsRequired values. + * + * @return known ActionsRequired values. + */ + public static Collection values() { + return values(ActionsRequired.class); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ActivationStatus.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ActivationStatus.java new file mode 100644 index 000000000000..81e180a3c3e7 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ActivationStatus.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.keyvault.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Activation Status. + */ +public final class ActivationStatus extends ExpandableStringEnum { + /** + * Static value Active for ActivationStatus. + */ + public static final ActivationStatus ACTIVE = fromString("Active"); + + /** + * Static value NotActivated for ActivationStatus. + */ + public static final ActivationStatus NOT_ACTIVATED = fromString("NotActivated"); + + /** + * Static value Unknown for ActivationStatus. + */ + public static final ActivationStatus UNKNOWN = fromString("Unknown"); + + /** + * Static value Failed for ActivationStatus. + */ + public static final ActivationStatus FAILED = fromString("Failed"); + + /** + * Creates a new instance of ActivationStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActivationStatus() { + } + + /** + * Creates or finds a ActivationStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActivationStatus. + */ + public static ActivationStatus fromString(String name) { + return fromString(name, ActivationStatus.class); + } + + /** + * Gets known ActivationStatus values. + * + * @return known ActivationStatus values. + */ + public static Collection values() { + return values(ActivationStatus.class); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/Attributes.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/Attributes.java new file mode 100644 index 000000000000..d2365bbe99ec --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/Attributes.java @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; + +/** + * The object attributes managed by the KeyVault service. + */ +@Fluent +public class Attributes implements JsonSerializable { + /* + * Determines whether the object is enabled. + */ + private Boolean enabled; + + /* + * Not before date in seconds since 1970-01-01T00:00:00Z. + */ + private Long nbf; + + /* + * Expiry date in seconds since 1970-01-01T00:00:00Z. + */ + private Long exp; + + /* + * Creation time in seconds since 1970-01-01T00:00:00Z. + */ + private Long created; + + /* + * Last updated time in seconds since 1970-01-01T00:00:00Z. + */ + private Long updated; + + /** + * Creates an instance of Attributes class. + */ + public Attributes() { + } + + /** + * Get the enabled property: Determines whether the object is enabled. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Determines whether the object is enabled. + * + * @param enabled the enabled value to set. + * @return the Attributes object itself. + */ + public Attributes withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the nbf property: Not before date in seconds since 1970-01-01T00:00:00Z. + * + * @return the nbf value. + */ + public OffsetDateTime nbf() { + if (this.nbf == null) { + return null; + } + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.nbf), ZoneOffset.UTC); + } + + /** + * Set the nbf property: Not before date in seconds since 1970-01-01T00:00:00Z. + * + * @param nbf the nbf value to set. + * @return the Attributes object itself. + */ + public Attributes withNbf(OffsetDateTime nbf) { + if (nbf == null) { + this.nbf = null; + } else { + this.nbf = nbf.toEpochSecond(); + } + return this; + } + + /** + * Get the exp property: Expiry date in seconds since 1970-01-01T00:00:00Z. + * + * @return the exp value. + */ + public OffsetDateTime exp() { + if (this.exp == null) { + return null; + } + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.exp), ZoneOffset.UTC); + } + + /** + * Set the exp property: Expiry date in seconds since 1970-01-01T00:00:00Z. + * + * @param exp the exp value to set. + * @return the Attributes object itself. + */ + public Attributes withExp(OffsetDateTime exp) { + if (exp == null) { + this.exp = null; + } else { + this.exp = exp.toEpochSecond(); + } + return this; + } + + /** + * Get the created property: Creation time in seconds since 1970-01-01T00:00:00Z. + * + * @return the created value. + */ + public OffsetDateTime created() { + if (this.created == null) { + return null; + } + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.created), ZoneOffset.UTC); + } + + /** + * Set the created property: Creation time in seconds since 1970-01-01T00:00:00Z. + * + * @param created the created value to set. + * @return the Attributes object itself. + */ + Attributes withCreated(OffsetDateTime created) { + if (created == null) { + this.created = null; + } else { + this.created = created.toEpochSecond(); + } + return this; + } + + /** + * Get the updated property: Last updated time in seconds since 1970-01-01T00:00:00Z. + * + * @return the updated value. + */ + public OffsetDateTime updated() { + if (this.updated == null) { + return null; + } + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.updated), ZoneOffset.UTC); + } + + /** + * Set the updated property: Last updated time in seconds since 1970-01-01T00:00:00Z. + * + * @param updated the updated value to set. + * @return the Attributes object itself. + */ + Attributes withUpdated(OffsetDateTime updated) { + if (updated == null) { + this.updated = null; + } else { + this.updated = updated.toEpochSecond(); + } + 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.writeBooleanField("enabled", this.enabled); + jsonWriter.writeNumberField("nbf", this.nbf); + jsonWriter.writeNumberField("exp", this.exp); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Attributes from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Attributes 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 Attributes. + */ + public static Attributes fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Attributes deserializedAttributes = new Attributes(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedAttributes.enabled = reader.getNullable(JsonReader::getBoolean); + } else if ("nbf".equals(fieldName)) { + deserializedAttributes.nbf = reader.getNullable(JsonReader::getLong); + } else if ("exp".equals(fieldName)) { + deserializedAttributes.exp = reader.getNullable(JsonReader::getLong); + } else if ("created".equals(fieldName)) { + deserializedAttributes.created = reader.getNullable(JsonReader::getLong); + } else if ("updated".equals(fieldName)) { + deserializedAttributes.updated = reader.getNullable(JsonReader::getLong); + } else { + reader.skipChildren(); + } + } + + return deserializedAttributes; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/CertificatePermissions.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/CertificatePermissions.java new file mode 100644 index 000000000000..adfe6c8ffa5f --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/CertificatePermissions.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for CertificatePermissions. + */ +public final class CertificatePermissions extends ExpandableStringEnum { + /** + * Static value all for CertificatePermissions. + */ + public static final CertificatePermissions ALL = fromString("all"); + + /** + * Static value get for CertificatePermissions. + */ + public static final CertificatePermissions GET = fromString("get"); + + /** + * Static value list for CertificatePermissions. + */ + public static final CertificatePermissions LIST = fromString("list"); + + /** + * Static value delete for CertificatePermissions. + */ + public static final CertificatePermissions DELETE = fromString("delete"); + + /** + * Static value create for CertificatePermissions. + */ + public static final CertificatePermissions CREATE = fromString("create"); + + /** + * Static value import for CertificatePermissions. + */ + public static final CertificatePermissions IMPORT = fromString("import"); + + /** + * Static value update for CertificatePermissions. + */ + public static final CertificatePermissions UPDATE = fromString("update"); + + /** + * Static value managecontacts for CertificatePermissions. + */ + public static final CertificatePermissions MANAGECONTACTS = fromString("managecontacts"); + + /** + * Static value getissuers for CertificatePermissions. + */ + public static final CertificatePermissions GETISSUERS = fromString("getissuers"); + + /** + * Static value listissuers for CertificatePermissions. + */ + public static final CertificatePermissions LISTISSUERS = fromString("listissuers"); + + /** + * Static value setissuers for CertificatePermissions. + */ + public static final CertificatePermissions SETISSUERS = fromString("setissuers"); + + /** + * Static value deleteissuers for CertificatePermissions. + */ + public static final CertificatePermissions DELETEISSUERS = fromString("deleteissuers"); + + /** + * Static value manageissuers for CertificatePermissions. + */ + public static final CertificatePermissions MANAGEISSUERS = fromString("manageissuers"); + + /** + * Static value recover for CertificatePermissions. + */ + public static final CertificatePermissions RECOVER = fromString("recover"); + + /** + * Static value purge for CertificatePermissions. + */ + public static final CertificatePermissions PURGE = fromString("purge"); + + /** + * Static value backup for CertificatePermissions. + */ + public static final CertificatePermissions BACKUP = fromString("backup"); + + /** + * Static value restore for CertificatePermissions. + */ + public static final CertificatePermissions RESTORE = fromString("restore"); + + /** + * Creates a new instance of CertificatePermissions value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public CertificatePermissions() { + } + + /** + * Creates or finds a CertificatePermissions from its string representation. + * + * @param name a name to look for. + * @return the corresponding CertificatePermissions. + */ + public static CertificatePermissions fromString(String name) { + return fromString(name, CertificatePermissions.class); + } + + /** + * Gets known CertificatePermissions values. + * + * @return known CertificatePermissions values. + */ + public static Collection values() { + return values(CertificatePermissions.class); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/CheckMhsmNameAvailabilityParameters.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/CheckMhsmNameAvailabilityParameters.java new file mode 100644 index 000000000000..bf7cea0e7394 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/CheckMhsmNameAvailabilityParameters.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.keyvault.generated.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; + +/** + * The parameters used to check the availability of the managed hsm name. + */ +@Fluent +public final class CheckMhsmNameAvailabilityParameters + implements JsonSerializable { + /* + * The managed hsm name. + */ + private String name; + + /** + * Creates an instance of CheckMhsmNameAvailabilityParameters class. + */ + public CheckMhsmNameAvailabilityParameters() { + } + + /** + * Get the name property: The managed hsm name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The managed hsm name. + * + * @param name the name value to set. + * @return the CheckMhsmNameAvailabilityParameters object itself. + */ + public CheckMhsmNameAvailabilityParameters withName(String name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property name in model CheckMhsmNameAvailabilityParameters")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CheckMhsmNameAvailabilityParameters.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CheckMhsmNameAvailabilityParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CheckMhsmNameAvailabilityParameters 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 CheckMhsmNameAvailabilityParameters. + */ + public static CheckMhsmNameAvailabilityParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CheckMhsmNameAvailabilityParameters deserializedCheckMhsmNameAvailabilityParameters + = new CheckMhsmNameAvailabilityParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedCheckMhsmNameAvailabilityParameters.name = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCheckMhsmNameAvailabilityParameters; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/CheckMhsmNameAvailabilityResult.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/CheckMhsmNameAvailabilityResult.java new file mode 100644 index 000000000000..b8cf64c9d8d5 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/CheckMhsmNameAvailabilityResult.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.keyvault.generated.models; + +import com.azure.resourcemanager.keyvault.generated.fluent.models.CheckMhsmNameAvailabilityResultInner; + +/** + * An immutable client-side representation of CheckMhsmNameAvailabilityResult. + */ +public interface CheckMhsmNameAvailabilityResult { + /** + * Gets the nameAvailable property: A boolean value that indicates whether the name is available for you to use. If + * true, the name is available. If false, the name has already been taken or is invalid and cannot be used. + * + * @return the nameAvailable value. + */ + Boolean nameAvailable(); + + /** + * Gets the reason property: The reason that a managed hsm name could not be used. The reason element is only + * returned if NameAvailable is false. + * + * @return the reason value. + */ + Reason reason(); + + /** + * Gets the message property: An error message explaining the Reason value in more detail. + * + * @return the message value. + */ + String message(); + + /** + * Gets the inner com.azure.resourcemanager.keyvault.generated.fluent.models.CheckMhsmNameAvailabilityResultInner + * object. + * + * @return the inner object. + */ + CheckMhsmNameAvailabilityResultInner innerModel(); +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/CheckNameAvailabilityResult.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/CheckNameAvailabilityResult.java new file mode 100644 index 000000000000..763844010f06 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/CheckNameAvailabilityResult.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.keyvault.generated.models; + +import com.azure.resourcemanager.keyvault.generated.fluent.models.CheckNameAvailabilityResultInner; + +/** + * An immutable client-side representation of CheckNameAvailabilityResult. + */ +public interface CheckNameAvailabilityResult { + /** + * Gets the nameAvailable property: A boolean value that indicates whether the name is available for you to use. If + * true, the name is available. If false, the name has already been taken or is invalid and cannot be used. + * + * @return the nameAvailable value. + */ + Boolean nameAvailable(); + + /** + * Gets the reason property: The reason that a vault name could not be used. The Reason element is only returned if + * NameAvailable is false. + * + * @return the reason value. + */ + KeyVaultNameUnavailableReason reason(); + + /** + * Gets the message property: An error message explaining the Reason value in more detail. + * + * @return the message value. + */ + String message(); + + /** + * Gets the inner com.azure.resourcemanager.keyvault.generated.fluent.models.CheckNameAvailabilityResultInner + * object. + * + * @return the inner object. + */ + CheckNameAvailabilityResultInner innerModel(); +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/CreateMode.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/CreateMode.java new file mode 100644 index 000000000000..90f843666b8e --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/CreateMode.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.keyvault.generated.models; + +/** + * The create mode to indicate whether the resource is being created or is being recovered from a deleted resource. + */ +public enum CreateMode { + /** + * Enum value recover. + */ + RECOVER("recover"), + + /** + * Enum value default. + */ + DEFAULT("default"); + + /** + * The actual serialized value for a CreateMode instance. + */ + private final String value; + + CreateMode(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a CreateMode instance. + * + * @param value the serialized value to parse. + * @return the parsed CreateMode object, or null if unable to parse. + */ + public static CreateMode fromString(String value) { + if (value == null) { + return null; + } + CreateMode[] items = CreateMode.values(); + for (CreateMode item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/DeletedManagedHsm.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/DeletedManagedHsm.java new file mode 100644 index 000000000000..2b3594030d3e --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/DeletedManagedHsm.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.keyvault.generated.fluent.models.DeletedManagedHsmInner; +import java.time.OffsetDateTime; +import java.util.Map; + +/** + * An immutable client-side representation of DeletedManagedHsm. + */ +public interface DeletedManagedHsm { + /** + * 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 systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the mhsmId property: The resource id of the original managed HSM. + * + * @return the mhsmId value. + */ + String mhsmId(); + + /** + * Gets the location property: The location of the original managed HSM. + * + * @return the location value. + */ + String location(); + + /** + * Gets the deletionDate property: The deleted date. + * + * @return the deletionDate value. + */ + OffsetDateTime deletionDate(); + + /** + * Gets the scheduledPurgeDate property: The scheduled purged date. + * + * @return the scheduledPurgeDate value. + */ + OffsetDateTime scheduledPurgeDate(); + + /** + * Gets the purgeProtectionEnabled property: Purge protection status of the original managed HSM. + * + * @return the purgeProtectionEnabled value. + */ + Boolean purgeProtectionEnabled(); + + /** + * Gets the tags property: Tags of the original managed HSM. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the inner com.azure.resourcemanager.keyvault.generated.fluent.models.DeletedManagedHsmInner object. + * + * @return the inner object. + */ + DeletedManagedHsmInner innerModel(); +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/DeletedManagedHsmListResult.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/DeletedManagedHsmListResult.java new file mode 100644 index 000000000000..e8d2e704fe1d --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/DeletedManagedHsmListResult.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.keyvault.generated.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 com.azure.resourcemanager.keyvault.generated.fluent.models.DeletedManagedHsmInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a DeletedManagedHsm list operation. + */ +@Fluent +public final class DeletedManagedHsmListResult implements JsonSerializable { + /* + * The DeletedManagedHsm items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of DeletedManagedHsmListResult class. + */ + public DeletedManagedHsmListResult() { + } + + /** + * Get the value property: The DeletedManagedHsm items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The DeletedManagedHsm items on this page. + * + * @param value the value value to set. + * @return the DeletedManagedHsmListResult object itself. + */ + public DeletedManagedHsmListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the DeletedManagedHsmListResult object itself. + */ + public DeletedManagedHsmListResult 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) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model DeletedManagedHsmListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DeletedManagedHsmListResult.class); + + /** + * {@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 DeletedManagedHsmListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DeletedManagedHsmListResult 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 DeletedManagedHsmListResult. + */ + public static DeletedManagedHsmListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DeletedManagedHsmListResult deserializedDeletedManagedHsmListResult = new DeletedManagedHsmListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> DeletedManagedHsmInner.fromJson(reader1)); + deserializedDeletedManagedHsmListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedDeletedManagedHsmListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDeletedManagedHsmListResult; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/DeletedVault.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/DeletedVault.java new file mode 100644 index 000000000000..022b06f6dd55 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/DeletedVault.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.keyvault.generated.fluent.models.DeletedVaultInner; +import java.time.OffsetDateTime; +import java.util.Map; + +/** + * An immutable client-side representation of DeletedVault. + */ +public interface DeletedVault { + /** + * 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 systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the vaultId property: The resource id of the original vault. + * + * @return the vaultId value. + */ + String vaultId(); + + /** + * Gets the location property: The location of the original vault. + * + * @return the location value. + */ + String location(); + + /** + * Gets the deletionDate property: The deleted date. + * + * @return the deletionDate value. + */ + OffsetDateTime deletionDate(); + + /** + * Gets the scheduledPurgeDate property: The scheduled purged date. + * + * @return the scheduledPurgeDate value. + */ + OffsetDateTime scheduledPurgeDate(); + + /** + * Gets the tags property: Tags of the original vault. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the purgeProtectionEnabled property: Purge protection status of the original vault. + * + * @return the purgeProtectionEnabled value. + */ + Boolean purgeProtectionEnabled(); + + /** + * Gets the inner com.azure.resourcemanager.keyvault.generated.fluent.models.DeletedVaultInner object. + * + * @return the inner object. + */ + DeletedVaultInner innerModel(); +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/DeletedVaultListResult.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/DeletedVaultListResult.java new file mode 100644 index 000000000000..038a222b3feb --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/DeletedVaultListResult.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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 com.azure.resourcemanager.keyvault.generated.fluent.models.DeletedVaultInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a DeletedVault list operation. + */ +@Fluent +public final class DeletedVaultListResult implements JsonSerializable { + /* + * The DeletedVault items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of DeletedVaultListResult class. + */ + public DeletedVaultListResult() { + } + + /** + * Get the value property: The DeletedVault items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The DeletedVault items on this page. + * + * @param value the value value to set. + * @return the DeletedVaultListResult object itself. + */ + public DeletedVaultListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the DeletedVaultListResult object itself. + */ + public DeletedVaultListResult 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) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model DeletedVaultListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DeletedVaultListResult.class); + + /** + * {@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 DeletedVaultListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DeletedVaultListResult 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 DeletedVaultListResult. + */ + public static DeletedVaultListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DeletedVaultListResult deserializedDeletedVaultListResult = new DeletedVaultListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> DeletedVaultInner.fromJson(reader1)); + deserializedDeletedVaultListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedDeletedVaultListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDeletedVaultListResult; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/GeoReplicationRegionProvisioningState.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/GeoReplicationRegionProvisioningState.java new file mode 100644 index 000000000000..608f3594d0f5 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/GeoReplicationRegionProvisioningState.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The current provisioning state. + */ +public final class GeoReplicationRegionProvisioningState + extends ExpandableStringEnum { + /** + * Static value Preprovisioning for GeoReplicationRegionProvisioningState. + */ + public static final GeoReplicationRegionProvisioningState PREPROVISIONING = fromString("Preprovisioning"); + + /** + * Static value Provisioning for GeoReplicationRegionProvisioningState. + */ + public static final GeoReplicationRegionProvisioningState PROVISIONING = fromString("Provisioning"); + + /** + * Static value Succeeded for GeoReplicationRegionProvisioningState. + */ + public static final GeoReplicationRegionProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Static value Failed for GeoReplicationRegionProvisioningState. + */ + public static final GeoReplicationRegionProvisioningState FAILED = fromString("Failed"); + + /** + * Static value Deleting for GeoReplicationRegionProvisioningState. + */ + public static final GeoReplicationRegionProvisioningState DELETING = fromString("Deleting"); + + /** + * Static value Cleanup for GeoReplicationRegionProvisioningState. + */ + public static final GeoReplicationRegionProvisioningState CLEANUP = fromString("Cleanup"); + + /** + * Creates a new instance of GeoReplicationRegionProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public GeoReplicationRegionProvisioningState() { + } + + /** + * Creates or finds a GeoReplicationRegionProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding GeoReplicationRegionProvisioningState. + */ + public static GeoReplicationRegionProvisioningState fromString(String name) { + return fromString(name, GeoReplicationRegionProvisioningState.class); + } + + /** + * Gets known GeoReplicationRegionProvisioningState values. + * + * @return known GeoReplicationRegionProvisioningState values. + */ + public static Collection values() { + return values(GeoReplicationRegionProvisioningState.class); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/IpRule.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/IpRule.java new file mode 100644 index 000000000000..38f1ac231a3f --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/IpRule.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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; + +/** + * A rule governing the accessibility of a vault from a specific ip address or ip range. + */ +@Fluent +public final class IpRule implements JsonSerializable { + /* + * An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all + * addresses that start with 124.56.78). + */ + private String value; + + /** + * Creates an instance of IpRule class. + */ + public IpRule() { + } + + /** + * Get the value property: An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or + * '124.56.78.0/24' (all addresses that start with 124.56.78). + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or + * '124.56.78.0/24' (all addresses that start with 124.56.78). + * + * @param value the value value to set. + * @return the IpRule object itself. + */ + public IpRule withValue(String value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Missing required property value in model IpRule")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(IpRule.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("value", this.value); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IpRule from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IpRule 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 IpRule. + */ + public static IpRule fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IpRule deserializedIpRule = new IpRule(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + deserializedIpRule.value = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedIpRule; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/KeyPermissions.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/KeyPermissions.java new file mode 100644 index 000000000000..4eb5114fae84 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/KeyPermissions.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for KeyPermissions. + */ +public final class KeyPermissions extends ExpandableStringEnum { + /** + * Static value all for KeyPermissions. + */ + public static final KeyPermissions ALL = fromString("all"); + + /** + * Static value encrypt for KeyPermissions. + */ + public static final KeyPermissions ENCRYPT = fromString("encrypt"); + + /** + * Static value decrypt for KeyPermissions. + */ + public static final KeyPermissions DECRYPT = fromString("decrypt"); + + /** + * Static value wrapKey for KeyPermissions. + */ + public static final KeyPermissions WRAP_KEY = fromString("wrapKey"); + + /** + * Static value unwrapKey for KeyPermissions. + */ + public static final KeyPermissions UNWRAP_KEY = fromString("unwrapKey"); + + /** + * Static value sign for KeyPermissions. + */ + public static final KeyPermissions SIGN = fromString("sign"); + + /** + * Static value verify for KeyPermissions. + */ + public static final KeyPermissions VERIFY = fromString("verify"); + + /** + * Static value get for KeyPermissions. + */ + public static final KeyPermissions GET = fromString("get"); + + /** + * Static value list for KeyPermissions. + */ + public static final KeyPermissions LIST = fromString("list"); + + /** + * Static value create for KeyPermissions. + */ + public static final KeyPermissions CREATE = fromString("create"); + + /** + * Static value update for KeyPermissions. + */ + public static final KeyPermissions UPDATE = fromString("update"); + + /** + * Static value import for KeyPermissions. + */ + public static final KeyPermissions IMPORT = fromString("import"); + + /** + * Static value delete for KeyPermissions. + */ + public static final KeyPermissions DELETE = fromString("delete"); + + /** + * Static value backup for KeyPermissions. + */ + public static final KeyPermissions BACKUP = fromString("backup"); + + /** + * Static value restore for KeyPermissions. + */ + public static final KeyPermissions RESTORE = fromString("restore"); + + /** + * Static value recover for KeyPermissions. + */ + public static final KeyPermissions RECOVER = fromString("recover"); + + /** + * Static value purge for KeyPermissions. + */ + public static final KeyPermissions PURGE = fromString("purge"); + + /** + * Static value release for KeyPermissions. + */ + public static final KeyPermissions RELEASE = fromString("release"); + + /** + * Static value rotate for KeyPermissions. + */ + public static final KeyPermissions ROTATE = fromString("rotate"); + + /** + * Static value getrotationpolicy for KeyPermissions. + */ + public static final KeyPermissions GETROTATIONPOLICY = fromString("getrotationpolicy"); + + /** + * Static value setrotationpolicy for KeyPermissions. + */ + public static final KeyPermissions SETROTATIONPOLICY = fromString("setrotationpolicy"); + + /** + * Creates a new instance of KeyPermissions value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public KeyPermissions() { + } + + /** + * Creates or finds a KeyPermissions from its string representation. + * + * @param name a name to look for. + * @return the corresponding KeyPermissions. + */ + public static KeyPermissions fromString(String name) { + return fromString(name, KeyPermissions.class); + } + + /** + * Gets known KeyPermissions values. + * + * @return known KeyPermissions values. + */ + public static Collection values() { + return values(KeyPermissions.class); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/KeyRotationPolicyActionType.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/KeyRotationPolicyActionType.java new file mode 100644 index 000000000000..2f0a4cb9063f --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/KeyRotationPolicyActionType.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.keyvault.generated.models; + +/** + * The type of action. + */ +public enum KeyRotationPolicyActionType { + /** + * Enum value rotate. + */ + ROTATE("rotate"), + + /** + * Enum value notify. + */ + NOTIFY("notify"); + + /** + * The actual serialized value for a KeyRotationPolicyActionType instance. + */ + private final String value; + + KeyRotationPolicyActionType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a KeyRotationPolicyActionType instance. + * + * @param value the serialized value to parse. + * @return the parsed KeyRotationPolicyActionType object, or null if unable to parse. + */ + public static KeyRotationPolicyActionType fromString(String value) { + if (value == null) { + return null; + } + KeyRotationPolicyActionType[] items = KeyRotationPolicyActionType.values(); + for (KeyRotationPolicyActionType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/KeyVaultActionsRequiredMessage.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/KeyVaultActionsRequiredMessage.java new file mode 100644 index 000000000000..b5c6feec4e47 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/KeyVaultActionsRequiredMessage.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.keyvault.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * A message indicating if changes on the service provider require any updates on the consumer. + */ +public final class KeyVaultActionsRequiredMessage extends ExpandableStringEnum { + /** + * Static value None for KeyVaultActionsRequiredMessage. + */ + public static final KeyVaultActionsRequiredMessage NONE = fromString("None"); + + /** + * Creates a new instance of KeyVaultActionsRequiredMessage value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public KeyVaultActionsRequiredMessage() { + } + + /** + * Creates or finds a KeyVaultActionsRequiredMessage from its string representation. + * + * @param name a name to look for. + * @return the corresponding KeyVaultActionsRequiredMessage. + */ + public static KeyVaultActionsRequiredMessage fromString(String name) { + return fromString(name, KeyVaultActionsRequiredMessage.class); + } + + /** + * Gets known KeyVaultActionsRequiredMessage values. + * + * @return known KeyVaultActionsRequiredMessage values. + */ + public static Collection values() { + return values(KeyVaultActionsRequiredMessage.class); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/KeyVaultCreateMode.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/KeyVaultCreateMode.java new file mode 100644 index 000000000000..e60c36fdf696 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/KeyVaultCreateMode.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.keyvault.generated.models; + +/** + * The vault's create mode to indicate whether the vault need to be recovered or not. + */ +public enum KeyVaultCreateMode { + /** + * Enum value recover. + */ + RECOVER("recover"), + + /** + * Enum value default. + */ + DEFAULT("default"); + + /** + * The actual serialized value for a KeyVaultCreateMode instance. + */ + private final String value; + + KeyVaultCreateMode(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a KeyVaultCreateMode instance. + * + * @param value the serialized value to parse. + * @return the parsed KeyVaultCreateMode object, or null if unable to parse. + */ + public static KeyVaultCreateMode fromString(String value) { + if (value == null) { + return null; + } + KeyVaultCreateMode[] items = KeyVaultCreateMode.values(); + for (KeyVaultCreateMode item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/KeyVaultNameUnavailableReason.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/KeyVaultNameUnavailableReason.java new file mode 100644 index 000000000000..b85b6cf8edcc --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/KeyVaultNameUnavailableReason.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.keyvault.generated.models; + +/** + * The reason that a vault name could not be used. The Reason element is only returned if NameAvailable is false. + */ +public enum KeyVaultNameUnavailableReason { + /** + * Enum value AccountNameInvalid. + */ + ACCOUNT_NAME_INVALID("AccountNameInvalid"), + + /** + * Enum value AlreadyExists. + */ + ALREADY_EXISTS("AlreadyExists"); + + /** + * The actual serialized value for a KeyVaultNameUnavailableReason instance. + */ + private final String value; + + KeyVaultNameUnavailableReason(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a KeyVaultNameUnavailableReason instance. + * + * @param value the serialized value to parse. + * @return the parsed KeyVaultNameUnavailableReason object, or null if unable to parse. + */ + public static KeyVaultNameUnavailableReason fromString(String value) { + if (value == null) { + return null; + } + KeyVaultNameUnavailableReason[] items = KeyVaultNameUnavailableReason.values(); + for (KeyVaultNameUnavailableReason item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/KeyVaultNetworkRuleAction.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/KeyVaultNetworkRuleAction.java new file mode 100644 index 000000000000..bc97ad9bf21b --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/KeyVaultNetworkRuleAction.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass + * property has been evaluated. + */ +public final class KeyVaultNetworkRuleAction extends ExpandableStringEnum { + /** + * Static value Allow for KeyVaultNetworkRuleAction. + */ + public static final KeyVaultNetworkRuleAction ALLOW = fromString("Allow"); + + /** + * Static value Deny for KeyVaultNetworkRuleAction. + */ + public static final KeyVaultNetworkRuleAction DENY = fromString("Deny"); + + /** + * Creates a new instance of KeyVaultNetworkRuleAction value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public KeyVaultNetworkRuleAction() { + } + + /** + * Creates or finds a KeyVaultNetworkRuleAction from its string representation. + * + * @param name a name to look for. + * @return the corresponding KeyVaultNetworkRuleAction. + */ + public static KeyVaultNetworkRuleAction fromString(String name) { + return fromString(name, KeyVaultNetworkRuleAction.class); + } + + /** + * Gets known KeyVaultNetworkRuleAction values. + * + * @return known KeyVaultNetworkRuleAction values. + */ + public static Collection values() { + return values(KeyVaultNetworkRuleAction.class); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/KeyVaultNetworkRuleBypassOption.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/KeyVaultNetworkRuleBypassOption.java new file mode 100644 index 000000000000..44cb5a1b3cd2 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/KeyVaultNetworkRuleBypassOption.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is + * 'AzureServices'. + */ +public final class KeyVaultNetworkRuleBypassOption extends ExpandableStringEnum { + /** + * Static value AzureServices for KeyVaultNetworkRuleBypassOption. + */ + public static final KeyVaultNetworkRuleBypassOption AZURE_SERVICES = fromString("AzureServices"); + + /** + * Static value None for KeyVaultNetworkRuleBypassOption. + */ + public static final KeyVaultNetworkRuleBypassOption NONE = fromString("None"); + + /** + * Creates a new instance of KeyVaultNetworkRuleBypassOption value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public KeyVaultNetworkRuleBypassOption() { + } + + /** + * Creates or finds a KeyVaultNetworkRuleBypassOption from its string representation. + * + * @param name a name to look for. + * @return the corresponding KeyVaultNetworkRuleBypassOption. + */ + public static KeyVaultNetworkRuleBypassOption fromString(String name) { + return fromString(name, KeyVaultNetworkRuleBypassOption.class); + } + + /** + * Gets known KeyVaultNetworkRuleBypassOption values. + * + * @return known KeyVaultNetworkRuleBypassOption values. + */ + public static Collection values() { + return values(KeyVaultNetworkRuleBypassOption.class); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/KeyVaultPatchMode.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/KeyVaultPatchMode.java new file mode 100644 index 000000000000..b2e6071d4a29 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/KeyVaultPatchMode.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.keyvault.generated.models; + +/** + * The vault's create mode to indicate whether the vault need to be recovered or not. + */ +public enum KeyVaultPatchMode { + /** + * Enum value recover. + */ + RECOVER("recover"), + + /** + * Enum value default. + */ + DEFAULT("default"); + + /** + * The actual serialized value for a KeyVaultPatchMode instance. + */ + private final String value; + + KeyVaultPatchMode(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a KeyVaultPatchMode instance. + * + * @param value the serialized value to parse. + * @return the parsed KeyVaultPatchMode object, or null if unable to parse. + */ + public static KeyVaultPatchMode fromString(String value) { + if (value == null) { + return null; + } + KeyVaultPatchMode[] items = KeyVaultPatchMode.values(); + for (KeyVaultPatchMode item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/KeyVaultProvisioningState.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/KeyVaultProvisioningState.java new file mode 100644 index 000000000000..42bc8423d54a --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/KeyVaultProvisioningState.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Provisioning state of the vault. + */ +public final class KeyVaultProvisioningState extends ExpandableStringEnum { + /** + * Static value Succeeded for KeyVaultProvisioningState. + */ + public static final KeyVaultProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Static value RegisteringDns for KeyVaultProvisioningState. + */ + public static final KeyVaultProvisioningState REGISTERING_DNS = fromString("RegisteringDns"); + + /** + * Creates a new instance of KeyVaultProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public KeyVaultProvisioningState() { + } + + /** + * Creates or finds a KeyVaultProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding KeyVaultProvisioningState. + */ + public static KeyVaultProvisioningState fromString(String name) { + return fromString(name, KeyVaultProvisioningState.class); + } + + /** + * Gets known KeyVaultProvisioningState values. + * + * @return known KeyVaultProvisioningState values. + */ + public static Collection values() { + return values(KeyVaultProvisioningState.class); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ManagedHsm.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ManagedHsm.java new file mode 100644 index 000000000000..9f33734a0ab8 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ManagedHsm.java @@ -0,0 +1,630 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.keyvault.generated.fluent.models.ManagedHsmInner; +import com.azure.resourcemanager.keyvault.generated.fluent.models.MhsmGeoReplicatedRegionInner; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +/** + * An immutable client-side representation of ManagedHsm. + */ +public interface ManagedHsm { + /** + * 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 systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the tenantId property: The Azure Active Directory tenant ID that should be used for authenticating requests + * to the managed HSM pool. + * + * @return the tenantId value. + */ + UUID tenantId(); + + /** + * Gets the initialAdminObjectIds property: Array of initial administrators object ids for this managed hsm pool. + * + * @return the initialAdminObjectIds value. + */ + List initialAdminObjectIds(); + + /** + * Gets the hsmUri property: The URI of the managed hsm pool for performing operations on keys. + * + * @return the hsmUri value. + */ + String hsmUri(); + + /** + * Gets the enableSoftDelete property: Property to specify whether the 'soft delete' functionality is enabled for + * this managed HSM pool. Soft delete is enabled by default for all managed HSMs and is immutable. + * + * @return the enableSoftDelete value. + */ + Boolean enableSoftDelete(); + + /** + * Gets the softDeleteRetentionInDays property: Soft deleted data retention days. When you delete an HSM or a key, + * it will remain recoverable for the configured retention period or for a default period of 90 days. It accepts + * values between 7 and 90. + * + * @return the softDeleteRetentionInDays value. + */ + Integer softDeleteRetentionInDays(); + + /** + * Gets the enablePurgeProtection property: Property specifying whether protection against purge is enabled for this + * managed HSM pool. Setting this property to true activates protection against purge for this managed HSM pool and + * its content - only the Managed HSM service may initiate a hard, irrecoverable deletion. Enabling this + * functionality is irreversible. + * + * @return the enablePurgeProtection value. + */ + Boolean enablePurgeProtection(); + + /** + * Gets the createMode property: The create mode to indicate whether the resource is being created or is being + * recovered from a deleted resource. + * + * @return the createMode value. + */ + CreateMode createMode(); + + /** + * Gets the statusMessage property: Resource Status Message. + * + * @return the statusMessage value. + */ + String statusMessage(); + + /** + * Gets the provisioningState property: Provisioning state. + * + * @return the provisioningState value. + */ + ManagedHsmProvisioningState provisioningState(); + + /** + * Gets the networkAcls property: Rules governing the accessibility of the key vault from specific network + * locations. + * + * @return the networkAcls value. + */ + MhsmNetworkRuleSet networkAcls(); + + /** + * Gets the regions property: List of all regions associated with the managed hsm pool. + * + * @return the regions value. + */ + List regions(); + + /** + * Gets the privateEndpointConnections property: List of private endpoint connections associated with the managed + * hsm pool. + * + * @return the privateEndpointConnections value. + */ + List privateEndpointConnections(); + + /** + * Gets the publicNetworkAccess property: Control permission to the managed HSM from public networks. + * + * @return the publicNetworkAccess value. + */ + PublicNetworkAccess publicNetworkAccess(); + + /** + * Gets the scheduledPurgeDate property: The scheduled purge date in UTC. + * + * @return the scheduledPurgeDate value. + */ + OffsetDateTime scheduledPurgeDate(); + + /** + * Gets the securityDomainProperties property: Managed HSM security domain properties. + * + * @return the securityDomainProperties value. + */ + ManagedHsmSecurityDomainProperties securityDomainProperties(); + + /** + * 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.keyvault.generated.fluent.models.ManagedHsmInner object. + * + * @return the inner object. + */ + ManagedHsmInner innerModel(); + + /** + * The entirety of the ManagedHsm definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The ManagedHsm definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the ManagedHsm definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the ManagedHsm 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 ManagedHsm 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 ManagedHsm 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.WithTenantId, + DefinitionStages.WithInitialAdminObjectIds, DefinitionStages.WithEnableSoftDelete, + DefinitionStages.WithSoftDeleteRetentionInDays, DefinitionStages.WithEnablePurgeProtection, + DefinitionStages.WithCreateMode, DefinitionStages.WithNetworkAcls, DefinitionStages.WithRegions, + DefinitionStages.WithPublicNetworkAccess { + /** + * Executes the create request. + * + * @return the created resource. + */ + ManagedHsm create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ManagedHsm create(Context context); + } + + /** + * The stage of the ManagedHsm 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 ManagedHsm definition allowing to specify tenantId. + */ + interface WithTenantId { + /** + * Specifies the tenantId property: The Azure Active Directory tenant ID that should be used for + * authenticating requests to the managed HSM pool.. + * + * @param tenantId The Azure Active Directory tenant ID that should be used for authenticating requests to + * the managed HSM pool. + * @return the next definition stage. + */ + WithCreate withTenantId(UUID tenantId); + } + + /** + * The stage of the ManagedHsm definition allowing to specify initialAdminObjectIds. + */ + interface WithInitialAdminObjectIds { + /** + * Specifies the initialAdminObjectIds property: Array of initial administrators object ids for this managed + * hsm pool.. + * + * @param initialAdminObjectIds Array of initial administrators object ids for this managed hsm pool. + * @return the next definition stage. + */ + WithCreate withInitialAdminObjectIds(List initialAdminObjectIds); + } + + /** + * The stage of the ManagedHsm definition allowing to specify enableSoftDelete. + */ + interface WithEnableSoftDelete { + /** + * Specifies the enableSoftDelete property: Property to specify whether the 'soft delete' functionality is + * enabled for this managed HSM pool. Soft delete is enabled by default for all managed HSMs and is + * immutable.. + * + * @param enableSoftDelete Property to specify whether the 'soft delete' functionality is enabled for this + * managed HSM pool. Soft delete is enabled by default for all managed HSMs and is immutable. + * @return the next definition stage. + */ + WithCreate withEnableSoftDelete(Boolean enableSoftDelete); + } + + /** + * The stage of the ManagedHsm definition allowing to specify softDeleteRetentionInDays. + */ + interface WithSoftDeleteRetentionInDays { + /** + * Specifies the softDeleteRetentionInDays property: Soft deleted data retention days. When you delete an + * HSM or a key, it will remain recoverable for the configured retention period or for a default period of + * 90 days. It accepts values between 7 and 90.. + * + * @param softDeleteRetentionInDays Soft deleted data retention days. When you delete an HSM or a key, it + * will remain recoverable for the configured retention period or for a default period of 90 days. It + * accepts values between 7 and 90. + * @return the next definition stage. + */ + WithCreate withSoftDeleteRetentionInDays(Integer softDeleteRetentionInDays); + } + + /** + * The stage of the ManagedHsm definition allowing to specify enablePurgeProtection. + */ + interface WithEnablePurgeProtection { + /** + * Specifies the enablePurgeProtection property: Property specifying whether protection against purge is + * enabled for this managed HSM pool. Setting this property to true activates protection against purge for + * this managed HSM pool and its content - only the Managed HSM service may initiate a hard, irrecoverable + * deletion. Enabling this functionality is irreversible.. + * + * @param enablePurgeProtection Property specifying whether protection against purge is enabled for this + * managed HSM pool. Setting this property to true activates protection against purge for this managed HSM + * pool and its content - only the Managed HSM service may initiate a hard, irrecoverable deletion. Enabling + * this functionality is irreversible. + * @return the next definition stage. + */ + WithCreate withEnablePurgeProtection(Boolean enablePurgeProtection); + } + + /** + * The stage of the ManagedHsm definition allowing to specify createMode. + */ + interface WithCreateMode { + /** + * Specifies the createMode property: The create mode to indicate whether the resource is being created or + * is being recovered from a deleted resource.. + * + * @param createMode The create mode to indicate whether the resource is being created or is being recovered + * from a deleted resource. + * @return the next definition stage. + */ + WithCreate withCreateMode(CreateMode createMode); + } + + /** + * The stage of the ManagedHsm definition allowing to specify networkAcls. + */ + interface WithNetworkAcls { + /** + * Specifies the networkAcls property: Rules governing the accessibility of the key vault from specific + * network locations.. + * + * @param networkAcls Rules governing the accessibility of the key vault from specific network locations. + * @return the next definition stage. + */ + WithCreate withNetworkAcls(MhsmNetworkRuleSet networkAcls); + } + + /** + * The stage of the ManagedHsm definition allowing to specify regions. + */ + interface WithRegions { + /** + * Specifies the regions property: List of all regions associated with the managed hsm pool.. + * + * @param regions List of all regions associated with the managed hsm pool. + * @return the next definition stage. + */ + WithCreate withRegions(List regions); + } + + /** + * The stage of the ManagedHsm definition allowing to specify publicNetworkAccess. + */ + interface WithPublicNetworkAccess { + /** + * Specifies the publicNetworkAccess property: Control permission to the managed HSM from public networks.. + * + * @param publicNetworkAccess Control permission to the managed HSM from public networks. + * @return the next definition stage. + */ + WithCreate withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess); + } + } + + /** + * Begins update for the ManagedHsm resource. + * + * @return the stage of resource update. + */ + ManagedHsm.Update update(); + + /** + * The template for ManagedHsm update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithTenantId, UpdateStages.WithInitialAdminObjectIds, + UpdateStages.WithEnableSoftDelete, UpdateStages.WithSoftDeleteRetentionInDays, + UpdateStages.WithEnablePurgeProtection, UpdateStages.WithCreateMode, UpdateStages.WithNetworkAcls, + UpdateStages.WithRegions, UpdateStages.WithPublicNetworkAccess { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ManagedHsm apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ManagedHsm apply(Context context); + } + + /** + * The ManagedHsm update stages. + */ + interface UpdateStages { + /** + * The stage of the ManagedHsm update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the ManagedHsm update allowing to specify tenantId. + */ + interface WithTenantId { + /** + * Specifies the tenantId property: The Azure Active Directory tenant ID that should be used for + * authenticating requests to the managed HSM pool.. + * + * @param tenantId The Azure Active Directory tenant ID that should be used for authenticating requests to + * the managed HSM pool. + * @return the next definition stage. + */ + Update withTenantId(UUID tenantId); + } + + /** + * The stage of the ManagedHsm update allowing to specify initialAdminObjectIds. + */ + interface WithInitialAdminObjectIds { + /** + * Specifies the initialAdminObjectIds property: Array of initial administrators object ids for this managed + * hsm pool.. + * + * @param initialAdminObjectIds Array of initial administrators object ids for this managed hsm pool. + * @return the next definition stage. + */ + Update withInitialAdminObjectIds(List initialAdminObjectIds); + } + + /** + * The stage of the ManagedHsm update allowing to specify enableSoftDelete. + */ + interface WithEnableSoftDelete { + /** + * Specifies the enableSoftDelete property: Property to specify whether the 'soft delete' functionality is + * enabled for this managed HSM pool. Soft delete is enabled by default for all managed HSMs and is + * immutable.. + * + * @param enableSoftDelete Property to specify whether the 'soft delete' functionality is enabled for this + * managed HSM pool. Soft delete is enabled by default for all managed HSMs and is immutable. + * @return the next definition stage. + */ + Update withEnableSoftDelete(Boolean enableSoftDelete); + } + + /** + * The stage of the ManagedHsm update allowing to specify softDeleteRetentionInDays. + */ + interface WithSoftDeleteRetentionInDays { + /** + * Specifies the softDeleteRetentionInDays property: Soft deleted data retention days. When you delete an + * HSM or a key, it will remain recoverable for the configured retention period or for a default period of + * 90 days. It accepts values between 7 and 90.. + * + * @param softDeleteRetentionInDays Soft deleted data retention days. When you delete an HSM or a key, it + * will remain recoverable for the configured retention period or for a default period of 90 days. It + * accepts values between 7 and 90. + * @return the next definition stage. + */ + Update withSoftDeleteRetentionInDays(Integer softDeleteRetentionInDays); + } + + /** + * The stage of the ManagedHsm update allowing to specify enablePurgeProtection. + */ + interface WithEnablePurgeProtection { + /** + * Specifies the enablePurgeProtection property: Property specifying whether protection against purge is + * enabled for this managed HSM pool. Setting this property to true activates protection against purge for + * this managed HSM pool and its content - only the Managed HSM service may initiate a hard, irrecoverable + * deletion. Enabling this functionality is irreversible.. + * + * @param enablePurgeProtection Property specifying whether protection against purge is enabled for this + * managed HSM pool. Setting this property to true activates protection against purge for this managed HSM + * pool and its content - only the Managed HSM service may initiate a hard, irrecoverable deletion. Enabling + * this functionality is irreversible. + * @return the next definition stage. + */ + Update withEnablePurgeProtection(Boolean enablePurgeProtection); + } + + /** + * The stage of the ManagedHsm update allowing to specify createMode. + */ + interface WithCreateMode { + /** + * Specifies the createMode property: The create mode to indicate whether the resource is being created or + * is being recovered from a deleted resource.. + * + * @param createMode The create mode to indicate whether the resource is being created or is being recovered + * from a deleted resource. + * @return the next definition stage. + */ + Update withCreateMode(CreateMode createMode); + } + + /** + * The stage of the ManagedHsm update allowing to specify networkAcls. + */ + interface WithNetworkAcls { + /** + * Specifies the networkAcls property: Rules governing the accessibility of the key vault from specific + * network locations.. + * + * @param networkAcls Rules governing the accessibility of the key vault from specific network locations. + * @return the next definition stage. + */ + Update withNetworkAcls(MhsmNetworkRuleSet networkAcls); + } + + /** + * The stage of the ManagedHsm update allowing to specify regions. + */ + interface WithRegions { + /** + * Specifies the regions property: List of all regions associated with the managed hsm pool.. + * + * @param regions List of all regions associated with the managed hsm pool. + * @return the next definition stage. + */ + Update withRegions(List regions); + } + + /** + * The stage of the ManagedHsm update allowing to specify publicNetworkAccess. + */ + interface WithPublicNetworkAccess { + /** + * Specifies the publicNetworkAccess property: Control permission to the managed HSM from public networks.. + * + * @param publicNetworkAccess Control permission to the managed HSM from public networks. + * @return the next definition stage. + */ + Update withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ManagedHsm refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ManagedHsm refresh(Context context); +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ManagedHsmListResult.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ManagedHsmListResult.java new file mode 100644 index 000000000000..305c351e53f8 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ManagedHsmListResult.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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 com.azure.resourcemanager.keyvault.generated.fluent.models.ManagedHsmInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a ManagedHsm list operation. + */ +@Fluent +public final class ManagedHsmListResult implements JsonSerializable { + /* + * The ManagedHsm items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of ManagedHsmListResult class. + */ + public ManagedHsmListResult() { + } + + /** + * Get the value property: The ManagedHsm items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The ManagedHsm items on this page. + * + * @param value the value value to set. + * @return the ManagedHsmListResult object itself. + */ + public ManagedHsmListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the ManagedHsmListResult object itself. + */ + public ManagedHsmListResult 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) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model ManagedHsmListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ManagedHsmListResult.class); + + /** + * {@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 ManagedHsmListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedHsmListResult 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 ManagedHsmListResult. + */ + public static ManagedHsmListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedHsmListResult deserializedManagedHsmListResult = new ManagedHsmListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> ManagedHsmInner.fromJson(reader1)); + deserializedManagedHsmListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedManagedHsmListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedManagedHsmListResult; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ManagedHsmPrivateEndpointConnectionProvisioningState.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ManagedHsmPrivateEndpointConnectionProvisioningState.java new file mode 100644 index 000000000000..35a3ca74090a --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ManagedHsmPrivateEndpointConnectionProvisioningState.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The current provisioning state. + */ +public final class ManagedHsmPrivateEndpointConnectionProvisioningState + extends ExpandableStringEnum { + /** + * Static value Succeeded for ManagedHsmPrivateEndpointConnectionProvisioningState. + */ + public static final ManagedHsmPrivateEndpointConnectionProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Static value Creating for ManagedHsmPrivateEndpointConnectionProvisioningState. + */ + public static final ManagedHsmPrivateEndpointConnectionProvisioningState CREATING = fromString("Creating"); + + /** + * Static value Updating for ManagedHsmPrivateEndpointConnectionProvisioningState. + */ + public static final ManagedHsmPrivateEndpointConnectionProvisioningState UPDATING = fromString("Updating"); + + /** + * Static value Deleting for ManagedHsmPrivateEndpointConnectionProvisioningState. + */ + public static final ManagedHsmPrivateEndpointConnectionProvisioningState DELETING = fromString("Deleting"); + + /** + * Static value Failed for ManagedHsmPrivateEndpointConnectionProvisioningState. + */ + public static final ManagedHsmPrivateEndpointConnectionProvisioningState FAILED = fromString("Failed"); + + /** + * Static value Disconnected for ManagedHsmPrivateEndpointConnectionProvisioningState. + */ + public static final ManagedHsmPrivateEndpointConnectionProvisioningState DISCONNECTED = fromString("Disconnected"); + + /** + * Creates a new instance of ManagedHsmPrivateEndpointConnectionProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ManagedHsmPrivateEndpointConnectionProvisioningState() { + } + + /** + * Creates or finds a ManagedHsmPrivateEndpointConnectionProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedHsmPrivateEndpointConnectionProvisioningState. + */ + public static ManagedHsmPrivateEndpointConnectionProvisioningState fromString(String name) { + return fromString(name, ManagedHsmPrivateEndpointConnectionProvisioningState.class); + } + + /** + * Gets known ManagedHsmPrivateEndpointConnectionProvisioningState values. + * + * @return known ManagedHsmPrivateEndpointConnectionProvisioningState values. + */ + public static Collection values() { + return values(ManagedHsmPrivateEndpointConnectionProvisioningState.class); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ManagedHsmPrivateEndpointServiceConnectionStatus.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ManagedHsmPrivateEndpointServiceConnectionStatus.java new file mode 100644 index 000000000000..0c15df221037 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ManagedHsmPrivateEndpointServiceConnectionStatus.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.keyvault.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The private endpoint connection status. + */ +public final class ManagedHsmPrivateEndpointServiceConnectionStatus + extends ExpandableStringEnum { + /** + * Static value Pending for ManagedHsmPrivateEndpointServiceConnectionStatus. + */ + public static final ManagedHsmPrivateEndpointServiceConnectionStatus PENDING = fromString("Pending"); + + /** + * Static value Approved for ManagedHsmPrivateEndpointServiceConnectionStatus. + */ + public static final ManagedHsmPrivateEndpointServiceConnectionStatus APPROVED = fromString("Approved"); + + /** + * Static value Rejected for ManagedHsmPrivateEndpointServiceConnectionStatus. + */ + public static final ManagedHsmPrivateEndpointServiceConnectionStatus REJECTED = fromString("Rejected"); + + /** + * Static value Disconnected for ManagedHsmPrivateEndpointServiceConnectionStatus. + */ + public static final ManagedHsmPrivateEndpointServiceConnectionStatus DISCONNECTED = fromString("Disconnected"); + + /** + * Creates a new instance of ManagedHsmPrivateEndpointServiceConnectionStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ManagedHsmPrivateEndpointServiceConnectionStatus() { + } + + /** + * Creates or finds a ManagedHsmPrivateEndpointServiceConnectionStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedHsmPrivateEndpointServiceConnectionStatus. + */ + public static ManagedHsmPrivateEndpointServiceConnectionStatus fromString(String name) { + return fromString(name, ManagedHsmPrivateEndpointServiceConnectionStatus.class); + } + + /** + * Gets known ManagedHsmPrivateEndpointServiceConnectionStatus values. + * + * @return known ManagedHsmPrivateEndpointServiceConnectionStatus values. + */ + public static Collection values() { + return values(ManagedHsmPrivateEndpointServiceConnectionStatus.class); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ManagedHsmProvisioningState.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ManagedHsmProvisioningState.java new file mode 100644 index 000000000000..648dae67d42c --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ManagedHsmProvisioningState.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.keyvault.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Provisioning state. + */ +public final class ManagedHsmProvisioningState extends ExpandableStringEnum { + /** + * Static value Succeeded for ManagedHsmProvisioningState. + */ + public static final ManagedHsmProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Static value Provisioning for ManagedHsmProvisioningState. + */ + public static final ManagedHsmProvisioningState PROVISIONING = fromString("Provisioning"); + + /** + * Static value Failed for ManagedHsmProvisioningState. + */ + public static final ManagedHsmProvisioningState FAILED = fromString("Failed"); + + /** + * Static value Updating for ManagedHsmProvisioningState. + */ + public static final ManagedHsmProvisioningState UPDATING = fromString("Updating"); + + /** + * Static value Deleting for ManagedHsmProvisioningState. + */ + public static final ManagedHsmProvisioningState DELETING = fromString("Deleting"); + + /** + * Static value Activated for ManagedHsmProvisioningState. + */ + public static final ManagedHsmProvisioningState ACTIVATED = fromString("Activated"); + + /** + * Static value SecurityDomainRestore for ManagedHsmProvisioningState. + */ + public static final ManagedHsmProvisioningState SECURITY_DOMAIN_RESTORE = fromString("SecurityDomainRestore"); + + /** + * Static value Restoring for ManagedHsmProvisioningState. + */ + public static final ManagedHsmProvisioningState RESTORING = fromString("Restoring"); + + /** + * Creates a new instance of ManagedHsmProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ManagedHsmProvisioningState() { + } + + /** + * Creates or finds a ManagedHsmProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedHsmProvisioningState. + */ + public static ManagedHsmProvisioningState fromString(String name) { + return fromString(name, ManagedHsmProvisioningState.class); + } + + /** + * Gets known ManagedHsmProvisioningState values. + * + * @return known ManagedHsmProvisioningState values. + */ + public static Collection values() { + return values(ManagedHsmProvisioningState.class); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ManagedHsmResource.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ManagedHsmResource.java new file mode 100644 index 000000000000..4a16310a3834 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ManagedHsmResource.java @@ -0,0 +1,294 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +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; + +/** + * Managed HSM resource. + */ +@Fluent +public class ManagedHsmResource implements JsonSerializable { + /* + * The Azure Resource Manager resource ID for the managed HSM Pool. + */ + private String id; + + /* + * The name of the managed HSM Pool. + */ + private String name; + + /* + * The resource type of the managed HSM Pool. + */ + private String type; + + /* + * The supported Azure location where the managed HSM Pool should be created. + */ + private String location; + + /* + * SKU details + */ + private ManagedHsmSku sku; + + /* + * Resource tags + */ + private Map tags; + + /* + * Metadata pertaining to creation and last modification of the key vault resource. + */ + private SystemData systemData; + + /* + * Managed service identity (system assigned and/or user assigned identities) + */ + private ManagedServiceIdentity identity; + + /** + * Creates an instance of ManagedHsmResource class. + */ + public ManagedHsmResource() { + } + + /** + * Get the id property: The Azure Resource Manager resource ID for the managed HSM Pool. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The Azure Resource Manager resource ID for the managed HSM Pool. + * + * @param id the id value to set. + * @return the ManagedHsmResource object itself. + */ + ManagedHsmResource withId(String id) { + this.id = id; + return this; + } + + /** + * Get the name property: The name of the managed HSM Pool. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the managed HSM Pool. + * + * @param name the name value to set. + * @return the ManagedHsmResource object itself. + */ + ManagedHsmResource withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: The resource type of the managed HSM Pool. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The resource type of the managed HSM Pool. + * + * @param type the type value to set. + * @return the ManagedHsmResource object itself. + */ + ManagedHsmResource withType(String type) { + this.type = type; + return this; + } + + /** + * Get the location property: The supported Azure location where the managed HSM Pool should be created. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The supported Azure location where the managed HSM Pool should be created. + * + * @param location the location value to set. + * @return the ManagedHsmResource object itself. + */ + public ManagedHsmResource withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the sku property: SKU details. + * + * @return the sku value. + */ + public ManagedHsmSku sku() { + return this.sku; + } + + /** + * Set the sku property: SKU details. + * + * @param sku the sku value to set. + * @return the ManagedHsmResource object itself. + */ + public ManagedHsmResource withSku(ManagedHsmSku sku) { + this.sku = sku; + return this; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the ManagedHsmResource object itself. + */ + public ManagedHsmResource withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the key vault resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Set the systemData property: Metadata pertaining to creation and last modification of the key vault resource. + * + * @param systemData the systemData value to set. + * @return the ManagedHsmResource object itself. + */ + ManagedHsmResource withSystemData(SystemData systemData) { + this.systemData = systemData; + 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 ManagedHsmResource object itself. + */ + public ManagedHsmResource withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (identity() != null) { + identity().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", this.location); + jsonWriter.writeJsonField("sku", this.sku); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("identity", this.identity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedHsmResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedHsmResource 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 ManagedHsmResource. + */ + public static ManagedHsmResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedHsmResource deserializedManagedHsmResource = new ManagedHsmResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedManagedHsmResource.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedManagedHsmResource.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedManagedHsmResource.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedManagedHsmResource.location = reader.getString(); + } else if ("sku".equals(fieldName)) { + deserializedManagedHsmResource.sku = ManagedHsmSku.fromJson(reader); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedManagedHsmResource.tags = tags; + } else if ("systemData".equals(fieldName)) { + deserializedManagedHsmResource.systemData = SystemData.fromJson(reader); + } else if ("identity".equals(fieldName)) { + deserializedManagedHsmResource.identity = ManagedServiceIdentity.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedManagedHsmResource; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ManagedHsmSecurityDomainProperties.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ManagedHsmSecurityDomainProperties.java new file mode 100644 index 000000000000..ac8f82fc0fe7 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ManagedHsmSecurityDomainProperties.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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 security domain properties of the managed hsm. + */ +@Immutable +public final class ManagedHsmSecurityDomainProperties implements JsonSerializable { + /* + * Activation Status + */ + private ActivationStatus activationStatus; + + /* + * Activation Status Message. + */ + private String activationStatusMessage; + + /** + * Creates an instance of ManagedHsmSecurityDomainProperties class. + */ + public ManagedHsmSecurityDomainProperties() { + } + + /** + * Get the activationStatus property: Activation Status. + * + * @return the activationStatus value. + */ + public ActivationStatus activationStatus() { + return this.activationStatus; + } + + /** + * Get the activationStatusMessage property: Activation Status Message. + * + * @return the activationStatusMessage value. + */ + public String activationStatusMessage() { + return this.activationStatusMessage; + } + + /** + * 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 ManagedHsmSecurityDomainProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedHsmSecurityDomainProperties 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 ManagedHsmSecurityDomainProperties. + */ + public static ManagedHsmSecurityDomainProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedHsmSecurityDomainProperties deserializedManagedHsmSecurityDomainProperties + = new ManagedHsmSecurityDomainProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("activationStatus".equals(fieldName)) { + deserializedManagedHsmSecurityDomainProperties.activationStatus + = ActivationStatus.fromString(reader.getString()); + } else if ("activationStatusMessage".equals(fieldName)) { + deserializedManagedHsmSecurityDomainProperties.activationStatusMessage = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedManagedHsmSecurityDomainProperties; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ManagedHsmSku.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ManagedHsmSku.java new file mode 100644 index 000000000000..71064fb3e9f5 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ManagedHsmSku.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.keyvault.generated.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; + +/** + * SKU details. + */ +@Fluent +public final class ManagedHsmSku implements JsonSerializable { + /* + * SKU Family of the managed HSM Pool + */ + private ManagedHsmSkuFamily family; + + /* + * SKU of the managed HSM Pool + */ + private ManagedHsmSkuName name; + + /** + * Creates an instance of ManagedHsmSku class. + */ + public ManagedHsmSku() { + } + + /** + * Get the family property: SKU Family of the managed HSM Pool. + * + * @return the family value. + */ + public ManagedHsmSkuFamily family() { + return this.family; + } + + /** + * Set the family property: SKU Family of the managed HSM Pool. + * + * @param family the family value to set. + * @return the ManagedHsmSku object itself. + */ + public ManagedHsmSku withFamily(ManagedHsmSkuFamily family) { + this.family = family; + return this; + } + + /** + * Get the name property: SKU of the managed HSM Pool. + * + * @return the name value. + */ + public ManagedHsmSkuName name() { + return this.name; + } + + /** + * Set the name property: SKU of the managed HSM Pool. + * + * @param name the name value to set. + * @return the ManagedHsmSku object itself. + */ + public ManagedHsmSku withName(ManagedHsmSkuName name) { + this.name = name; + 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 ManagedHsmSku")); + } + if (name() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property name in model ManagedHsmSku")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ManagedHsmSku.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()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedHsmSku from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedHsmSku 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 ManagedHsmSku. + */ + public static ManagedHsmSku fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedHsmSku deserializedManagedHsmSku = new ManagedHsmSku(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("family".equals(fieldName)) { + deserializedManagedHsmSku.family = ManagedHsmSkuFamily.fromString(reader.getString()); + } else if ("name".equals(fieldName)) { + deserializedManagedHsmSku.name = ManagedHsmSkuName.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedManagedHsmSku; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ManagedHsmSkuFamily.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ManagedHsmSkuFamily.java new file mode 100644 index 000000000000..8078f30e2371 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ManagedHsmSkuFamily.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * SKU Family of the managed HSM Pool. + */ +public final class ManagedHsmSkuFamily extends ExpandableStringEnum { + /** + * Static value B for ManagedHsmSkuFamily. + */ + public static final ManagedHsmSkuFamily B = fromString("B"); + + /** + * Static value C for ManagedHsmSkuFamily. + */ + public static final ManagedHsmSkuFamily C = fromString("C"); + + /** + * Creates a new instance of ManagedHsmSkuFamily value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ManagedHsmSkuFamily() { + } + + /** + * Creates or finds a ManagedHsmSkuFamily from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedHsmSkuFamily. + */ + public static ManagedHsmSkuFamily fromString(String name) { + return fromString(name, ManagedHsmSkuFamily.class); + } + + /** + * Gets known ManagedHsmSkuFamily values. + * + * @return known ManagedHsmSkuFamily values. + */ + public static Collection values() { + return values(ManagedHsmSkuFamily.class); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ManagedHsmSkuName.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ManagedHsmSkuName.java new file mode 100644 index 000000000000..e4ec8e0c01d0 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ManagedHsmSkuName.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.models; + +/** + * SKU of the managed HSM Pool. + */ +public enum ManagedHsmSkuName { + /** + * Enum value Standard_B1. + */ + STANDARD_B1("Standard_B1"), + + /** + * Enum value Custom_B32. + */ + CUSTOM_B32("Custom_B32"), + + /** + * Enum value Custom_B6. + */ + CUSTOM_B6("Custom_B6"), + + /** + * Enum value Custom_C42. + */ + CUSTOM_C42("Custom_C42"), + + /** + * Enum value Custom_C10. + */ + CUSTOM_C10("Custom_C10"); + + /** + * The actual serialized value for a ManagedHsmSkuName instance. + */ + private final String value; + + ManagedHsmSkuName(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ManagedHsmSkuName instance. + * + * @param value the serialized value to parse. + * @return the parsed ManagedHsmSkuName object, or null if unable to parse. + */ + public static ManagedHsmSkuName fromString(String value) { + if (value == null) { + return null; + } + ManagedHsmSkuName[] items = ManagedHsmSkuName.values(); + for (ManagedHsmSkuName item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ManagedHsms.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ManagedHsms.java new file mode 100644 index 000000000000..3692e8ada5d9 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ManagedHsms.java @@ -0,0 +1,253 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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 ManagedHsms. + */ +public interface ManagedHsms { + /** + * Checks that the managed hsm name is valid and is not already in use. + * + * @param body The request body. + * @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 CheckMhsmNameAvailability operation response along with {@link Response}. + */ + Response + checkMhsmNameAvailabilityWithResponse(CheckMhsmNameAvailabilityParameters body, Context context); + + /** + * Checks that the managed hsm name is valid and is not already in use. + * + * @param body The request body. + * @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 CheckMhsmNameAvailability operation response. + */ + CheckMhsmNameAvailabilityResult checkMhsmNameAvailability(CheckMhsmNameAvailabilityParameters body); + + /** + * The List operation gets information about the deleted managed HSMs 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 the response of a DeletedManagedHsm list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * The List operation gets information about the deleted managed HSMs associated with the subscription. + * + * @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 response of a DeletedManagedHsm list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Gets the specified deleted managed HSM. + * + * @param location The name of the Azure region. + * @param name The name of the deleted managed HSM. + * @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 deleted managed HSM along with {@link Response}. + */ + Response getDeletedWithResponse(String location, String name, Context context); + + /** + * Gets the specified deleted managed HSM. + * + * @param location The name of the Azure region. + * @param name The name of the deleted managed HSM. + * @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 deleted managed HSM. + */ + DeletedManagedHsm getDeleted(String location, String name); + + /** + * Permanently deletes the specified managed HSM. + * + * @param location The name of the Azure region. + * @param name The name of the deleted managed HSM. + * @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 purgeDeleted(String location, String name); + + /** + * Permanently deletes the specified managed HSM. + * + * @param location The name of the Azure region. + * @param name The name of the deleted managed HSM. + * @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 purgeDeleted(String location, String name, Context context); + + /** + * The List operation gets information about the managed HSM Pools 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 the response of a ManagedHsm list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySubscription(); + + /** + * The List operation gets information about the managed HSM Pools associated with the subscription. + * + * @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. + * @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 response of a ManagedHsm list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySubscription(Integer top, Context context); + + /** + * The List operation gets information about the managed HSM Pools 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 the response of a ManagedHsm list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * The List operation gets information about the managed HSM Pools associated with the subscription and within the + * specified resource group. + * + * @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. + * @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 response of a ManagedHsm list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Integer top, Context context); + + /** + * Gets the specified managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 managed HSM Pool along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String name, Context context); + + /** + * Gets the specified managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 managed HSM Pool. + */ + ManagedHsm getByResourceGroup(String resourceGroupName, String name); + + /** + * Deletes the specified managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 name); + + /** + * Deletes the specified managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 name, Context context); + + /** + * Gets the specified managed HSM Pool. + * + * @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 managed HSM Pool along with {@link Response}. + */ + ManagedHsm getById(String id); + + /** + * Gets the specified managed HSM Pool. + * + * @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 managed HSM Pool along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the specified managed HSM Pool. + * + * @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 managed HSM Pool. + * + * @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 ManagedHsm resource. + * + * @param name resource name. + * @return the first stage of the new ManagedHsm definition. + */ + ManagedHsm.DefinitionStages.Blank define(String name); +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ManagedServiceIdentity.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ManagedServiceIdentity.java new file mode 100644 index 000000000000..6d9fa5770cf9 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/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.keyvault.generated.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/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ManagedServiceIdentityType.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/ManagedServiceIdentityType.java new file mode 100644 index 000000000000..12c54c4bdcce --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/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.keyvault.generated.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/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmGeoReplicatedRegion.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmGeoReplicatedRegion.java new file mode 100644 index 000000000000..77f3f9114efc --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmGeoReplicatedRegion.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.models; + +import com.azure.resourcemanager.keyvault.generated.fluent.models.MhsmGeoReplicatedRegionInner; + +/** + * An immutable client-side representation of MhsmGeoReplicatedRegion. + */ +public interface MhsmGeoReplicatedRegion { + /** + * Gets the name property: Name of the geo replicated region. + * + * @return the name value. + */ + String name(); + + /** + * Gets the provisioningState property: Provisioning state of the geo replicated region. + * + * @return the provisioningState value. + */ + GeoReplicationRegionProvisioningState provisioningState(); + + /** + * Gets the isPrimary property: A boolean value that indicates whether the region is the primary region or a + * secondary region. + * + * @return the isPrimary value. + */ + Boolean isPrimary(); + + /** + * Gets the inner com.azure.resourcemanager.keyvault.generated.fluent.models.MhsmGeoReplicatedRegionInner object. + * + * @return the inner object. + */ + MhsmGeoReplicatedRegionInner innerModel(); +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmNetworkRuleSet.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmNetworkRuleSet.java new file mode 100644 index 000000000000..aaae3f27cd70 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmNetworkRuleSet.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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; + +/** + * A set of rules governing the network accessibility of a managed hsm pool. + */ +@Fluent +public final class MhsmNetworkRuleSet implements JsonSerializable { + /* + * Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default + * is 'AzureServices'. + */ + private NetworkRuleBypassOptions bypass; + + /* + * The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the + * bypass property has been evaluated. + */ + private NetworkRuleAction defaultAction; + + /* + * The list of IP address rules. + */ + private List ipRules; + + /* + * The list of virtual network rules. + */ + private List virtualNetworkRules; + + /** + * Creates an instance of MhsmNetworkRuleSet class. + */ + public MhsmNetworkRuleSet() { + } + + /** + * Get the bypass property: Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If + * not specified the default is 'AzureServices'. + * + * @return the bypass value. + */ + public NetworkRuleBypassOptions bypass() { + return this.bypass; + } + + /** + * Set the bypass property: Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If + * not specified the default is 'AzureServices'. + * + * @param bypass the bypass value to set. + * @return the MhsmNetworkRuleSet object itself. + */ + public MhsmNetworkRuleSet withBypass(NetworkRuleBypassOptions bypass) { + this.bypass = bypass; + return this; + } + + /** + * Get the defaultAction property: The default action when no rule from ipRules and from virtualNetworkRules match. + * This is only used after the bypass property has been evaluated. + * + * @return the defaultAction value. + */ + public NetworkRuleAction defaultAction() { + return this.defaultAction; + } + + /** + * Set the defaultAction property: The default action when no rule from ipRules and from virtualNetworkRules match. + * This is only used after the bypass property has been evaluated. + * + * @param defaultAction the defaultAction value to set. + * @return the MhsmNetworkRuleSet object itself. + */ + public MhsmNetworkRuleSet withDefaultAction(NetworkRuleAction defaultAction) { + this.defaultAction = defaultAction; + return this; + } + + /** + * Get the ipRules property: The list of IP address rules. + * + * @return the ipRules value. + */ + public List ipRules() { + return this.ipRules; + } + + /** + * Set the ipRules property: The list of IP address rules. + * + * @param ipRules the ipRules value to set. + * @return the MhsmNetworkRuleSet object itself. + */ + public MhsmNetworkRuleSet withIpRules(List ipRules) { + this.ipRules = ipRules; + return this; + } + + /** + * Get the virtualNetworkRules property: The list of virtual network rules. + * + * @return the virtualNetworkRules value. + */ + public List virtualNetworkRules() { + return this.virtualNetworkRules; + } + + /** + * Set the virtualNetworkRules property: The list of virtual network rules. + * + * @param virtualNetworkRules the virtualNetworkRules value to set. + * @return the MhsmNetworkRuleSet object itself. + */ + public MhsmNetworkRuleSet withVirtualNetworkRules(List virtualNetworkRules) { + this.virtualNetworkRules = virtualNetworkRules; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (ipRules() != null) { + ipRules().forEach(e -> e.validate()); + } + if (virtualNetworkRules() != null) { + virtualNetworkRules().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("bypass", this.bypass == null ? null : this.bypass.toString()); + jsonWriter.writeStringField("defaultAction", this.defaultAction == null ? null : this.defaultAction.toString()); + jsonWriter.writeArrayField("ipRules", this.ipRules, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("virtualNetworkRules", this.virtualNetworkRules, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MhsmNetworkRuleSet from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MhsmNetworkRuleSet 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 MhsmNetworkRuleSet. + */ + public static MhsmNetworkRuleSet fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MhsmNetworkRuleSet deserializedMhsmNetworkRuleSet = new MhsmNetworkRuleSet(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("bypass".equals(fieldName)) { + deserializedMhsmNetworkRuleSet.bypass = NetworkRuleBypassOptions.fromString(reader.getString()); + } else if ("defaultAction".equals(fieldName)) { + deserializedMhsmNetworkRuleSet.defaultAction = NetworkRuleAction.fromString(reader.getString()); + } else if ("ipRules".equals(fieldName)) { + List ipRules = reader.readArray(reader1 -> MhsmipRule.fromJson(reader1)); + deserializedMhsmNetworkRuleSet.ipRules = ipRules; + } else if ("virtualNetworkRules".equals(fieldName)) { + List virtualNetworkRules + = reader.readArray(reader1 -> MhsmVirtualNetworkRule.fromJson(reader1)); + deserializedMhsmNetworkRuleSet.virtualNetworkRules = virtualNetworkRules; + } else { + reader.skipChildren(); + } + } + + return deserializedMhsmNetworkRuleSet; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmPrivateEndpoint.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmPrivateEndpoint.java new file mode 100644 index 000000000000..e81720960225 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmPrivateEndpoint.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.keyvault.generated.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; + +/** + * Private endpoint object properties. + */ +@Immutable +public final class MhsmPrivateEndpoint implements JsonSerializable { + /* + * Full identifier of the private endpoint resource. + */ + private String id; + + /** + * Creates an instance of MhsmPrivateEndpoint class. + */ + public MhsmPrivateEndpoint() { + } + + /** + * Get the id property: Full identifier of the private endpoint resource. + * + * @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 MhsmPrivateEndpoint from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MhsmPrivateEndpoint 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 MhsmPrivateEndpoint. + */ + public static MhsmPrivateEndpoint fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MhsmPrivateEndpoint deserializedMhsmPrivateEndpoint = new MhsmPrivateEndpoint(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedMhsmPrivateEndpoint.id = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMhsmPrivateEndpoint; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmPrivateEndpointConnection.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmPrivateEndpointConnection.java new file mode 100644 index 000000000000..e141cc9521fd --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmPrivateEndpointConnection.java @@ -0,0 +1,347 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.keyvault.generated.fluent.models.MhsmPrivateEndpointConnectionInner; +import java.util.Map; + +/** + * An immutable client-side representation of MhsmPrivateEndpointConnection. + */ +public interface MhsmPrivateEndpointConnection { + /** + * 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 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 privateEndpoint property: Properties of the private endpoint object. + * + * @return the privateEndpoint value. + */ + MhsmPrivateEndpoint privateEndpoint(); + + /** + * Gets the privateLinkServiceConnectionState property: Approval state of the private link connection. + * + * @return the privateLinkServiceConnectionState value. + */ + MhsmPrivateLinkServiceConnectionState privateLinkServiceConnectionState(); + + /** + * Gets the provisioningState property: Provisioning state of the private endpoint connection. + * + * @return the provisioningState value. + */ + ManagedHsmPrivateEndpointConnectionProvisioningState provisioningState(); + + /** + * 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.keyvault.generated.fluent.models.MhsmPrivateEndpointConnectionInner + * object. + * + * @return the inner object. + */ + MhsmPrivateEndpointConnectionInner innerModel(); + + /** + * The entirety of the MhsmPrivateEndpointConnection definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The MhsmPrivateEndpointConnection definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the MhsmPrivateEndpointConnection definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the MhsmPrivateEndpointConnection 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. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + + /** + * The stage of the MhsmPrivateEndpointConnection definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @return the next definition stage. + */ + WithCreate withExistingManagedHSM(String resourceGroupName, String name); + } + + /** + * The stage of the MhsmPrivateEndpointConnection 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.WithEtag, + DefinitionStages.WithPrivateEndpoint, DefinitionStages.WithPrivateLinkServiceConnectionState { + /** + * Executes the create request. + * + * @return the created resource. + */ + MhsmPrivateEndpointConnection create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + MhsmPrivateEndpointConnection create(Context context); + } + + /** + * The stage of the MhsmPrivateEndpointConnection 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 MhsmPrivateEndpointConnection 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); + } + + /** + * The stage of the MhsmPrivateEndpointConnection definition allowing to specify privateEndpoint. + */ + interface WithPrivateEndpoint { + /** + * Specifies the privateEndpoint property: Properties of the private endpoint object.. + * + * @param privateEndpoint Properties of the private endpoint object. + * @return the next definition stage. + */ + WithCreate withPrivateEndpoint(MhsmPrivateEndpoint privateEndpoint); + } + + /** + * The stage of the MhsmPrivateEndpointConnection definition allowing to specify + * privateLinkServiceConnectionState. + */ + interface WithPrivateLinkServiceConnectionState { + /** + * Specifies the privateLinkServiceConnectionState property: Approval state of the private link connection.. + * + * @param privateLinkServiceConnectionState Approval state of the private link connection. + * @return the next definition stage. + */ + WithCreate withPrivateLinkServiceConnectionState( + MhsmPrivateLinkServiceConnectionState privateLinkServiceConnectionState); + } + } + + /** + * Begins update for the MhsmPrivateEndpointConnection resource. + * + * @return the stage of resource update. + */ + MhsmPrivateEndpointConnection.Update update(); + + /** + * The template for MhsmPrivateEndpointConnection update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithEtag, UpdateStages.WithPrivateEndpoint, + UpdateStages.WithPrivateLinkServiceConnectionState { + /** + * Executes the update request. + * + * @return the updated resource. + */ + MhsmPrivateEndpointConnection apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + MhsmPrivateEndpointConnection apply(Context context); + } + + /** + * The MhsmPrivateEndpointConnection update stages. + */ + interface UpdateStages { + /** + * The stage of the MhsmPrivateEndpointConnection update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the MhsmPrivateEndpointConnection update 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. + */ + Update withEtag(String etag); + } + + /** + * The stage of the MhsmPrivateEndpointConnection update allowing to specify privateEndpoint. + */ + interface WithPrivateEndpoint { + /** + * Specifies the privateEndpoint property: Properties of the private endpoint object.. + * + * @param privateEndpoint Properties of the private endpoint object. + * @return the next definition stage. + */ + Update withPrivateEndpoint(MhsmPrivateEndpoint privateEndpoint); + } + + /** + * The stage of the MhsmPrivateEndpointConnection update allowing to specify privateLinkServiceConnectionState. + */ + interface WithPrivateLinkServiceConnectionState { + /** + * Specifies the privateLinkServiceConnectionState property: Approval state of the private link connection.. + * + * @param privateLinkServiceConnectionState Approval state of the private link connection. + * @return the next definition stage. + */ + Update withPrivateLinkServiceConnectionState( + MhsmPrivateLinkServiceConnectionState privateLinkServiceConnectionState); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + MhsmPrivateEndpointConnection refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + MhsmPrivateEndpointConnection refresh(Context context); +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmPrivateEndpointConnectionItem.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmPrivateEndpointConnectionItem.java new file mode 100644 index 000000000000..598a4806e7f2 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmPrivateEndpointConnectionItem.java @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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.keyvault.generated.fluent.models.MhsmPrivateEndpointConnectionProperties; +import java.io.IOException; + +/** + * Private endpoint connection item. + */ +@Fluent +public final class MhsmPrivateEndpointConnectionItem implements JsonSerializable { + /* + * Id of private endpoint connection. + */ + private String id; + + /* + * Modified whenever there is a change in the state of private endpoint connection. + */ + private String etag; + + /* + * Private endpoint connection properties. + */ + private MhsmPrivateEndpointConnectionProperties innerProperties; + + /** + * Creates an instance of MhsmPrivateEndpointConnectionItem class. + */ + public MhsmPrivateEndpointConnectionItem() { + } + + /** + * Get the id property: Id of private endpoint connection. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Id of private endpoint connection. + * + * @param id the id value to set. + * @return the MhsmPrivateEndpointConnectionItem object itself. + */ + public MhsmPrivateEndpointConnectionItem withId(String id) { + this.id = id; + 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 MhsmPrivateEndpointConnectionItem object itself. + */ + public MhsmPrivateEndpointConnectionItem withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Get the innerProperties property: Private endpoint connection properties. + * + * @return the innerProperties value. + */ + private MhsmPrivateEndpointConnectionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the privateEndpoint property: Properties of the private endpoint object. + * + * @return the privateEndpoint value. + */ + public MhsmPrivateEndpoint privateEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().privateEndpoint(); + } + + /** + * Set the privateEndpoint property: Properties of the private endpoint object. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the MhsmPrivateEndpointConnectionItem object itself. + */ + public MhsmPrivateEndpointConnectionItem withPrivateEndpoint(MhsmPrivateEndpoint privateEndpoint) { + if (this.innerProperties() == null) { + this.innerProperties = new MhsmPrivateEndpointConnectionProperties(); + } + this.innerProperties().withPrivateEndpoint(privateEndpoint); + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: Approval state of the private link connection. + * + * @return the privateLinkServiceConnectionState value. + */ + public MhsmPrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.innerProperties() == null ? null : this.innerProperties().privateLinkServiceConnectionState(); + } + + /** + * Set the privateLinkServiceConnectionState property: Approval state of the private link connection. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the MhsmPrivateEndpointConnectionItem object itself. + */ + public MhsmPrivateEndpointConnectionItem + withPrivateLinkServiceConnectionState(MhsmPrivateLinkServiceConnectionState privateLinkServiceConnectionState) { + if (this.innerProperties() == null) { + this.innerProperties = new MhsmPrivateEndpointConnectionProperties(); + } + this.innerProperties().withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState); + return this; + } + + /** + * Get the provisioningState property: Provisioning state of the private endpoint connection. + * + * @return the provisioningState value. + */ + public ManagedHsmPrivateEndpointConnectionProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("etag", this.etag); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MhsmPrivateEndpointConnectionItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MhsmPrivateEndpointConnectionItem 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 MhsmPrivateEndpointConnectionItem. + */ + public static MhsmPrivateEndpointConnectionItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MhsmPrivateEndpointConnectionItem deserializedMhsmPrivateEndpointConnectionItem + = new MhsmPrivateEndpointConnectionItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedMhsmPrivateEndpointConnectionItem.id = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedMhsmPrivateEndpointConnectionItem.etag = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedMhsmPrivateEndpointConnectionItem.innerProperties + = MhsmPrivateEndpointConnectionProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMhsmPrivateEndpointConnectionItem; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmPrivateEndpointConnectionListResult.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmPrivateEndpointConnectionListResult.java new file mode 100644 index 000000000000..3290fd3cc7bf --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmPrivateEndpointConnectionListResult.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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 com.azure.resourcemanager.keyvault.generated.fluent.models.MhsmPrivateEndpointConnectionInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a MhsmPrivateEndpointConnection list operation. + */ +@Fluent +public final class MhsmPrivateEndpointConnectionListResult + implements JsonSerializable { + /* + * The MhsmPrivateEndpointConnection items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of MhsmPrivateEndpointConnectionListResult class. + */ + public MhsmPrivateEndpointConnectionListResult() { + } + + /** + * Get the value property: The MhsmPrivateEndpointConnection items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The MhsmPrivateEndpointConnection items on this page. + * + * @param value the value value to set. + * @return the MhsmPrivateEndpointConnectionListResult object itself. + */ + public MhsmPrivateEndpointConnectionListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the MhsmPrivateEndpointConnectionListResult object itself. + */ + public MhsmPrivateEndpointConnectionListResult 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) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model MhsmPrivateEndpointConnectionListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MhsmPrivateEndpointConnectionListResult.class); + + /** + * {@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 MhsmPrivateEndpointConnectionListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MhsmPrivateEndpointConnectionListResult 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 MhsmPrivateEndpointConnectionListResult. + */ + public static MhsmPrivateEndpointConnectionListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MhsmPrivateEndpointConnectionListResult deserializedMhsmPrivateEndpointConnectionListResult + = new MhsmPrivateEndpointConnectionListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> MhsmPrivateEndpointConnectionInner.fromJson(reader1)); + deserializedMhsmPrivateEndpointConnectionListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedMhsmPrivateEndpointConnectionListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMhsmPrivateEndpointConnectionListResult; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmPrivateEndpointConnections.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmPrivateEndpointConnections.java new file mode 100644 index 000000000000..1e7aabe7d7f5 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmPrivateEndpointConnections.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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 MhsmPrivateEndpointConnections. + */ +public interface MhsmPrivateEndpointConnections { + /** + * The List operation gets information about the private endpoint connections associated with the managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 response of a MhsmPrivateEndpointConnection list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByResource(String resourceGroupName, String name); + + /** + * The List operation gets information about the private endpoint connections associated with the managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 response of a MhsmPrivateEndpointConnection list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByResource(String resourceGroupName, String name, Context context); + + /** + * Gets the specified private endpoint connection associated with the managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the managed hsm + * pool. + * @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 private endpoint connection associated with the managed HSM Pool along with + * {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String name, + String privateEndpointConnectionName, Context context); + + /** + * Gets the specified private endpoint connection associated with the managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the managed hsm + * pool. + * @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 private endpoint connection associated with the managed HSM Pool. + */ + MhsmPrivateEndpointConnection get(String resourceGroupName, String name, String privateEndpointConnectionName); + + /** + * Deletes the specified private endpoint connection associated with the managed hsm pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the managed hsm + * pool. + * @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 private endpoint connection resource. + */ + MhsmPrivateEndpointConnection delete(String resourceGroupName, String name, String privateEndpointConnectionName); + + /** + * Deletes the specified private endpoint connection associated with the managed hsm pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the managed hsm + * pool. + * @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 private endpoint connection resource. + */ + MhsmPrivateEndpointConnection delete(String resourceGroupName, String name, String privateEndpointConnectionName, + Context context); + + /** + * Gets the specified private endpoint connection associated with the managed HSM Pool. + * + * @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 private endpoint connection associated with the managed HSM Pool along with + * {@link Response}. + */ + MhsmPrivateEndpointConnection getById(String id); + + /** + * Gets the specified private endpoint connection associated with the managed HSM Pool. + * + * @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 private endpoint connection associated with the managed HSM Pool along with + * {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the specified private endpoint connection associated with the managed hsm pool. + * + * @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 private endpoint connection resource. + */ + MhsmPrivateEndpointConnection deleteById(String id); + + /** + * Deletes the specified private endpoint connection associated with the managed hsm pool. + * + * @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 private endpoint connection resource. + */ + MhsmPrivateEndpointConnection deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new MhsmPrivateEndpointConnection resource. + * + * @param name resource name. + * @return the first stage of the new MhsmPrivateEndpointConnection definition. + */ + MhsmPrivateEndpointConnection.DefinitionStages.Blank define(String name); +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmPrivateLinkResource.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmPrivateLinkResource.java new file mode 100644 index 000000000000..4d42f772ec91 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmPrivateLinkResource.java @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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.keyvault.generated.fluent.models.MhsmPrivateLinkResourceProperties; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * A private link resource. + */ +@Fluent +public final class MhsmPrivateLinkResource extends ManagedHsmResource { + /* + * Resource properties. + */ + private MhsmPrivateLinkResourceProperties innerProperties; + + /* + * Metadata pertaining to creation and last modification of the key vault resource. + */ + private SystemData systemData; + + /* + * The resource type of the managed HSM Pool. + */ + private String type; + + /* + * The name of the managed HSM Pool. + */ + private String name; + + /* + * The Azure Resource Manager resource ID for the managed HSM Pool. + */ + private String id; + + /** + * Creates an instance of MhsmPrivateLinkResource class. + */ + public MhsmPrivateLinkResource() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private MhsmPrivateLinkResourceProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the key vault resource. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The resource type of the managed HSM Pool. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the managed HSM Pool. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: The Azure Resource Manager resource ID for the managed HSM Pool. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public MhsmPrivateLinkResource withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public MhsmPrivateLinkResource withSku(ManagedHsmSku sku) { + super.withSku(sku); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public MhsmPrivateLinkResource withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public MhsmPrivateLinkResource withIdentity(ManagedServiceIdentity identity) { + super.withIdentity(identity); + return this; + } + + /** + * Get the groupId property: Group identifier of private link resource. + * + * @return the groupId value. + */ + public String groupId() { + return this.innerProperties() == null ? null : this.innerProperties().groupId(); + } + + /** + * Get the requiredMembers property: Required member names of private link resource. + * + * @return the requiredMembers value. + */ + public List requiredMembers() { + return this.innerProperties() == null ? null : this.innerProperties().requiredMembers(); + } + + /** + * Get the requiredZoneNames property: Required DNS zone names of the the private link resource. + * + * @return the requiredZoneNames value. + */ + public List requiredZoneNames() { + return this.innerProperties() == null ? null : this.innerProperties().requiredZoneNames(); + } + + /** + * Set the requiredZoneNames property: Required DNS zone names of the the private link resource. + * + * @param requiredZoneNames the requiredZoneNames value to set. + * @return the MhsmPrivateLinkResource object itself. + */ + public MhsmPrivateLinkResource withRequiredZoneNames(List requiredZoneNames) { + if (this.innerProperties() == null) { + this.innerProperties = new MhsmPrivateLinkResourceProperties(); + } + this.innerProperties().withRequiredZoneNames(requiredZoneNames); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + if (sku() != null) { + sku().validate(); + } + if (identity() != null) { + identity().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeJsonField("sku", sku()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("identity", identity()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MhsmPrivateLinkResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MhsmPrivateLinkResource 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 MhsmPrivateLinkResource. + */ + public static MhsmPrivateLinkResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MhsmPrivateLinkResource deserializedMhsmPrivateLinkResource = new MhsmPrivateLinkResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedMhsmPrivateLinkResource.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedMhsmPrivateLinkResource.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedMhsmPrivateLinkResource.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedMhsmPrivateLinkResource.withLocation(reader.getString()); + } else if ("sku".equals(fieldName)) { + deserializedMhsmPrivateLinkResource.withSku(ManagedHsmSku.fromJson(reader)); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedMhsmPrivateLinkResource.withTags(tags); + } else if ("systemData".equals(fieldName)) { + deserializedMhsmPrivateLinkResource.systemData = SystemData.fromJson(reader); + } else if ("identity".equals(fieldName)) { + deserializedMhsmPrivateLinkResource.withIdentity(ManagedServiceIdentity.fromJson(reader)); + } else if ("properties".equals(fieldName)) { + deserializedMhsmPrivateLinkResource.innerProperties + = MhsmPrivateLinkResourceProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMhsmPrivateLinkResource; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmPrivateLinkResourceListResult.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmPrivateLinkResourceListResult.java new file mode 100644 index 000000000000..dd1d44ef2f83 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmPrivateLinkResourceListResult.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.models; + +import com.azure.resourcemanager.keyvault.generated.fluent.models.MhsmPrivateLinkResourceListResultInner; +import java.util.List; + +/** + * An immutable client-side representation of MhsmPrivateLinkResourceListResult. + */ +public interface MhsmPrivateLinkResourceListResult { + /** + * Gets the value property: Array of private link resources. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.keyvault.generated.fluent.models.MhsmPrivateLinkResourceListResultInner + * object. + * + * @return the inner object. + */ + MhsmPrivateLinkResourceListResultInner innerModel(); +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmPrivateLinkResources.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmPrivateLinkResources.java new file mode 100644 index 000000000000..0896bd57d25d --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmPrivateLinkResources.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of MhsmPrivateLinkResources. + */ +public interface MhsmPrivateLinkResources { + /** + * Gets the private link resources supported for the managed hsm pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 managed hsm pool along with {@link Response}. + */ + Response listByMhsmResourceWithResponse(String resourceGroupName, String name, + Context context); + + /** + * Gets the private link resources supported for the managed hsm pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 managed hsm pool. + */ + MhsmPrivateLinkResourceListResult listByMhsmResource(String resourceGroupName, String name); +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmPrivateLinkServiceConnectionState.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmPrivateLinkServiceConnectionState.java new file mode 100644 index 000000000000..8d2e6682fc46 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmPrivateLinkServiceConnectionState.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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; + +/** + * An object that represents the approval state of the private link connection. + */ +@Fluent +public final class MhsmPrivateLinkServiceConnectionState + implements JsonSerializable { + /* + * Indicates whether the connection has been approved, rejected or removed by the key vault owner. + */ + private ManagedHsmPrivateEndpointServiceConnectionStatus status; + + /* + * The reason for approval or rejection. + */ + private String description; + + /* + * A message indicating if changes on the service provider require any updates on the consumer. + */ + private ActionsRequired actionsRequired; + + /** + * Creates an instance of MhsmPrivateLinkServiceConnectionState class. + */ + public MhsmPrivateLinkServiceConnectionState() { + } + + /** + * Get the status property: Indicates whether the connection has been approved, rejected or removed by the key vault + * owner. + * + * @return the status value. + */ + public ManagedHsmPrivateEndpointServiceConnectionStatus status() { + return this.status; + } + + /** + * Set the status property: Indicates whether the connection has been approved, rejected or removed by the key vault + * owner. + * + * @param status the status value to set. + * @return the MhsmPrivateLinkServiceConnectionState object itself. + */ + public MhsmPrivateLinkServiceConnectionState withStatus(ManagedHsmPrivateEndpointServiceConnectionStatus status) { + this.status = status; + return this; + } + + /** + * Get the description property: The reason for approval or rejection. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The reason for approval or rejection. + * + * @param description the description value to set. + * @return the MhsmPrivateLinkServiceConnectionState object itself. + */ + public MhsmPrivateLinkServiceConnectionState 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 ActionsRequired 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 MhsmPrivateLinkServiceConnectionState object itself. + */ + public MhsmPrivateLinkServiceConnectionState withActionsRequired(ActionsRequired 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 == null ? null : this.actionsRequired.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MhsmPrivateLinkServiceConnectionState from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MhsmPrivateLinkServiceConnectionState 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 MhsmPrivateLinkServiceConnectionState. + */ + public static MhsmPrivateLinkServiceConnectionState fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MhsmPrivateLinkServiceConnectionState deserializedMhsmPrivateLinkServiceConnectionState + = new MhsmPrivateLinkServiceConnectionState(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("status".equals(fieldName)) { + deserializedMhsmPrivateLinkServiceConnectionState.status + = ManagedHsmPrivateEndpointServiceConnectionStatus.fromString(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedMhsmPrivateLinkServiceConnectionState.description = reader.getString(); + } else if ("actionsRequired".equals(fieldName)) { + deserializedMhsmPrivateLinkServiceConnectionState.actionsRequired + = ActionsRequired.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedMhsmPrivateLinkServiceConnectionState; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmRegions.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmRegions.java new file mode 100644 index 000000000000..2a0d60d5f037 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmRegions.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of MhsmRegions. + */ +public interface MhsmRegions { + /** + * The List operation gets information about the regions associated with the managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 regions associated with a managed HSM Pools as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResource(String resourceGroupName, String name); + + /** + * The List operation gets information about the regions associated with the managed HSM Pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the managed HSM Pool. + * @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 regions associated with a managed HSM Pools as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResource(String resourceGroupName, String name, Context context); +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmRegionsListResult.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmRegionsListResult.java new file mode 100644 index 000000000000..d73b52e49dba --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmRegionsListResult.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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 com.azure.resourcemanager.keyvault.generated.fluent.models.MhsmGeoReplicatedRegionInner; +import java.io.IOException; +import java.util.List; + +/** + * List of regions associated with a managed HSM Pools. + */ +@Fluent +public final class MhsmRegionsListResult implements JsonSerializable { + /* + * The MhsmGeoReplicatedRegion items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of MhsmRegionsListResult class. + */ + public MhsmRegionsListResult() { + } + + /** + * Get the value property: The MhsmGeoReplicatedRegion items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The MhsmGeoReplicatedRegion items on this page. + * + * @param value the value value to set. + * @return the MhsmRegionsListResult object itself. + */ + public MhsmRegionsListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the MhsmRegionsListResult object itself. + */ + public MhsmRegionsListResult 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) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model MhsmRegionsListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MhsmRegionsListResult.class); + + /** + * {@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 MhsmRegionsListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MhsmRegionsListResult 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 MhsmRegionsListResult. + */ + public static MhsmRegionsListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MhsmRegionsListResult deserializedMhsmRegionsListResult = new MhsmRegionsListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> MhsmGeoReplicatedRegionInner.fromJson(reader1)); + deserializedMhsmRegionsListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedMhsmRegionsListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMhsmRegionsListResult; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmVirtualNetworkRule.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmVirtualNetworkRule.java new file mode 100644 index 000000000000..68b95b326f5a --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmVirtualNetworkRule.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.keyvault.generated.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; + +/** + * A rule governing the accessibility of a managed hsm pool from a specific virtual network. + */ +@Fluent +public final class MhsmVirtualNetworkRule implements JsonSerializable { + /* + * Full resource id of a vnet subnet, such as + * '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + */ + private String id; + + /** + * Creates an instance of MhsmVirtualNetworkRule class. + */ + public MhsmVirtualNetworkRule() { + } + + /** + * Get the id property: Full resource id of a vnet subnet, such as + * '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Full resource id of a vnet subnet, such as + * '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + * + * @param id the id value to set. + * @return the MhsmVirtualNetworkRule object itself. + */ + public MhsmVirtualNetworkRule withId(String id) { + this.id = id; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property id in model MhsmVirtualNetworkRule")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MhsmVirtualNetworkRule.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MhsmVirtualNetworkRule from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MhsmVirtualNetworkRule 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 MhsmVirtualNetworkRule. + */ + public static MhsmVirtualNetworkRule fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MhsmVirtualNetworkRule deserializedMhsmVirtualNetworkRule = new MhsmVirtualNetworkRule(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedMhsmVirtualNetworkRule.id = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMhsmVirtualNetworkRule; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmipRule.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmipRule.java new file mode 100644 index 000000000000..d3aa8138bf96 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/MhsmipRule.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.keyvault.generated.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; + +/** + * A rule governing the accessibility of a managed HSM pool from a specific IP address or IP range. + */ +@Fluent +public final class MhsmipRule implements JsonSerializable { + /* + * An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all + * addresses that start with 124.56.78). + */ + private String value; + + /** + * Creates an instance of MhsmipRule class. + */ + public MhsmipRule() { + } + + /** + * Get the value property: An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or + * '124.56.78.0/24' (all addresses that start with 124.56.78). + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or + * '124.56.78.0/24' (all addresses that start with 124.56.78). + * + * @param value the value value to set. + * @return the MhsmipRule object itself. + */ + public MhsmipRule withValue(String value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model MhsmipRule")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MhsmipRule.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("value", this.value); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MhsmipRule from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MhsmipRule 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 MhsmipRule. + */ + public static MhsmipRule fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MhsmipRule deserializedMhsmipRule = new MhsmipRule(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + deserializedMhsmipRule.value = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMhsmipRule; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/NetworkRuleAction.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/NetworkRuleAction.java new file mode 100644 index 000000000000..954cd1745c99 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/NetworkRuleAction.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass + * property has been evaluated. + */ +public final class NetworkRuleAction extends ExpandableStringEnum { + /** + * Static value Allow for NetworkRuleAction. + */ + public static final NetworkRuleAction ALLOW = fromString("Allow"); + + /** + * Static value Deny for NetworkRuleAction. + */ + public static final NetworkRuleAction DENY = fromString("Deny"); + + /** + * Creates a new instance of NetworkRuleAction value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public NetworkRuleAction() { + } + + /** + * Creates or finds a NetworkRuleAction from its string representation. + * + * @param name a name to look for. + * @return the corresponding NetworkRuleAction. + */ + public static NetworkRuleAction fromString(String name) { + return fromString(name, NetworkRuleAction.class); + } + + /** + * Gets known NetworkRuleAction values. + * + * @return known NetworkRuleAction values. + */ + public static Collection values() { + return values(NetworkRuleAction.class); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/NetworkRuleBypassOptions.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/NetworkRuleBypassOptions.java new file mode 100644 index 000000000000..311e82e7b6b2 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/NetworkRuleBypassOptions.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is + * 'AzureServices'. + */ +public final class NetworkRuleBypassOptions extends ExpandableStringEnum { + /** + * Static value AzureServices for NetworkRuleBypassOptions. + */ + public static final NetworkRuleBypassOptions AZURE_SERVICES = fromString("AzureServices"); + + /** + * Static value None for NetworkRuleBypassOptions. + */ + public static final NetworkRuleBypassOptions NONE = fromString("None"); + + /** + * Creates a new instance of NetworkRuleBypassOptions value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public NetworkRuleBypassOptions() { + } + + /** + * Creates or finds a NetworkRuleBypassOptions from its string representation. + * + * @param name a name to look for. + * @return the corresponding NetworkRuleBypassOptions. + */ + public static NetworkRuleBypassOptions fromString(String name) { + return fromString(name, NetworkRuleBypassOptions.class); + } + + /** + * Gets known NetworkRuleBypassOptions values. + * + * @return known NetworkRuleBypassOptions values. + */ + public static Collection values() { + return values(NetworkRuleBypassOptions.class); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/NetworkRuleSet.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/NetworkRuleSet.java new file mode 100644 index 000000000000..77be86169e35 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/NetworkRuleSet.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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; + +/** + * A set of rules governing the network accessibility of a vault. + */ +@Fluent +public final class NetworkRuleSet implements JsonSerializable { + /* + * Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default + * is 'AzureServices'. + */ + private KeyVaultNetworkRuleBypassOption bypass; + + /* + * The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the + * bypass property has been evaluated. + */ + private KeyVaultNetworkRuleAction defaultAction; + + /* + * The list of IP address rules. + */ + private List ipRules; + + /* + * The list of virtual network rules. + */ + private List virtualNetworkRules; + + /** + * Creates an instance of NetworkRuleSet class. + */ + public NetworkRuleSet() { + } + + /** + * Get the bypass property: Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If + * not specified the default is 'AzureServices'. + * + * @return the bypass value. + */ + public KeyVaultNetworkRuleBypassOption bypass() { + return this.bypass; + } + + /** + * Set the bypass property: Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If + * not specified the default is 'AzureServices'. + * + * @param bypass the bypass value to set. + * @return the NetworkRuleSet object itself. + */ + public NetworkRuleSet withBypass(KeyVaultNetworkRuleBypassOption bypass) { + this.bypass = bypass; + return this; + } + + /** + * Get the defaultAction property: The default action when no rule from ipRules and from virtualNetworkRules match. + * This is only used after the bypass property has been evaluated. + * + * @return the defaultAction value. + */ + public KeyVaultNetworkRuleAction defaultAction() { + return this.defaultAction; + } + + /** + * Set the defaultAction property: The default action when no rule from ipRules and from virtualNetworkRules match. + * This is only used after the bypass property has been evaluated. + * + * @param defaultAction the defaultAction value to set. + * @return the NetworkRuleSet object itself. + */ + public NetworkRuleSet withDefaultAction(KeyVaultNetworkRuleAction defaultAction) { + this.defaultAction = defaultAction; + return this; + } + + /** + * Get the ipRules property: The list of IP address rules. + * + * @return the ipRules value. + */ + public List ipRules() { + return this.ipRules; + } + + /** + * Set the ipRules property: The list of IP address rules. + * + * @param ipRules the ipRules value to set. + * @return the NetworkRuleSet object itself. + */ + public NetworkRuleSet withIpRules(List ipRules) { + this.ipRules = ipRules; + return this; + } + + /** + * Get the virtualNetworkRules property: The list of virtual network rules. + * + * @return the virtualNetworkRules value. + */ + public List virtualNetworkRules() { + return this.virtualNetworkRules; + } + + /** + * Set the virtualNetworkRules property: The list of virtual network rules. + * + * @param virtualNetworkRules the virtualNetworkRules value to set. + * @return the NetworkRuleSet object itself. + */ + public NetworkRuleSet withVirtualNetworkRules(List virtualNetworkRules) { + this.virtualNetworkRules = virtualNetworkRules; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (ipRules() != null) { + ipRules().forEach(e -> e.validate()); + } + if (virtualNetworkRules() != null) { + virtualNetworkRules().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("bypass", this.bypass == null ? null : this.bypass.toString()); + jsonWriter.writeStringField("defaultAction", this.defaultAction == null ? null : this.defaultAction.toString()); + jsonWriter.writeArrayField("ipRules", this.ipRules, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("virtualNetworkRules", this.virtualNetworkRules, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NetworkRuleSet from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NetworkRuleSet 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 NetworkRuleSet. + */ + public static NetworkRuleSet fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NetworkRuleSet deserializedNetworkRuleSet = new NetworkRuleSet(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("bypass".equals(fieldName)) { + deserializedNetworkRuleSet.bypass = KeyVaultNetworkRuleBypassOption.fromString(reader.getString()); + } else if ("defaultAction".equals(fieldName)) { + deserializedNetworkRuleSet.defaultAction = KeyVaultNetworkRuleAction.fromString(reader.getString()); + } else if ("ipRules".equals(fieldName)) { + List ipRules = reader.readArray(reader1 -> IpRule.fromJson(reader1)); + deserializedNetworkRuleSet.ipRules = ipRules; + } else if ("virtualNetworkRules".equals(fieldName)) { + List virtualNetworkRules + = reader.readArray(reader1 -> VirtualNetworkRule.fromJson(reader1)); + deserializedNetworkRuleSet.virtualNetworkRules = virtualNetworkRules; + } else { + reader.skipChildren(); + } + } + + return deserializedNetworkRuleSet; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/Operation.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/Operation.java new file mode 100644 index 000000000000..c41d9b135e23 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/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.keyvault.generated.models; + +import com.azure.resourcemanager.keyvault.generated.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.keyvault.generated.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/OperationDisplay.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/OperationDisplay.java new file mode 100644 index 000000000000..f1917b920d3a --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/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.keyvault.generated.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/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/OperationListResult.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/OperationListResult.java new file mode 100644 index 000000000000..1a8727450d97 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/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.keyvault.generated.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.keyvault.generated.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/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/Operations.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/Operations.java new file mode 100644 index 000000000000..6e79bb6c3d4b --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/Operations.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.keyvault.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of Operations. + */ +public interface Operations { + /** + * List the operations for the provider. + * + * @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 REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List the operations for the provider. + * + * @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 a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/Origin.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/Origin.java new file mode 100644 index 000000000000..426e78a6bc19 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/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.keyvault.generated.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/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/Permissions.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/Permissions.java new file mode 100644 index 000000000000..f6f0bfb56f22 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/Permissions.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.keyvault.generated.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; + +/** + * Permissions the identity has for keys, secrets, certificates and storage. + */ +@Fluent +public final class Permissions implements JsonSerializable { + /* + * Permissions to keys + */ + private List keys; + + /* + * Permissions to secrets + */ + private List secrets; + + /* + * Permissions to certificates + */ + private List certificates; + + /* + * Permissions to storage accounts + */ + private List storage; + + /** + * Creates an instance of Permissions class. + */ + public Permissions() { + } + + /** + * Get the keys property: Permissions to keys. + * + * @return the keys value. + */ + public List keys() { + return this.keys; + } + + /** + * Set the keys property: Permissions to keys. + * + * @param keys the keys value to set. + * @return the Permissions object itself. + */ + public Permissions withKeys(List keys) { + this.keys = keys; + return this; + } + + /** + * Get the secrets property: Permissions to secrets. + * + * @return the secrets value. + */ + public List secrets() { + return this.secrets; + } + + /** + * Set the secrets property: Permissions to secrets. + * + * @param secrets the secrets value to set. + * @return the Permissions object itself. + */ + public Permissions withSecrets(List secrets) { + this.secrets = secrets; + return this; + } + + /** + * Get the certificates property: Permissions to certificates. + * + * @return the certificates value. + */ + public List certificates() { + return this.certificates; + } + + /** + * Set the certificates property: Permissions to certificates. + * + * @param certificates the certificates value to set. + * @return the Permissions object itself. + */ + public Permissions withCertificates(List certificates) { + this.certificates = certificates; + return this; + } + + /** + * Get the storage property: Permissions to storage accounts. + * + * @return the storage value. + */ + public List storage() { + return this.storage; + } + + /** + * Set the storage property: Permissions to storage accounts. + * + * @param storage the storage value to set. + * @return the Permissions object itself. + */ + public Permissions withStorage(List storage) { + this.storage = storage; + 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("keys", this.keys, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeArrayField("secrets", this.secrets, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeArrayField("certificates", this.certificates, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeArrayField("storage", this.storage, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Permissions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Permissions 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 Permissions. + */ + public static Permissions fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Permissions deserializedPermissions = new Permissions(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("keys".equals(fieldName)) { + List keys + = reader.readArray(reader1 -> KeyPermissions.fromString(reader1.getString())); + deserializedPermissions.keys = keys; + } else if ("secrets".equals(fieldName)) { + List secrets + = reader.readArray(reader1 -> SecretPermissions.fromString(reader1.getString())); + deserializedPermissions.secrets = secrets; + } else if ("certificates".equals(fieldName)) { + List certificates + = reader.readArray(reader1 -> CertificatePermissions.fromString(reader1.getString())); + deserializedPermissions.certificates = certificates; + } else if ("storage".equals(fieldName)) { + List storage + = reader.readArray(reader1 -> StoragePermissions.fromString(reader1.getString())); + deserializedPermissions.storage = storage; + } else { + reader.skipChildren(); + } + } + + return deserializedPermissions; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/PrivateEndpoint.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/PrivateEndpoint.java new file mode 100644 index 000000000000..fcb6c94948d6 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/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.keyvault.generated.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; + +/** + * Private endpoint object properties. + */ +@Immutable +public final class PrivateEndpoint implements JsonSerializable { + /* + * Full identifier of the private endpoint resource. + */ + private String id; + + /** + * Creates an instance of PrivateEndpoint class. + */ + public PrivateEndpoint() { + } + + /** + * Get the id property: Full identifier of the private endpoint resource. + * + * @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/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/PrivateEndpointConnection.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/PrivateEndpointConnection.java new file mode 100644 index 000000000000..dbcc7e5509a2 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/PrivateEndpointConnection.java @@ -0,0 +1,345 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.keyvault.generated.fluent.models.PrivateEndpointConnectionInner; +import java.util.Map; + +/** + * 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 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 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 privateEndpoint property: Properties of the private endpoint object. + * + * @return the privateEndpoint value. + */ + PrivateEndpoint privateEndpoint(); + + /** + * Gets the privateLinkServiceConnectionState property: Approval state of the private link connection. + * + * @return the privateLinkServiceConnectionState value. + */ + PrivateLinkServiceConnectionState privateLinkServiceConnectionState(); + + /** + * Gets the provisioningState property: Provisioning state of the private endpoint connection. + * + * @return the provisioningState value. + */ + PrivateEndpointConnectionProvisioningState provisioningState(); + + /** + * 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.keyvault.generated.fluent.models.PrivateEndpointConnectionInner object. + * + * @return the inner object. + */ + PrivateEndpointConnectionInner innerModel(); + + /** + * The entirety of the PrivateEndpointConnection definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The PrivateEndpointConnection definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the PrivateEndpointConnection definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the PrivateEndpointConnection 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. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + + /** + * The stage of the PrivateEndpointConnection definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, vaultName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @return the next definition stage. + */ + WithCreate withExistingVault(String resourceGroupName, String vaultName); + } + + /** + * 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.WithTags, DefinitionStages.WithEtag, + DefinitionStages.WithPrivateEndpoint, DefinitionStages.WithPrivateLinkServiceConnectionState { + /** + * 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 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 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); + } + + /** + * The stage of the PrivateEndpointConnection definition allowing to specify privateEndpoint. + */ + interface WithPrivateEndpoint { + /** + * Specifies the privateEndpoint property: Properties of the private endpoint object.. + * + * @param privateEndpoint Properties of the private endpoint object. + * @return the next definition stage. + */ + WithCreate withPrivateEndpoint(PrivateEndpoint privateEndpoint); + } + + /** + * The stage of the PrivateEndpointConnection definition allowing to specify privateLinkServiceConnectionState. + */ + interface WithPrivateLinkServiceConnectionState { + /** + * Specifies the privateLinkServiceConnectionState property: Approval state of the private link connection.. + * + * @param privateLinkServiceConnectionState Approval state of the private link connection. + * @return the next definition stage. + */ + WithCreate withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionState privateLinkServiceConnectionState); + } + } + + /** + * Begins update for the PrivateEndpointConnection resource. + * + * @return the stage of resource update. + */ + PrivateEndpointConnection.Update update(); + + /** + * The template for PrivateEndpointConnection update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithEtag, UpdateStages.WithPrivateEndpoint, + UpdateStages.WithPrivateLinkServiceConnectionState { + /** + * Executes the update request. + * + * @return the updated resource. + */ + PrivateEndpointConnection apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + PrivateEndpointConnection apply(Context context); + } + + /** + * The PrivateEndpointConnection update stages. + */ + interface UpdateStages { + /** + * The stage of the PrivateEndpointConnection update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the PrivateEndpointConnection update 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. + */ + Update withEtag(String etag); + } + + /** + * The stage of the PrivateEndpointConnection update allowing to specify privateEndpoint. + */ + interface WithPrivateEndpoint { + /** + * Specifies the privateEndpoint property: Properties of the private endpoint object.. + * + * @param privateEndpoint Properties of the private endpoint object. + * @return the next definition stage. + */ + Update withPrivateEndpoint(PrivateEndpoint privateEndpoint); + } + + /** + * The stage of the PrivateEndpointConnection update allowing to specify privateLinkServiceConnectionState. + */ + interface WithPrivateLinkServiceConnectionState { + /** + * Specifies the privateLinkServiceConnectionState property: Approval state of the private link connection.. + * + * @param privateLinkServiceConnectionState Approval state of the private link connection. + * @return the next definition stage. + */ + Update withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionState privateLinkServiceConnectionState); + } + } + + /** + * 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/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/PrivateEndpointConnectionItem.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/PrivateEndpointConnectionItem.java new file mode 100644 index 000000000000..c4f65ac516f1 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/PrivateEndpointConnectionItem.java @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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.keyvault.generated.fluent.models.PrivateEndpointConnectionProperties; +import java.io.IOException; + +/** + * Private endpoint connection item. + */ +@Fluent +public final class PrivateEndpointConnectionItem implements JsonSerializable { + /* + * Id of private endpoint connection. + */ + private String id; + + /* + * Modified whenever there is a change in the state of private endpoint connection. + */ + private String etag; + + /* + * Private endpoint connection properties. + */ + private PrivateEndpointConnectionProperties innerProperties; + + /** + * Creates an instance of PrivateEndpointConnectionItem class. + */ + public PrivateEndpointConnectionItem() { + } + + /** + * Get the id property: Id of private endpoint connection. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Id of private endpoint connection. + * + * @param id the id value to set. + * @return the PrivateEndpointConnectionItem object itself. + */ + public PrivateEndpointConnectionItem withId(String id) { + this.id = id; + 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 PrivateEndpointConnectionItem object itself. + */ + public PrivateEndpointConnectionItem withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Get the innerProperties property: Private endpoint connection properties. + * + * @return the innerProperties value. + */ + private PrivateEndpointConnectionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the privateEndpoint property: Properties of the private endpoint object. + * + * @return the privateEndpoint value. + */ + public PrivateEndpoint privateEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().privateEndpoint(); + } + + /** + * Set the privateEndpoint property: Properties of the private endpoint object. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the PrivateEndpointConnectionItem object itself. + */ + public PrivateEndpointConnectionItem withPrivateEndpoint(PrivateEndpoint privateEndpoint) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateEndpointConnectionProperties(); + } + this.innerProperties().withPrivateEndpoint(privateEndpoint); + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: Approval state of the private link connection. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.innerProperties() == null ? null : this.innerProperties().privateLinkServiceConnectionState(); + } + + /** + * Set the privateLinkServiceConnectionState property: Approval state of the private link connection. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionItem object itself. + */ + public PrivateEndpointConnectionItem + withPrivateLinkServiceConnectionState(PrivateLinkServiceConnectionState privateLinkServiceConnectionState) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateEndpointConnectionProperties(); + } + this.innerProperties().withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState); + return this; + } + + /** + * Get the provisioningState property: Provisioning state of the private endpoint connection. + * + * @return the provisioningState value. + */ + public PrivateEndpointConnectionProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("etag", this.etag); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateEndpointConnectionItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateEndpointConnectionItem 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 PrivateEndpointConnectionItem. + */ + public static PrivateEndpointConnectionItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateEndpointConnectionItem deserializedPrivateEndpointConnectionItem + = new PrivateEndpointConnectionItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPrivateEndpointConnectionItem.id = reader.getString(); + } else if ("etag".equals(fieldName)) { + deserializedPrivateEndpointConnectionItem.etag = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedPrivateEndpointConnectionItem.innerProperties + = PrivateEndpointConnectionProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateEndpointConnectionItem; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/PrivateEndpointConnectionListResult.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/PrivateEndpointConnectionListResult.java new file mode 100644 index 000000000000..9ae4b80a7653 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/PrivateEndpointConnectionListResult.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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 com.azure.resourcemanager.keyvault.generated.fluent.models.PrivateEndpointConnectionInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a PrivateEndpointConnection list operation. + */ +@Fluent +public final class PrivateEndpointConnectionListResult + implements JsonSerializable { + /* + * The PrivateEndpointConnection items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of PrivateEndpointConnectionListResult class. + */ + public PrivateEndpointConnectionListResult() { + } + + /** + * Get the value property: The PrivateEndpointConnection items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The PrivateEndpointConnection items on this page. + * + * @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 link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @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) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model PrivateEndpointConnectionListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(PrivateEndpointConnectionListResult.class); + + /** + * {@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 IllegalStateException If the deserialized JSON object was missing any required properties. + * @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/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/PrivateEndpointConnectionProvisioningState.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/PrivateEndpointConnectionProvisioningState.java new file mode 100644 index 000000000000..1ad59a1b226b --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/PrivateEndpointConnectionProvisioningState.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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 Updating for PrivateEndpointConnectionProvisioningState. + */ + public static final PrivateEndpointConnectionProvisioningState UPDATING = fromString("Updating"); + + /** + * 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 Disconnected for PrivateEndpointConnectionProvisioningState. + */ + public static final PrivateEndpointConnectionProvisioningState DISCONNECTED = fromString("Disconnected"); + + /** + * 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/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/PrivateEndpointConnections.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/PrivateEndpointConnections.java new file mode 100644 index 000000000000..7bf2a7a25026 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/PrivateEndpointConnections.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.keyvault.generated.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 PrivateEndpointConnections. + */ +public interface PrivateEndpointConnections { + /** + * The List operation gets information about the private endpoint connections associated with the vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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 response of a PrivateEndpointConnection list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByResource(String resourceGroupName, String vaultName); + + /** + * The List operation gets information about the private endpoint connections associated with the vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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 response of a PrivateEndpointConnection list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByResource(String resourceGroupName, String vaultName, + Context context); + + /** + * Gets the specified private endpoint connection associated with the key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the key vault. + * @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 private endpoint connection associated with the key vault along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String vaultName, + String privateEndpointConnectionName, Context context); + + /** + * Gets the specified private endpoint connection associated with the key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the key vault. + * @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 private endpoint connection associated with the key vault. + */ + PrivateEndpointConnection get(String resourceGroupName, String vaultName, String privateEndpointConnectionName); + + /** + * Deletes the specified private endpoint connection associated with the key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the key vault. + * @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 private endpoint connection resource. + */ + PrivateEndpointConnection delete(String resourceGroupName, String vaultName, String privateEndpointConnectionName); + + /** + * Deletes the specified private endpoint connection associated with the key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param privateEndpointConnectionName Name of the private endpoint connection associated with the key vault. + * @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 private endpoint connection resource. + */ + PrivateEndpointConnection delete(String resourceGroupName, String vaultName, String privateEndpointConnectionName, + Context context); + + /** + * Gets the specified private endpoint connection associated with the key vault. + * + * @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 private endpoint connection associated with the key vault along with {@link Response}. + */ + PrivateEndpointConnection getById(String id); + + /** + * Gets the specified private endpoint connection associated with the key vault. + * + * @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 private endpoint connection associated with the key vault along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the specified private endpoint connection associated with the key vault. + * + * @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 private endpoint connection resource. + */ + PrivateEndpointConnection deleteById(String id); + + /** + * Deletes the specified private endpoint connection associated with the key vault. + * + * @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 private endpoint connection resource. + */ + PrivateEndpointConnection 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/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/PrivateEndpointServiceConnectionStatus.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/PrivateEndpointServiceConnectionStatus.java new file mode 100644 index 000000000000..7758cc40d239 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/PrivateEndpointServiceConnectionStatus.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.keyvault.generated.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"); + + /** + * Static value Disconnected for PrivateEndpointServiceConnectionStatus. + */ + public static final PrivateEndpointServiceConnectionStatus DISCONNECTED = fromString("Disconnected"); + + /** + * 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/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/PrivateLinkResource.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/PrivateLinkResource.java new file mode 100644 index 000000000000..272d1b077593 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/PrivateLinkResource.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.keyvault.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.keyvault.generated.fluent.models.PrivateLinkResourceProperties; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * A private link resource. + */ +@Fluent +public final class PrivateLinkResource extends Resource { + /* + * Resource properties. + */ + private PrivateLinkResourceProperties innerProperties; + + /* + * 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 PrivateLinkResource class. + */ + public PrivateLinkResource() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private PrivateLinkResourceProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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 PrivateLinkResource withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PrivateLinkResource withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the groupId property: Group identifier of private link resource. + * + * @return the groupId value. + */ + public String groupId() { + return this.innerProperties() == null ? null : this.innerProperties().groupId(); + } + + /** + * Get the requiredMembers property: Required member names of private link resource. + * + * @return the requiredMembers value. + */ + public List requiredMembers() { + return this.innerProperties() == null ? null : this.innerProperties().requiredMembers(); + } + + /** + * Get the requiredZoneNames property: Required DNS zone names of the the private link resource. + * + * @return the requiredZoneNames value. + */ + public List requiredZoneNames() { + return this.innerProperties() == null ? null : this.innerProperties().requiredZoneNames(); + } + + /** + * Set the requiredZoneNames property: Required DNS zone names of the the private link resource. + * + * @param requiredZoneNames the requiredZoneNames value to set. + * @return the PrivateLinkResource object itself. + */ + public PrivateLinkResource withRequiredZoneNames(List requiredZoneNames) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateLinkResourceProperties(); + } + this.innerProperties().withRequiredZoneNames(requiredZoneNames); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().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("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateLinkResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateLinkResource 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 PrivateLinkResource. + */ + public static PrivateLinkResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateLinkResource deserializedPrivateLinkResource = new PrivateLinkResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPrivateLinkResource.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedPrivateLinkResource.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedPrivateLinkResource.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedPrivateLinkResource.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedPrivateLinkResource.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedPrivateLinkResource.innerProperties = PrivateLinkResourceProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateLinkResource; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/PrivateLinkResourceListResult.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/PrivateLinkResourceListResult.java new file mode 100644 index 000000000000..e6315297da9c --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/PrivateLinkResourceListResult.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.models; + +import com.azure.resourcemanager.keyvault.generated.fluent.models.PrivateLinkResourceListResultInner; +import java.util.List; + +/** + * An immutable client-side representation of PrivateLinkResourceListResult. + */ +public interface PrivateLinkResourceListResult { + /** + * Gets the value property: Array of private link resources. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.keyvault.generated.fluent.models.PrivateLinkResourceListResultInner + * object. + * + * @return the inner object. + */ + PrivateLinkResourceListResultInner innerModel(); +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/PrivateLinkResources.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/PrivateLinkResources.java new file mode 100644 index 000000000000..c2ae6872af74 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/PrivateLinkResources.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of PrivateLinkResources. + */ +public interface PrivateLinkResources { + /** + * Gets the private link resources supported for the key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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 key vault along with {@link Response}. + */ + Response listByVaultWithResponse(String resourceGroupName, String vaultName, + Context context); + + /** + * Gets the private link resources supported for the key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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 key vault. + */ + PrivateLinkResourceListResult listByVault(String resourceGroupName, String vaultName); +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/PrivateLinkServiceConnectionState.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/PrivateLinkServiceConnectionState.java new file mode 100644 index 000000000000..778d1c7442be --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/PrivateLinkServiceConnectionState.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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; + +/** + * An object that represents the approval state of the private link connection. + */ +@Fluent +public final class PrivateLinkServiceConnectionState implements JsonSerializable { + /* + * Indicates whether the connection has been approved, rejected or removed by the key vault owner. + */ + private PrivateEndpointServiceConnectionStatus status; + + /* + * The reason for approval or rejection. + */ + private String description; + + /* + * A message indicating if changes on the service provider require any updates on the consumer. + */ + private KeyVaultActionsRequiredMessage actionsRequired; + + /** + * Creates an instance of PrivateLinkServiceConnectionState class. + */ + public PrivateLinkServiceConnectionState() { + } + + /** + * Get the status property: Indicates whether the connection has been approved, rejected or removed by the key vault + * owner. + * + * @return the status value. + */ + public PrivateEndpointServiceConnectionStatus status() { + return this.status; + } + + /** + * Set the status property: Indicates whether the connection has been approved, rejected or removed by the key vault + * owner. + * + * @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 or rejection. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The reason for approval or rejection. + * + * @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 KeyVaultActionsRequiredMessage 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(KeyVaultActionsRequiredMessage 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 == null ? null : this.actionsRequired.toString()); + 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 + = KeyVaultActionsRequiredMessage.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateLinkServiceConnectionState; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/PublicNetworkAccess.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/PublicNetworkAccess.java new file mode 100644 index 000000000000..45e27b595381 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/PublicNetworkAccess.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Control permission to the managed HSM from public networks. + */ +public final class PublicNetworkAccess extends ExpandableStringEnum { + /** + * Static value Enabled for PublicNetworkAccess. + */ + public static final PublicNetworkAccess ENABLED = fromString("Enabled"); + + /** + * 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/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/Reason.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/Reason.java new file mode 100644 index 000000000000..8d1ec413f184 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/Reason.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The reason that a managed hsm name could not be used. The reason element is only returned if NameAvailable is false. + */ +public final class Reason extends ExpandableStringEnum { + /** + * Static value AccountNameInvalid for Reason. + */ + public static final Reason ACCOUNT_NAME_INVALID = fromString("AccountNameInvalid"); + + /** + * Static value AlreadyExists for Reason. + */ + public static final Reason ALREADY_EXISTS = fromString("AlreadyExists"); + + /** + * Creates a new instance of Reason value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Reason() { + } + + /** + * Creates or finds a Reason from its string representation. + * + * @param name a name to look for. + * @return the corresponding Reason. + */ + public static Reason fromString(String name) { + return fromString(name, Reason.class); + } + + /** + * Gets known Reason values. + * + * @return known Reason values. + */ + public static Collection values() { + return values(Reason.class); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/Secret.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/Secret.java new file mode 100644 index 000000000000..7c8a0a667ec7 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/Secret.java @@ -0,0 +1,327 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.keyvault.generated.fluent.models.SecretInner; +import java.util.Map; + +/** + * An immutable client-side representation of Secret. + */ +public interface Secret { + /** + * 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 systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the value property: The value of the secret. NOTE: 'value' will never be returned from the service, as APIs + * using this model are is intended for internal use in ARM deployments. Users should use the data-plane REST + * service for interaction with vault secrets. + * + * @return the value value. + */ + String value(); + + /** + * Gets the contentType property: The content type of the secret. + * + * @return the contentType value. + */ + String contentType(); + + /** + * Gets the attributes property: The attributes of the secret. + * + * @return the attributes value. + */ + SecretAttributes attributes(); + + /** + * Gets the secretUri property: The URI to retrieve the current version of the secret. + * + * @return the secretUri value. + */ + String secretUri(); + + /** + * Gets the secretUriWithVersion property: The URI to retrieve the specific version of the secret. + * + * @return the secretUriWithVersion value. + */ + String secretUriWithVersion(); + + /** + * 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.keyvault.generated.fluent.models.SecretInner object. + * + * @return the inner object. + */ + SecretInner innerModel(); + + /** + * The entirety of the Secret definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The Secret definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the Secret definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the Secret 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. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + + /** + * The stage of the Secret definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, vaultName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @return the next definition stage. + */ + WithCreate withExistingVault(String resourceGroupName, String vaultName); + } + + /** + * The stage of the Secret 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.WithValue, + DefinitionStages.WithContentType, DefinitionStages.WithAttributes { + /** + * Executes the create request. + * + * @return the created resource. + */ + Secret create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Secret create(Context context); + } + + /** + * The stage of the Secret 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 Secret definition allowing to specify value. + */ + interface WithValue { + /** + * Specifies the value property: The value of the secret. NOTE: 'value' will never be returned from the + * service, as APIs using this model are is intended for internal use in ARM deployments. Users should use + * the data-plane REST service for interaction with vault secrets.. + * + * @param value The value of the secret. NOTE: 'value' will never be returned from the service, as APIs + * using this model are is intended for internal use in ARM deployments. Users should use the data-plane + * REST service for interaction with vault secrets. + * @return the next definition stage. + */ + WithCreate withValue(String value); + } + + /** + * The stage of the Secret definition allowing to specify contentType. + */ + interface WithContentType { + /** + * Specifies the contentType property: The content type of the secret.. + * + * @param contentType The content type of the secret. + * @return the next definition stage. + */ + WithCreate withContentType(String contentType); + } + + /** + * The stage of the Secret definition allowing to specify attributes. + */ + interface WithAttributes { + /** + * Specifies the attributes property: The attributes of the secret.. + * + * @param attributes The attributes of the secret. + * @return the next definition stage. + */ + WithCreate withAttributes(SecretAttributes attributes); + } + } + + /** + * Begins update for the Secret resource. + * + * @return the stage of resource update. + */ + Secret.Update update(); + + /** + * The template for Secret update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Secret apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Secret apply(Context context); + } + + /** + * The Secret update stages. + */ + interface UpdateStages { + /** + * The stage of the Secret update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: The tags that will be assigned to the secret.. + * + * @param tags The tags that will be assigned to the secret. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the Secret update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: Properties of the secret. + * + * @param properties Properties of the secret. + * @return the next definition stage. + */ + Update withProperties(SecretPatchProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Secret refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Secret refresh(Context context); +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/SecretAttributes.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/SecretAttributes.java new file mode 100644 index 000000000000..cf5c6e8343df --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/SecretAttributes.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; + +/** + * The secret management attributes. + */ +@Fluent +public final class SecretAttributes extends Attributes { + /* + * Last updated time in seconds since 1970-01-01T00:00:00Z. + */ + private Long updated; + + /* + * Creation time in seconds since 1970-01-01T00:00:00Z. + */ + private Long created; + + /** + * Creates an instance of SecretAttributes class. + */ + public SecretAttributes() { + } + + /** + * Get the updated property: Last updated time in seconds since 1970-01-01T00:00:00Z. + * + * @return the updated value. + */ + @Override + public OffsetDateTime updated() { + if (this.updated == null) { + return null; + } + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.updated), ZoneOffset.UTC); + } + + /** + * Get the created property: Creation time in seconds since 1970-01-01T00:00:00Z. + * + * @return the created value. + */ + @Override + public OffsetDateTime created() { + if (this.created == null) { + return null; + } + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.created), ZoneOffset.UTC); + } + + /** + * {@inheritDoc} + */ + @Override + public SecretAttributes withEnabled(Boolean enabled) { + super.withEnabled(enabled); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public SecretAttributes withNbf(OffsetDateTime nbf) { + super.withNbf(nbf); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public SecretAttributes withExp(OffsetDateTime exp) { + super.withExp(exp); + 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.writeBooleanField("enabled", enabled()); + if (nbf() != null) { + jsonWriter.writeNumberField("nbf", nbf().toEpochSecond()); + } + if (exp() != null) { + jsonWriter.writeNumberField("exp", exp().toEpochSecond()); + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecretAttributes from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecretAttributes 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 SecretAttributes. + */ + public static SecretAttributes fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecretAttributes deserializedSecretAttributes = new SecretAttributes(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedSecretAttributes.withEnabled(reader.getNullable(JsonReader::getBoolean)); + } else if ("nbf".equals(fieldName)) { + Long nbfHolder = reader.getNullable(JsonReader::getLong); + if (nbfHolder != null) { + deserializedSecretAttributes + .withNbf(OffsetDateTime.ofInstant(Instant.ofEpochSecond(nbfHolder), ZoneOffset.UTC)); + } + } else if ("exp".equals(fieldName)) { + Long expHolder = reader.getNullable(JsonReader::getLong); + if (expHolder != null) { + deserializedSecretAttributes + .withExp(OffsetDateTime.ofInstant(Instant.ofEpochSecond(expHolder), ZoneOffset.UTC)); + } + } else if ("created".equals(fieldName)) { + deserializedSecretAttributes.created = reader.getNullable(JsonReader::getLong); + } else if ("updated".equals(fieldName)) { + deserializedSecretAttributes.updated = reader.getNullable(JsonReader::getLong); + } else { + reader.skipChildren(); + } + } + + return deserializedSecretAttributes; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/SecretListResult.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/SecretListResult.java new file mode 100644 index 000000000000..f86558b4e733 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/SecretListResult.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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 com.azure.resourcemanager.keyvault.generated.fluent.models.SecretInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a Secret list operation. + */ +@Fluent +public final class SecretListResult implements JsonSerializable { + /* + * The Secret items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of SecretListResult class. + */ + public SecretListResult() { + } + + /** + * Get the value property: The Secret items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The Secret items on this page. + * + * @param value the value value to set. + * @return the SecretListResult object itself. + */ + public SecretListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the SecretListResult object itself. + */ + public SecretListResult 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) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model SecretListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SecretListResult.class); + + /** + * {@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 SecretListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecretListResult 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 SecretListResult. + */ + public static SecretListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecretListResult deserializedSecretListResult = new SecretListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> SecretInner.fromJson(reader1)); + deserializedSecretListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedSecretListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSecretListResult; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/SecretPatchParameters.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/SecretPatchParameters.java new file mode 100644 index 000000000000..e0e80709c262 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/SecretPatchParameters.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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; + +/** + * Parameters for patching a secret. + */ +@Fluent +public final class SecretPatchParameters implements JsonSerializable { + /* + * The tags that will be assigned to the secret. + */ + private Map tags; + + /* + * Properties of the secret + */ + private SecretPatchProperties properties; + + /** + * Creates an instance of SecretPatchParameters class. + */ + public SecretPatchParameters() { + } + + /** + * Get the tags property: The tags that will be assigned to the secret. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: The tags that will be assigned to the secret. + * + * @param tags the tags value to set. + * @return the SecretPatchParameters object itself. + */ + public SecretPatchParameters withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the properties property: Properties of the secret. + * + * @return the properties value. + */ + public SecretPatchProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of the secret. + * + * @param properties the properties value to set. + * @return the SecretPatchParameters object itself. + */ + public SecretPatchParameters withProperties(SecretPatchProperties 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.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecretPatchParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecretPatchParameters 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 SecretPatchParameters. + */ + public static SecretPatchParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecretPatchParameters deserializedSecretPatchParameters = new SecretPatchParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSecretPatchParameters.tags = tags; + } else if ("properties".equals(fieldName)) { + deserializedSecretPatchParameters.properties = SecretPatchProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSecretPatchParameters; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/SecretPatchProperties.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/SecretPatchProperties.java new file mode 100644 index 000000000000..33d363a7e992 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/SecretPatchProperties.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.keyvault.generated.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; + +/** + * Properties of the secret. + */ +@Fluent +public final class SecretPatchProperties implements JsonSerializable { + /* + * The value of the secret. + */ + private String value; + + /* + * The content type of the secret. + */ + private String contentType; + + /* + * The attributes of the secret. + */ + private SecretAttributes attributes; + + /** + * Creates an instance of SecretPatchProperties class. + */ + public SecretPatchProperties() { + } + + /** + * Get the value property: The value of the secret. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The value of the secret. + * + * @param value the value value to set. + * @return the SecretPatchProperties object itself. + */ + public SecretPatchProperties withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the contentType property: The content type of the secret. + * + * @return the contentType value. + */ + public String contentType() { + return this.contentType; + } + + /** + * Set the contentType property: The content type of the secret. + * + * @param contentType the contentType value to set. + * @return the SecretPatchProperties object itself. + */ + public SecretPatchProperties withContentType(String contentType) { + this.contentType = contentType; + return this; + } + + /** + * Get the attributes property: The attributes of the secret. + * + * @return the attributes value. + */ + public SecretAttributes attributes() { + return this.attributes; + } + + /** + * Set the attributes property: The attributes of the secret. + * + * @param attributes the attributes value to set. + * @return the SecretPatchProperties object itself. + */ + public SecretPatchProperties withAttributes(SecretAttributes attributes) { + this.attributes = attributes; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (attributes() != null) { + attributes().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("value", this.value); + jsonWriter.writeStringField("contentType", this.contentType); + jsonWriter.writeJsonField("attributes", this.attributes); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecretPatchProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecretPatchProperties 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 SecretPatchProperties. + */ + public static SecretPatchProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecretPatchProperties deserializedSecretPatchProperties = new SecretPatchProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + deserializedSecretPatchProperties.value = reader.getString(); + } else if ("contentType".equals(fieldName)) { + deserializedSecretPatchProperties.contentType = reader.getString(); + } else if ("attributes".equals(fieldName)) { + deserializedSecretPatchProperties.attributes = SecretAttributes.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSecretPatchProperties; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/SecretPermissions.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/SecretPermissions.java new file mode 100644 index 000000000000..3ad8a06eb311 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/SecretPermissions.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for SecretPermissions. + */ +public final class SecretPermissions extends ExpandableStringEnum { + /** + * Static value all for SecretPermissions. + */ + public static final SecretPermissions ALL = fromString("all"); + + /** + * Static value get for SecretPermissions. + */ + public static final SecretPermissions GET = fromString("get"); + + /** + * Static value list for SecretPermissions. + */ + public static final SecretPermissions LIST = fromString("list"); + + /** + * Static value set for SecretPermissions. + */ + public static final SecretPermissions SET = fromString("set"); + + /** + * Static value delete for SecretPermissions. + */ + public static final SecretPermissions DELETE = fromString("delete"); + + /** + * Static value backup for SecretPermissions. + */ + public static final SecretPermissions BACKUP = fromString("backup"); + + /** + * Static value restore for SecretPermissions. + */ + public static final SecretPermissions RESTORE = fromString("restore"); + + /** + * Static value recover for SecretPermissions. + */ + public static final SecretPermissions RECOVER = fromString("recover"); + + /** + * Static value purge for SecretPermissions. + */ + public static final SecretPermissions PURGE = fromString("purge"); + + /** + * Creates a new instance of SecretPermissions value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SecretPermissions() { + } + + /** + * Creates or finds a SecretPermissions from its string representation. + * + * @param name a name to look for. + * @return the corresponding SecretPermissions. + */ + public static SecretPermissions fromString(String name) { + return fromString(name, SecretPermissions.class); + } + + /** + * Gets known SecretPermissions values. + * + * @return known SecretPermissions values. + */ + public static Collection values() { + return values(SecretPermissions.class); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/Secrets.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/Secrets.java new file mode 100644 index 000000000000..cd061e9babec --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/Secrets.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.keyvault.generated.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 Secrets. + */ +public interface Secrets { + /** + * The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in + * ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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 response of a Secret list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String vaultName); + + /** + * The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in + * ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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. + * @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 response of a Secret list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String vaultName, Integer top, Context context); + + /** + * Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the + * data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param secretName The name of the secret. + * @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 secret along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String vaultName, String secretName, Context context); + + /** + * Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the + * data-plane REST service for interaction with vault secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param secretName The name of the secret. + * @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 secret. + */ + Secret get(String resourceGroupName, String vaultName, String secretName); + + /** + * Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the + * data-plane REST service for interaction with vault secrets. + * + * @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 secret along with {@link Response}. + */ + Secret getById(String id); + + /** + * Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the + * data-plane REST service for interaction with vault secrets. + * + * @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 secret along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Secret resource. + * + * @param name resource name. + * @return the first stage of the new Secret definition. + */ + Secret.DefinitionStages.Blank define(String name); +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/Sku.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/Sku.java new file mode 100644 index 000000000000..407e13c2c7f4 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/Sku.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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; + +/** + * SKU details. + */ +@Fluent +public final class Sku implements JsonSerializable { + /* + * SKU family name + */ + private SkuFamily family; + + /* + * SKU name to specify whether the key vault is a standard vault or a premium vault. + */ + private SkuName name; + + /** + * Creates an instance of Sku class. + */ + public Sku() { + } + + /** + * Get the family property: SKU family name. + * + * @return the family value. + */ + public SkuFamily family() { + return this.family; + } + + /** + * Set the family property: SKU family name. + * + * @param family the family value to set. + * @return the Sku object itself. + */ + public Sku withFamily(SkuFamily family) { + this.family = family; + return this; + } + + /** + * Get the name property: SKU name to specify whether the key vault is a standard vault or a premium vault. + * + * @return the name value. + */ + public SkuName name() { + return this.name; + } + + /** + * Set the name property: SKU name to specify whether the key vault is a standard vault or a premium vault. + * + * @param name the name value to set. + * @return the Sku object itself. + */ + public Sku withName(SkuName name) { + this.name = name; + 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 Sku")); + } + if (name() == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Missing required property name in model Sku")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Sku.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()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Sku from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Sku 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 Sku. + */ + public static Sku fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Sku deserializedSku = new Sku(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("family".equals(fieldName)) { + deserializedSku.family = SkuFamily.fromString(reader.getString()); + } else if ("name".equals(fieldName)) { + deserializedSku.name = SkuName.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedSku; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/SkuFamily.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/SkuFamily.java new file mode 100644 index 000000000000..3afe043dcbc0 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/SkuFamily.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.keyvault.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * SKU family name. + */ +public final class SkuFamily extends ExpandableStringEnum { + /** + * Static value A for SkuFamily. + */ + public static final SkuFamily A = fromString("A"); + + /** + * Creates a new instance of SkuFamily value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SkuFamily() { + } + + /** + * Creates or finds a SkuFamily from its string representation. + * + * @param name a name to look for. + * @return the corresponding SkuFamily. + */ + public static SkuFamily fromString(String name) { + return fromString(name, SkuFamily.class); + } + + /** + * Gets known SkuFamily values. + * + * @return known SkuFamily values. + */ + public static Collection values() { + return values(SkuFamily.class); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/SkuName.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/SkuName.java new file mode 100644 index 000000000000..d0711773875a --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/SkuName.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.keyvault.generated.models; + +/** + * SKU name to specify whether the key vault is a standard vault or a premium vault. + */ +public enum SkuName { + /** + * Enum value standard. + */ + STANDARD("standard"), + + /** + * Enum value premium. + */ + PREMIUM("premium"); + + /** + * The actual serialized value for a SkuName instance. + */ + private final String value; + + SkuName(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SkuName instance. + * + * @param value the serialized value to parse. + * @return the parsed SkuName object, or null if unable to parse. + */ + public static SkuName fromString(String value) { + if (value == null) { + return null; + } + SkuName[] items = SkuName.values(); + for (SkuName item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/StoragePermissions.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/StoragePermissions.java new file mode 100644 index 000000000000..c67d46781bcd --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/StoragePermissions.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for StoragePermissions. + */ +public final class StoragePermissions extends ExpandableStringEnum { + /** + * Static value all for StoragePermissions. + */ + public static final StoragePermissions ALL = fromString("all"); + + /** + * Static value get for StoragePermissions. + */ + public static final StoragePermissions GET = fromString("get"); + + /** + * Static value list for StoragePermissions. + */ + public static final StoragePermissions LIST = fromString("list"); + + /** + * Static value delete for StoragePermissions. + */ + public static final StoragePermissions DELETE = fromString("delete"); + + /** + * Static value set for StoragePermissions. + */ + public static final StoragePermissions SET = fromString("set"); + + /** + * Static value update for StoragePermissions. + */ + public static final StoragePermissions UPDATE = fromString("update"); + + /** + * Static value regeneratekey for StoragePermissions. + */ + public static final StoragePermissions REGENERATEKEY = fromString("regeneratekey"); + + /** + * Static value recover for StoragePermissions. + */ + public static final StoragePermissions RECOVER = fromString("recover"); + + /** + * Static value purge for StoragePermissions. + */ + public static final StoragePermissions PURGE = fromString("purge"); + + /** + * Static value backup for StoragePermissions. + */ + public static final StoragePermissions BACKUP = fromString("backup"); + + /** + * Static value restore for StoragePermissions. + */ + public static final StoragePermissions RESTORE = fromString("restore"); + + /** + * Static value setsas for StoragePermissions. + */ + public static final StoragePermissions SETSAS = fromString("setsas"); + + /** + * Static value listsas for StoragePermissions. + */ + public static final StoragePermissions LISTSAS = fromString("listsas"); + + /** + * Static value getsas for StoragePermissions. + */ + public static final StoragePermissions GETSAS = fromString("getsas"); + + /** + * Static value deletesas for StoragePermissions. + */ + public static final StoragePermissions DELETESAS = fromString("deletesas"); + + /** + * Creates a new instance of StoragePermissions value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public StoragePermissions() { + } + + /** + * Creates or finds a StoragePermissions from its string representation. + * + * @param name a name to look for. + * @return the corresponding StoragePermissions. + */ + public static StoragePermissions fromString(String name) { + return fromString(name, StoragePermissions.class); + } + + /** + * Gets known StoragePermissions values. + * + * @return known StoragePermissions values. + */ + public static Collection values() { + return values(StoragePermissions.class); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/UserAssignedIdentity.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/UserAssignedIdentity.java new file mode 100644 index 000000000000..075e2bbf566a --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/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.keyvault.generated.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/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/Vault.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/Vault.java new file mode 100644 index 000000000000..27383513baa8 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/Vault.java @@ -0,0 +1,633 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.keyvault.generated.fluent.models.VaultInner; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +/** + * An immutable client-side representation of Vault. + */ +public interface Vault { + /** + * 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 systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the tenantId property: The Azure Active Directory tenant ID that should be used for authenticating requests + * to the key vault. + * + * @return the tenantId value. + */ + UUID tenantId(); + + /** + * Gets the sku property: SKU details. + * + * @return the sku value. + */ + Sku sku(); + + /** + * Gets the accessPolicies property: An array of 0 to 1024 identities that have access to the key vault. All + * identities in the array must use the same tenant ID as the key vault's tenant ID. When `createMode` is set to + * `recover`, access policies are not required. Otherwise, access policies are required. + * + * @return the accessPolicies value. + */ + List accessPolicies(); + + /** + * Gets the vaultUri property: The URI of the vault for performing operations on keys and secrets. + * + * @return the vaultUri value. + */ + String vaultUri(); + + /** + * Gets the hsmPoolResourceId property: The resource id of HSM Pool. + * + * @return the hsmPoolResourceId value. + */ + String hsmPoolResourceId(); + + /** + * Gets the enabledForDeployment property: Property to specify whether Azure Virtual Machines are permitted to + * retrieve certificates stored as secrets from the key vault. + * + * @return the enabledForDeployment value. + */ + Boolean enabledForDeployment(); + + /** + * Gets the enabledForDiskEncryption property: Property to specify whether Azure Disk Encryption is permitted to + * retrieve secrets from the vault and unwrap keys. + * + * @return the enabledForDiskEncryption value. + */ + Boolean enabledForDiskEncryption(); + + /** + * Gets the enabledForTemplateDeployment property: Property to specify whether Azure Resource Manager is permitted + * to retrieve secrets from the key vault. + * + * @return the enabledForTemplateDeployment value. + */ + Boolean enabledForTemplateDeployment(); + + /** + * Gets the enableSoftDelete property: Property to specify whether the 'soft delete' functionality is enabled for + * this key vault. If it's not set to any value(true or false) when creating new key vault, it will be set to true + * by default. Once set to true, it cannot be reverted to false. + * + * @return the enableSoftDelete value. + */ + Boolean enableSoftDelete(); + + /** + * Gets the softDeleteRetentionInDays property: softDelete data retention days. It accepts >=7 and <=90. + * + * @return the softDeleteRetentionInDays value. + */ + Integer softDeleteRetentionInDays(); + + /** + * Gets the enableRbacAuthorization property: Property that controls how data actions are authorized. When true, the + * key vault will use Role Based Access Control (RBAC) for authorization of data actions, and the access policies + * specified in vault properties will be ignored. When false, the key vault will use the access policies specified + * in vault properties, and any policy stored on Azure Resource Manager will be ignored. If null or not specified, + * the vault is created with the default value of false. Note that management actions are always authorized with + * RBAC. + * + * @return the enableRbacAuthorization value. + */ + Boolean enableRbacAuthorization(); + + /** + * Gets the createMode property: The vault's create mode to indicate whether the vault need to be recovered or not. + * + * @return the createMode value. + */ + KeyVaultCreateMode createMode(); + + /** + * Gets the enablePurgeProtection property: Property specifying whether protection against purge is enabled for this + * vault. Setting this property to true activates protection against purge for this vault and its content - only the + * Key Vault service may initiate a hard, irrecoverable deletion. The setting is effective only if soft delete is + * also enabled. Enabling this functionality is irreversible - that is, the property does not accept false as its + * value. + * + * @return the enablePurgeProtection value. + */ + Boolean enablePurgeProtection(); + + /** + * Gets the networkAcls property: Rules governing the accessibility of the key vault from specific network + * locations. + * + * @return the networkAcls value. + */ + NetworkRuleSet networkAcls(); + + /** + * Gets the provisioningState property: Provisioning state of the vault. + * + * @return the provisioningState value. + */ + KeyVaultProvisioningState provisioningState(); + + /** + * Gets the privateEndpointConnections property: List of private endpoint connections associated with the key vault. + * + * @return the privateEndpointConnections value. + */ + List privateEndpointConnections(); + + /** + * Gets the publicNetworkAccess property: Property to specify whether the vault will accept traffic from public + * internet. If set to 'disabled' all traffic except private endpoint traffic and that that originates from trusted + * services will be blocked. This will override the set firewall rules, meaning that even if the firewall rules are + * present we will not honor the rules. + * + * @return the publicNetworkAccess value. + */ + String publicNetworkAccess(); + + /** + * 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.keyvault.generated.fluent.models.VaultInner object. + * + * @return the inner object. + */ + VaultInner innerModel(); + + /** + * The entirety of the Vault definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithLocation, DefinitionStages.WithResourceGroup, + DefinitionStages.WithTenantId, DefinitionStages.WithSku, DefinitionStages.WithCreate { + } + + /** + * The Vault definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the Vault definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the Vault 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 Vault 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. + */ + WithTenantId withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the Vault definition allowing to specify tenantId. + */ + interface WithTenantId { + /** + * Specifies the tenantId property: The Azure Active Directory tenant ID that should be used for + * authenticating requests to the key vault.. + * + * @param tenantId The Azure Active Directory tenant ID that should be used for authenticating requests to + * the key vault. + * @return the next definition stage. + */ + WithSku withTenantId(UUID tenantId); + } + + /** + * The stage of the Vault 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 Vault 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.WithAccessPolicies, + DefinitionStages.WithVaultUri, DefinitionStages.WithEnabledForDeployment, + DefinitionStages.WithEnabledForDiskEncryption, DefinitionStages.WithEnabledForTemplateDeployment, + DefinitionStages.WithEnableSoftDelete, DefinitionStages.WithSoftDeleteRetentionInDays, + DefinitionStages.WithEnableRbacAuthorization, DefinitionStages.WithCreateMode, + DefinitionStages.WithEnablePurgeProtection, DefinitionStages.WithNetworkAcls, + DefinitionStages.WithProvisioningState, DefinitionStages.WithPublicNetworkAccess { + /** + * Executes the create request. + * + * @return the created resource. + */ + Vault create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Vault create(Context context); + } + + /** + * The stage of the Vault 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 Vault definition allowing to specify accessPolicies. + */ + interface WithAccessPolicies { + /** + * Specifies the accessPolicies property: An array of 0 to 1024 identities that have access to the key + * vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. When + * `createMode` is set to `recover`, access policies are not required. Otherwise, access policies are + * required.. + * + * @param accessPolicies An array of 0 to 1024 identities that have access to the key vault. All identities + * in the array must use the same tenant ID as the key vault's tenant ID. When `createMode` is set to + * `recover`, access policies are not required. Otherwise, access policies are required. + * @return the next definition stage. + */ + WithCreate withAccessPolicies(List accessPolicies); + } + + /** + * The stage of the Vault definition allowing to specify vaultUri. + */ + interface WithVaultUri { + /** + * Specifies the vaultUri property: The URI of the vault for performing operations on keys and secrets.. + * + * @param vaultUri The URI of the vault for performing operations on keys and secrets. + * @return the next definition stage. + */ + WithCreate withVaultUri(String vaultUri); + } + + /** + * The stage of the Vault definition allowing to specify enabledForDeployment. + */ + interface WithEnabledForDeployment { + /** + * Specifies the enabledForDeployment property: Property to specify whether Azure Virtual Machines are + * permitted to retrieve certificates stored as secrets from the key vault.. + * + * @param enabledForDeployment Property to specify whether Azure Virtual Machines are permitted to retrieve + * certificates stored as secrets from the key vault. + * @return the next definition stage. + */ + WithCreate withEnabledForDeployment(Boolean enabledForDeployment); + } + + /** + * The stage of the Vault definition allowing to specify enabledForDiskEncryption. + */ + interface WithEnabledForDiskEncryption { + /** + * Specifies the enabledForDiskEncryption property: Property to specify whether Azure Disk Encryption is + * permitted to retrieve secrets from the vault and unwrap keys.. + * + * @param enabledForDiskEncryption Property to specify whether Azure Disk Encryption is permitted to + * retrieve secrets from the vault and unwrap keys. + * @return the next definition stage. + */ + WithCreate withEnabledForDiskEncryption(Boolean enabledForDiskEncryption); + } + + /** + * The stage of the Vault definition allowing to specify enabledForTemplateDeployment. + */ + interface WithEnabledForTemplateDeployment { + /** + * Specifies the enabledForTemplateDeployment property: Property to specify whether Azure Resource Manager + * is permitted to retrieve secrets from the key vault.. + * + * @param enabledForTemplateDeployment Property to specify whether Azure Resource Manager is permitted to + * retrieve secrets from the key vault. + * @return the next definition stage. + */ + WithCreate withEnabledForTemplateDeployment(Boolean enabledForTemplateDeployment); + } + + /** + * The stage of the Vault definition allowing to specify enableSoftDelete. + */ + interface WithEnableSoftDelete { + /** + * Specifies the enableSoftDelete property: Property to specify whether the 'soft delete' functionality is + * enabled for this key vault. If it's not set to any value(true or false) when creating new key vault, it + * will be set to true by default. Once set to true, it cannot be reverted to false.. + * + * @param enableSoftDelete Property to specify whether the 'soft delete' functionality is enabled for this + * key vault. If it's not set to any value(true or false) when creating new key vault, it will be set to + * true by default. Once set to true, it cannot be reverted to false. + * @return the next definition stage. + */ + WithCreate withEnableSoftDelete(Boolean enableSoftDelete); + } + + /** + * The stage of the Vault definition allowing to specify softDeleteRetentionInDays. + */ + interface WithSoftDeleteRetentionInDays { + /** + * Specifies the softDeleteRetentionInDays property: softDelete data retention days. It accepts >=7 and + * <=90.. + * + * @param softDeleteRetentionInDays softDelete data retention days. It accepts >=7 and <=90. + * @return the next definition stage. + */ + WithCreate withSoftDeleteRetentionInDays(Integer softDeleteRetentionInDays); + } + + /** + * The stage of the Vault definition allowing to specify enableRbacAuthorization. + */ + interface WithEnableRbacAuthorization { + /** + * Specifies the enableRbacAuthorization property: Property that controls how data actions are authorized. + * When true, the key vault will use Role Based Access Control (RBAC) for authorization of data actions, and + * the access policies specified in vault properties will be ignored. When false, the key vault will use the + * access policies specified in vault properties, and any policy stored on Azure Resource Manager will be + * ignored. If null or not specified, the vault is created with the default value of false. Note that + * management actions are always authorized with RBAC.. + * + * @param enableRbacAuthorization Property that controls how data actions are authorized. When true, the key + * vault will use Role Based Access Control (RBAC) for authorization of data actions, and the access + * policies specified in vault properties will be ignored. When false, the key vault will use the access + * policies specified in vault properties, and any policy stored on Azure Resource Manager will be ignored. + * If null or not specified, the vault is created with the default value of false. Note that management + * actions are always authorized with RBAC. + * @return the next definition stage. + */ + WithCreate withEnableRbacAuthorization(Boolean enableRbacAuthorization); + } + + /** + * The stage of the Vault definition allowing to specify createMode. + */ + interface WithCreateMode { + /** + * Specifies the createMode property: The vault's create mode to indicate whether the vault need to be + * recovered or not.. + * + * @param createMode The vault's create mode to indicate whether the vault need to be recovered or not. + * @return the next definition stage. + */ + WithCreate withCreateMode(KeyVaultCreateMode createMode); + } + + /** + * The stage of the Vault definition allowing to specify enablePurgeProtection. + */ + interface WithEnablePurgeProtection { + /** + * Specifies the enablePurgeProtection property: Property specifying whether protection against purge is + * enabled for this vault. Setting this property to true activates protection against purge for this vault + * and its content - only the Key Vault service may initiate a hard, irrecoverable deletion. The setting is + * effective only if soft delete is also enabled. Enabling this functionality is irreversible - that is, the + * property does not accept false as its value.. + * + * @param enablePurgeProtection Property specifying whether protection against purge is enabled for this + * vault. Setting this property to true activates protection against purge for this vault and its content - + * only the Key Vault service may initiate a hard, irrecoverable deletion. The setting is effective only if + * soft delete is also enabled. Enabling this functionality is irreversible - that is, the property does not + * accept false as its value. + * @return the next definition stage. + */ + WithCreate withEnablePurgeProtection(Boolean enablePurgeProtection); + } + + /** + * The stage of the Vault definition allowing to specify networkAcls. + */ + interface WithNetworkAcls { + /** + * Specifies the networkAcls property: Rules governing the accessibility of the key vault from specific + * network locations.. + * + * @param networkAcls Rules governing the accessibility of the key vault from specific network locations. + * @return the next definition stage. + */ + WithCreate withNetworkAcls(NetworkRuleSet networkAcls); + } + + /** + * The stage of the Vault definition allowing to specify provisioningState. + */ + interface WithProvisioningState { + /** + * Specifies the provisioningState property: Provisioning state of the vault.. + * + * @param provisioningState Provisioning state of the vault. + * @return the next definition stage. + */ + WithCreate withProvisioningState(KeyVaultProvisioningState provisioningState); + } + + /** + * The stage of the Vault definition allowing to specify publicNetworkAccess. + */ + interface WithPublicNetworkAccess { + /** + * Specifies the publicNetworkAccess property: Property to specify whether the vault will accept traffic + * from public internet. If set to 'disabled' all traffic except private endpoint traffic and that that + * originates from trusted services will be blocked. This will override the set firewall rules, meaning that + * even if the firewall rules are present we will not honor the rules.. + * + * @param publicNetworkAccess Property to specify whether the vault will accept traffic from public + * internet. If set to 'disabled' all traffic except private endpoint traffic and that that originates from + * trusted services will be blocked. This will override the set firewall rules, meaning that even if the + * firewall rules are present we will not honor the rules. + * @return the next definition stage. + */ + WithCreate withPublicNetworkAccess(String publicNetworkAccess); + } + } + + /** + * Begins update for the Vault resource. + * + * @return the stage of resource update. + */ + Vault.Update update(); + + /** + * The template for Vault update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Vault apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Vault apply(Context context); + } + + /** + * The Vault update stages. + */ + interface UpdateStages { + /** + * The stage of the Vault update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: The tags that will be assigned to the key vault.. + * + * @param tags The tags that will be assigned to the key vault. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the Vault update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: Properties of the vault. + * + * @param properties Properties of the vault. + * @return the next definition stage. + */ + Update withProperties(VaultPatchProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Vault refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Vault refresh(Context context); +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/VaultAccessPolicyParameters.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/VaultAccessPolicyParameters.java new file mode 100644 index 000000000000..d7de2fe9a9f9 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/VaultAccessPolicyParameters.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.keyvault.generated.models; + +import com.azure.resourcemanager.keyvault.generated.fluent.models.VaultAccessPolicyParametersInner; + +/** + * An immutable client-side representation of VaultAccessPolicyParameters. + */ +public interface VaultAccessPolicyParameters { + /** + * Gets the id property: The resource id of the access policy. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The resource name of the access policy. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The resource name of the access policy. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The resource type of the access policy. + * + * @return the location value. + */ + String location(); + + /** + * Gets the properties property: Properties of the access policy. + * + * @return the properties value. + */ + VaultAccessPolicyProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.keyvault.generated.fluent.models.VaultAccessPolicyParametersInner + * object. + * + * @return the inner object. + */ + VaultAccessPolicyParametersInner innerModel(); +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/VaultAccessPolicyProperties.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/VaultAccessPolicyProperties.java new file mode 100644 index 000000000000..4d64683b0f6a --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/VaultAccessPolicyProperties.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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 vault access policy. + */ +@Fluent +public final class VaultAccessPolicyProperties implements JsonSerializable { + /* + * An array of 0 to 16 identities that have access to the key vault. All identities in the array must use the same + * tenant ID as the key vault's tenant ID. + */ + private List accessPolicies; + + /** + * Creates an instance of VaultAccessPolicyProperties class. + */ + public VaultAccessPolicyProperties() { + } + + /** + * Get the accessPolicies property: An array of 0 to 16 identities that have access to the key vault. All identities + * in the array must use the same tenant ID as the key vault's tenant ID. + * + * @return the accessPolicies value. + */ + public List accessPolicies() { + return this.accessPolicies; + } + + /** + * Set the accessPolicies property: An array of 0 to 16 identities that have access to the key vault. All identities + * in the array must use the same tenant ID as the key vault's tenant ID. + * + * @param accessPolicies the accessPolicies value to set. + * @return the VaultAccessPolicyProperties object itself. + */ + public VaultAccessPolicyProperties withAccessPolicies(List accessPolicies) { + this.accessPolicies = accessPolicies; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (accessPolicies() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property accessPolicies in model VaultAccessPolicyProperties")); + } else { + accessPolicies().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VaultAccessPolicyProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("accessPolicies", this.accessPolicies, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VaultAccessPolicyProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VaultAccessPolicyProperties 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 VaultAccessPolicyProperties. + */ + public static VaultAccessPolicyProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VaultAccessPolicyProperties deserializedVaultAccessPolicyProperties = new VaultAccessPolicyProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("accessPolicies".equals(fieldName)) { + List accessPolicies + = reader.readArray(reader1 -> AccessPolicyEntry.fromJson(reader1)); + deserializedVaultAccessPolicyProperties.accessPolicies = accessPolicies; + } else { + reader.skipChildren(); + } + } + + return deserializedVaultAccessPolicyProperties; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/VaultCheckNameAvailabilityParameters.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/VaultCheckNameAvailabilityParameters.java new file mode 100644 index 000000000000..09b1fecd69a2 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/VaultCheckNameAvailabilityParameters.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.keyvault.generated.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; + +/** + * The parameters used to check the availability of the vault name. + */ +@Fluent +public final class VaultCheckNameAvailabilityParameters + implements JsonSerializable { + /* + * The vault name. + */ + private String name; + + /* + * The type of resource, Microsoft.KeyVault/vaults + */ + private final String type = "Microsoft.KeyVault/vaults"; + + /** + * Creates an instance of VaultCheckNameAvailabilityParameters class. + */ + public VaultCheckNameAvailabilityParameters() { + } + + /** + * Get the name property: The vault name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The vault name. + * + * @param name the name value to set. + * @return the VaultCheckNameAvailabilityParameters object itself. + */ + public VaultCheckNameAvailabilityParameters withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: The type of resource, Microsoft.KeyVault/vaults. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property name in model VaultCheckNameAvailabilityParameters")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VaultCheckNameAvailabilityParameters.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VaultCheckNameAvailabilityParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VaultCheckNameAvailabilityParameters 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 VaultCheckNameAvailabilityParameters. + */ + public static VaultCheckNameAvailabilityParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VaultCheckNameAvailabilityParameters deserializedVaultCheckNameAvailabilityParameters + = new VaultCheckNameAvailabilityParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedVaultCheckNameAvailabilityParameters.name = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedVaultCheckNameAvailabilityParameters; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/VaultListResult.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/VaultListResult.java new file mode 100644 index 000000000000..9415d5202f42 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/VaultListResult.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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 com.azure.resourcemanager.keyvault.generated.fluent.models.VaultInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a Vault list operation. + */ +@Fluent +public final class VaultListResult implements JsonSerializable { + /* + * The Vault items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of VaultListResult class. + */ + public VaultListResult() { + } + + /** + * Get the value property: The Vault items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The Vault items on this page. + * + * @param value the value value to set. + * @return the VaultListResult object itself. + */ + public VaultListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the VaultListResult object itself. + */ + public VaultListResult 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) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model VaultListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VaultListResult.class); + + /** + * {@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 VaultListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VaultListResult 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 VaultListResult. + */ + public static VaultListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VaultListResult deserializedVaultListResult = new VaultListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> VaultInner.fromJson(reader1)); + deserializedVaultListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedVaultListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedVaultListResult; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/VaultPatchParameters.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/VaultPatchParameters.java new file mode 100644 index 000000000000..fed9fb4c171c --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/VaultPatchParameters.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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; + +/** + * Parameters for creating or updating a vault. + */ +@Fluent +public final class VaultPatchParameters implements JsonSerializable { + /* + * The tags that will be assigned to the key vault. + */ + private Map tags; + + /* + * Properties of the vault + */ + private VaultPatchProperties properties; + + /** + * Creates an instance of VaultPatchParameters class. + */ + public VaultPatchParameters() { + } + + /** + * Get the tags property: The tags that will be assigned to the key vault. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: The tags that will be assigned to the key vault. + * + * @param tags the tags value to set. + * @return the VaultPatchParameters object itself. + */ + public VaultPatchParameters withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the properties property: Properties of the vault. + * + * @return the properties value. + */ + public VaultPatchProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of the vault. + * + * @param properties the properties value to set. + * @return the VaultPatchParameters object itself. + */ + public VaultPatchParameters withProperties(VaultPatchProperties 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.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VaultPatchParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VaultPatchParameters 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 VaultPatchParameters. + */ + public static VaultPatchParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VaultPatchParameters deserializedVaultPatchParameters = new VaultPatchParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedVaultPatchParameters.tags = tags; + } else if ("properties".equals(fieldName)) { + deserializedVaultPatchParameters.properties = VaultPatchProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedVaultPatchParameters; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/VaultPatchProperties.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/VaultPatchProperties.java new file mode 100644 index 000000000000..754870e1f97d --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/VaultPatchProperties.java @@ -0,0 +1,497 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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; +import java.util.Objects; +import java.util.UUID; + +/** + * Properties of the vault. + */ +@Fluent +public final class VaultPatchProperties implements JsonSerializable { + /* + * The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault. + */ + private UUID tenantId; + + /* + * SKU details + */ + private Sku sku; + + /* + * An array of 0 to 16 identities that have access to the key vault. All identities in the array must use the same + * tenant ID as the key vault's tenant ID. + */ + private List accessPolicies; + + /* + * Property to specify whether Azure Virtual Machines are permitted to retrieve certificates stored as secrets from + * the key vault. + */ + private Boolean enabledForDeployment; + + /* + * Property to specify whether Azure Disk Encryption is permitted to retrieve secrets from the vault and unwrap + * keys. + */ + private Boolean enabledForDiskEncryption; + + /* + * Property to specify whether Azure Resource Manager is permitted to retrieve secrets from the key vault. + */ + private Boolean enabledForTemplateDeployment; + + /* + * Property to specify whether the 'soft delete' functionality is enabled for this key vault. Once set to true, it + * cannot be reverted to false. + */ + private Boolean enableSoftDelete; + + /* + * Property that controls how data actions are authorized. When true, the key vault will use Role Based Access + * Control (RBAC) for authorization of data actions, and the access policies specified in vault properties will be + * ignored. When false, the key vault will use the access policies specified in vault properties, and any policy + * stored on Azure Resource Manager will be ignored. If null or not specified, the value of this property will not + * change. + */ + private Boolean enableRbacAuthorization; + + /* + * softDelete data retention days. It accepts >=7 and <=90. + */ + private Integer softDeleteRetentionInDays; + + /* + * The vault's create mode to indicate whether the vault need to be recovered or not. + */ + private KeyVaultPatchMode createMode; + + /* + * Property specifying whether protection against purge is enabled for this vault. Setting this property to true + * activates protection against purge for this vault and its content - only the Key Vault service may initiate a + * hard, irrecoverable deletion. The setting is effective only if soft delete is also enabled. Enabling this + * functionality is irreversible - that is, the property does not accept false as its value. + */ + private Boolean enablePurgeProtection; + + /* + * A collection of rules governing the accessibility of the vault from specific network locations. + */ + private NetworkRuleSet networkAcls; + + /* + * Property to specify whether the vault will accept traffic from public internet. If set to 'disabled' all traffic + * except private endpoint traffic and that that originates from trusted services will be blocked. This will + * override the set firewall rules, meaning that even if the firewall rules are present we will not honor the rules. + */ + private String publicNetworkAccess; + + /** + * Creates an instance of VaultPatchProperties class. + */ + public VaultPatchProperties() { + } + + /** + * Get the tenantId property: The Azure Active Directory tenant ID that should be used for authenticating requests + * to the key vault. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: The Azure Active Directory tenant ID that should be used for authenticating requests + * to the key vault. + * + * @param tenantId the tenantId value to set. + * @return the VaultPatchProperties object itself. + */ + public VaultPatchProperties withTenantId(UUID tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the sku property: SKU details. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: SKU details. + * + * @param sku the sku value to set. + * @return the VaultPatchProperties object itself. + */ + public VaultPatchProperties withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the accessPolicies property: An array of 0 to 16 identities that have access to the key vault. All identities + * in the array must use the same tenant ID as the key vault's tenant ID. + * + * @return the accessPolicies value. + */ + public List accessPolicies() { + return this.accessPolicies; + } + + /** + * Set the accessPolicies property: An array of 0 to 16 identities that have access to the key vault. All identities + * in the array must use the same tenant ID as the key vault's tenant ID. + * + * @param accessPolicies the accessPolicies value to set. + * @return the VaultPatchProperties object itself. + */ + public VaultPatchProperties withAccessPolicies(List accessPolicies) { + this.accessPolicies = accessPolicies; + return this; + } + + /** + * Get the enabledForDeployment property: Property to specify whether Azure Virtual Machines are permitted to + * retrieve certificates stored as secrets from the key vault. + * + * @return the enabledForDeployment value. + */ + public Boolean enabledForDeployment() { + return this.enabledForDeployment; + } + + /** + * Set the enabledForDeployment property: Property to specify whether Azure Virtual Machines are permitted to + * retrieve certificates stored as secrets from the key vault. + * + * @param enabledForDeployment the enabledForDeployment value to set. + * @return the VaultPatchProperties object itself. + */ + public VaultPatchProperties withEnabledForDeployment(Boolean enabledForDeployment) { + this.enabledForDeployment = enabledForDeployment; + return this; + } + + /** + * Get the enabledForDiskEncryption property: Property to specify whether Azure Disk Encryption is permitted to + * retrieve secrets from the vault and unwrap keys. + * + * @return the enabledForDiskEncryption value. + */ + public Boolean enabledForDiskEncryption() { + return this.enabledForDiskEncryption; + } + + /** + * Set the enabledForDiskEncryption property: Property to specify whether Azure Disk Encryption is permitted to + * retrieve secrets from the vault and unwrap keys. + * + * @param enabledForDiskEncryption the enabledForDiskEncryption value to set. + * @return the VaultPatchProperties object itself. + */ + public VaultPatchProperties withEnabledForDiskEncryption(Boolean enabledForDiskEncryption) { + this.enabledForDiskEncryption = enabledForDiskEncryption; + return this; + } + + /** + * Get the enabledForTemplateDeployment property: Property to specify whether Azure Resource Manager is permitted to + * retrieve secrets from the key vault. + * + * @return the enabledForTemplateDeployment value. + */ + public Boolean enabledForTemplateDeployment() { + return this.enabledForTemplateDeployment; + } + + /** + * Set the enabledForTemplateDeployment property: Property to specify whether Azure Resource Manager is permitted to + * retrieve secrets from the key vault. + * + * @param enabledForTemplateDeployment the enabledForTemplateDeployment value to set. + * @return the VaultPatchProperties object itself. + */ + public VaultPatchProperties withEnabledForTemplateDeployment(Boolean enabledForTemplateDeployment) { + this.enabledForTemplateDeployment = enabledForTemplateDeployment; + return this; + } + + /** + * Get the enableSoftDelete property: Property to specify whether the 'soft delete' functionality is enabled for + * this key vault. Once set to true, it cannot be reverted to false. + * + * @return the enableSoftDelete value. + */ + public Boolean enableSoftDelete() { + return this.enableSoftDelete; + } + + /** + * Set the enableSoftDelete property: Property to specify whether the 'soft delete' functionality is enabled for + * this key vault. Once set to true, it cannot be reverted to false. + * + * @param enableSoftDelete the enableSoftDelete value to set. + * @return the VaultPatchProperties object itself. + */ + public VaultPatchProperties withEnableSoftDelete(Boolean enableSoftDelete) { + this.enableSoftDelete = enableSoftDelete; + return this; + } + + /** + * Get the enableRbacAuthorization property: Property that controls how data actions are authorized. When true, the + * key vault will use Role Based Access Control (RBAC) for authorization of data actions, and the access policies + * specified in vault properties will be ignored. When false, the key vault will use the access policies specified + * in vault properties, and any policy stored on Azure Resource Manager will be ignored. If null or not specified, + * the value of this property will not change. + * + * @return the enableRbacAuthorization value. + */ + public Boolean enableRbacAuthorization() { + return this.enableRbacAuthorization; + } + + /** + * Set the enableRbacAuthorization property: Property that controls how data actions are authorized. When true, the + * key vault will use Role Based Access Control (RBAC) for authorization of data actions, and the access policies + * specified in vault properties will be ignored. When false, the key vault will use the access policies specified + * in vault properties, and any policy stored on Azure Resource Manager will be ignored. If null or not specified, + * the value of this property will not change. + * + * @param enableRbacAuthorization the enableRbacAuthorization value to set. + * @return the VaultPatchProperties object itself. + */ + public VaultPatchProperties withEnableRbacAuthorization(Boolean enableRbacAuthorization) { + this.enableRbacAuthorization = enableRbacAuthorization; + return this; + } + + /** + * Get the softDeleteRetentionInDays property: softDelete data retention days. It accepts >=7 and <=90. + * + * @return the softDeleteRetentionInDays value. + */ + public Integer softDeleteRetentionInDays() { + return this.softDeleteRetentionInDays; + } + + /** + * Set the softDeleteRetentionInDays property: softDelete data retention days. It accepts >=7 and <=90. + * + * @param softDeleteRetentionInDays the softDeleteRetentionInDays value to set. + * @return the VaultPatchProperties object itself. + */ + public VaultPatchProperties withSoftDeleteRetentionInDays(Integer softDeleteRetentionInDays) { + this.softDeleteRetentionInDays = softDeleteRetentionInDays; + return this; + } + + /** + * Get the createMode property: The vault's create mode to indicate whether the vault need to be recovered or not. + * + * @return the createMode value. + */ + public KeyVaultPatchMode createMode() { + return this.createMode; + } + + /** + * Set the createMode property: The vault's create mode to indicate whether the vault need to be recovered or not. + * + * @param createMode the createMode value to set. + * @return the VaultPatchProperties object itself. + */ + public VaultPatchProperties withCreateMode(KeyVaultPatchMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Get the enablePurgeProtection property: Property specifying whether protection against purge is enabled for this + * vault. Setting this property to true activates protection against purge for this vault and its content - only the + * Key Vault service may initiate a hard, irrecoverable deletion. The setting is effective only if soft delete is + * also enabled. Enabling this functionality is irreversible - that is, the property does not accept false as its + * value. + * + * @return the enablePurgeProtection value. + */ + public Boolean enablePurgeProtection() { + return this.enablePurgeProtection; + } + + /** + * Set the enablePurgeProtection property: Property specifying whether protection against purge is enabled for this + * vault. Setting this property to true activates protection against purge for this vault and its content - only the + * Key Vault service may initiate a hard, irrecoverable deletion. The setting is effective only if soft delete is + * also enabled. Enabling this functionality is irreversible - that is, the property does not accept false as its + * value. + * + * @param enablePurgeProtection the enablePurgeProtection value to set. + * @return the VaultPatchProperties object itself. + */ + public VaultPatchProperties withEnablePurgeProtection(Boolean enablePurgeProtection) { + this.enablePurgeProtection = enablePurgeProtection; + return this; + } + + /** + * Get the networkAcls property: A collection of rules governing the accessibility of the vault from specific + * network locations. + * + * @return the networkAcls value. + */ + public NetworkRuleSet networkAcls() { + return this.networkAcls; + } + + /** + * Set the networkAcls property: A collection of rules governing the accessibility of the vault from specific + * network locations. + * + * @param networkAcls the networkAcls value to set. + * @return the VaultPatchProperties object itself. + */ + public VaultPatchProperties withNetworkAcls(NetworkRuleSet networkAcls) { + this.networkAcls = networkAcls; + return this; + } + + /** + * Get the publicNetworkAccess property: Property to specify whether the vault will accept traffic from public + * internet. If set to 'disabled' all traffic except private endpoint traffic and that that originates from trusted + * services will be blocked. This will override the set firewall rules, meaning that even if the firewall rules are + * present we will not honor the rules. + * + * @return the publicNetworkAccess value. + */ + public String publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * Set the publicNetworkAccess property: Property to specify whether the vault will accept traffic from public + * internet. If set to 'disabled' all traffic except private endpoint traffic and that that originates from trusted + * services will be blocked. This will override the set firewall rules, meaning that even if the firewall rules are + * present we will not honor the rules. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the VaultPatchProperties object itself. + */ + public VaultPatchProperties withPublicNetworkAccess(String publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (accessPolicies() != null) { + accessPolicies().forEach(e -> e.validate()); + } + if (networkAcls() != null) { + networkAcls().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("tenantId", Objects.toString(this.tenantId, null)); + jsonWriter.writeJsonField("sku", this.sku); + jsonWriter.writeArrayField("accessPolicies", this.accessPolicies, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeBooleanField("enabledForDeployment", this.enabledForDeployment); + jsonWriter.writeBooleanField("enabledForDiskEncryption", this.enabledForDiskEncryption); + jsonWriter.writeBooleanField("enabledForTemplateDeployment", this.enabledForTemplateDeployment); + jsonWriter.writeBooleanField("enableSoftDelete", this.enableSoftDelete); + jsonWriter.writeBooleanField("enableRbacAuthorization", this.enableRbacAuthorization); + jsonWriter.writeNumberField("softDeleteRetentionInDays", this.softDeleteRetentionInDays); + jsonWriter.writeStringField("createMode", this.createMode == null ? null : this.createMode.toString()); + jsonWriter.writeBooleanField("enablePurgeProtection", this.enablePurgeProtection); + jsonWriter.writeJsonField("networkAcls", this.networkAcls); + jsonWriter.writeStringField("publicNetworkAccess", this.publicNetworkAccess); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VaultPatchProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VaultPatchProperties 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 VaultPatchProperties. + */ + public static VaultPatchProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VaultPatchProperties deserializedVaultPatchProperties = new VaultPatchProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tenantId".equals(fieldName)) { + deserializedVaultPatchProperties.tenantId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("sku".equals(fieldName)) { + deserializedVaultPatchProperties.sku = Sku.fromJson(reader); + } else if ("accessPolicies".equals(fieldName)) { + List accessPolicies + = reader.readArray(reader1 -> AccessPolicyEntry.fromJson(reader1)); + deserializedVaultPatchProperties.accessPolicies = accessPolicies; + } else if ("enabledForDeployment".equals(fieldName)) { + deserializedVaultPatchProperties.enabledForDeployment = reader.getNullable(JsonReader::getBoolean); + } else if ("enabledForDiskEncryption".equals(fieldName)) { + deserializedVaultPatchProperties.enabledForDiskEncryption + = reader.getNullable(JsonReader::getBoolean); + } else if ("enabledForTemplateDeployment".equals(fieldName)) { + deserializedVaultPatchProperties.enabledForTemplateDeployment + = reader.getNullable(JsonReader::getBoolean); + } else if ("enableSoftDelete".equals(fieldName)) { + deserializedVaultPatchProperties.enableSoftDelete = reader.getNullable(JsonReader::getBoolean); + } else if ("enableRbacAuthorization".equals(fieldName)) { + deserializedVaultPatchProperties.enableRbacAuthorization + = reader.getNullable(JsonReader::getBoolean); + } else if ("softDeleteRetentionInDays".equals(fieldName)) { + deserializedVaultPatchProperties.softDeleteRetentionInDays = reader.getNullable(JsonReader::getInt); + } else if ("createMode".equals(fieldName)) { + deserializedVaultPatchProperties.createMode = KeyVaultPatchMode.fromString(reader.getString()); + } else if ("enablePurgeProtection".equals(fieldName)) { + deserializedVaultPatchProperties.enablePurgeProtection = reader.getNullable(JsonReader::getBoolean); + } else if ("networkAcls".equals(fieldName)) { + deserializedVaultPatchProperties.networkAcls = NetworkRuleSet.fromJson(reader); + } else if ("publicNetworkAccess".equals(fieldName)) { + deserializedVaultPatchProperties.publicNetworkAccess = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedVaultPatchProperties; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/Vaults.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/Vaults.java new file mode 100644 index 000000000000..eb150eb26ac1 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/Vaults.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.keyvault.generated.fluent.models.VaultAccessPolicyParametersInner; + +/** + * Resource collection API of Vaults. + */ +public interface Vaults { + /** + * Checks that the vault name is valid and is not already in use. + * + * @param body The request body. + * @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 CheckNameAvailability operation response along with {@link Response}. + */ + Response checkNameAvailabilityWithResponse(VaultCheckNameAvailabilityParameters body, + Context context); + + /** + * Checks that the vault name is valid and is not already in use. + * + * @param body The request body. + * @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 CheckNameAvailability operation response. + */ + CheckNameAvailabilityResult checkNameAvailability(VaultCheckNameAvailabilityParameters body); + + /** + * Gets information about the deleted vaults in a 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 information about the deleted vaults in a subscription as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Gets information about the deleted vaults in a subscription. + * + * @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 information about the deleted vaults in a subscription as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Gets the deleted Azure key vault. + * + * @param location The name of the Azure region. + * @param vaultName The name of the vault. + * @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 deleted Azure key vault along with {@link Response}. + */ + Response getDeletedWithResponse(String location, String vaultName, Context context); + + /** + * Gets the deleted Azure key vault. + * + * @param location The name of the Azure region. + * @param vaultName The name of the vault. + * @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 deleted Azure key vault. + */ + DeletedVault getDeleted(String location, String vaultName); + + /** + * Permanently deletes the specified vault. aka Purges the deleted Azure key vault. + * + * @param location The name of the Azure region. + * @param vaultName The name of the vault. + * @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 purgeDeleted(String location, String vaultName); + + /** + * Permanently deletes the specified vault. aka Purges the deleted Azure key vault. + * + * @param location The name of the Azure region. + * @param vaultName The name of the vault. + * @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 purgeDeleted(String location, String vaultName, Context context); + + /** + * The List operation gets information about the vaults 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 the response of a Vault list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySubscription(); + + /** + * The List operation gets information about the vaults associated with the subscription. + * + * @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. + * @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 response of a Vault list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySubscription(Integer top, Context context); + + /** + * The List operation gets information about the vaults 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 the response of a Vault list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * The List operation gets information about the vaults associated with the subscription and within the specified + * resource group. + * + * @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. + * @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 response of a Vault list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Integer top, Context context); + + /** + * Gets the specified Azure key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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 Azure key vault along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String vaultName, Context context); + + /** + * Gets the specified Azure key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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 Azure key vault. + */ + Vault getByResourceGroup(String resourceGroupName, String vaultName); + + /** + * Deletes the specified Azure key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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 Response}. + */ + Response deleteByResourceGroupWithResponse(String resourceGroupName, String vaultName, Context context); + + /** + * Deletes the specified Azure key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @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 vaultName); + + /** + * Update access policies in a key vault in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param operationKind Name of the operation. + * @param body Access policy to merge into the vault. + * @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 parameters for updating the access policy in a vault. + */ + Response updateAccessPolicyWithResponse(String resourceGroupName, String vaultName, + AccessPolicyUpdateKind operationKind, VaultAccessPolicyParametersInner body, Context context); + + /** + * Update access policies in a key vault in the specified subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the vault. + * @param operationKind Name of the operation. + * @param body Access policy to merge into the vault. + * @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 parameters for updating the access policy in a vault. + */ + VaultAccessPolicyParameters updateAccessPolicy(String resourceGroupName, String vaultName, + AccessPolicyUpdateKind operationKind, VaultAccessPolicyParametersInner body); + + /** + * Gets the specified Azure key vault. + * + * @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 Azure key vault along with {@link Response}. + */ + Vault getById(String id); + + /** + * Gets the specified Azure key vault. + * + * @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 Azure key vault along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the specified Azure key vault. + * + * @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 Azure key vault. + * + * @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 {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Vault resource. + * + * @param name resource name. + * @return the first stage of the new Vault definition. + */ + Vault.DefinitionStages.Blank define(String name); +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/VaultsUpdateAccessPolicyHeaders.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/VaultsUpdateAccessPolicyHeaders.java new file mode 100644 index 000000000000..eb9ed673bc4d --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/VaultsUpdateAccessPolicyHeaders.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.keyvault.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; + +/** + * The VaultsUpdateAccessPolicyHeaders model. + */ +@Fluent +public final class VaultsUpdateAccessPolicyHeaders { + /* + * The Retry-After property. + */ + private Integer retryAfter; + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of VaultsUpdateAccessPolicyHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public VaultsUpdateAccessPolicyHeaders(HttpHeaders rawHeaders) { + String retryAfter = rawHeaders.getValue(HttpHeaderName.RETRY_AFTER); + if (retryAfter != null) { + this.retryAfter = Integer.parseInt(retryAfter); + } + } + + /** + * Get the retryAfter property: The Retry-After property. + * + * @return the retryAfter value. + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter property: The Retry-After property. + * + * @param retryAfter the retryAfter value to set. + * @return the VaultsUpdateAccessPolicyHeaders object itself. + */ + public VaultsUpdateAccessPolicyHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/VaultsUpdateAccessPolicyResponse.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/VaultsUpdateAccessPolicyResponse.java new file mode 100644 index 000000000000..e5564fa5fe22 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/VaultsUpdateAccessPolicyResponse.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.keyvault.generated.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.keyvault.generated.fluent.models.VaultAccessPolicyParametersInner; + +/** + * Contains all response data for the updateAccessPolicy operation. + */ +public final class VaultsUpdateAccessPolicyResponse + extends ResponseBase { + /** + * Creates an instance of VaultsUpdateAccessPolicyResponse. + * + * @param request the request which resulted in this VaultsUpdateAccessPolicyResponse. + * @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 VaultsUpdateAccessPolicyResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, + VaultAccessPolicyParametersInner value, VaultsUpdateAccessPolicyHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** + * Gets the deserialized response body. + * + * @return the deserialized response body. + */ + @Override + public VaultAccessPolicyParametersInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/VirtualNetworkRule.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/VirtualNetworkRule.java new file mode 100644 index 000000000000..4c476f47570a --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/VirtualNetworkRule.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.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; + +/** + * A rule governing the accessibility of a vault from a specific virtual network. + */ +@Fluent +public final class VirtualNetworkRule implements JsonSerializable { + /* + * Full resource id of a vnet subnet, such as + * '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + */ + private String id; + + /* + * Property to specify whether NRP will ignore the check if parent subnet has serviceEndpoints configured. + */ + private Boolean ignoreMissingVnetServiceEndpoint; + + /** + * Creates an instance of VirtualNetworkRule class. + */ + public VirtualNetworkRule() { + } + + /** + * Get the id property: Full resource id of a vnet subnet, such as + * '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Full resource id of a vnet subnet, such as + * '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + * + * @param id the id value to set. + * @return the VirtualNetworkRule object itself. + */ + public VirtualNetworkRule withId(String id) { + this.id = id; + return this; + } + + /** + * Get the ignoreMissingVnetServiceEndpoint property: Property to specify whether NRP will ignore the check if + * parent subnet has serviceEndpoints configured. + * + * @return the ignoreMissingVnetServiceEndpoint value. + */ + public Boolean ignoreMissingVnetServiceEndpoint() { + return this.ignoreMissingVnetServiceEndpoint; + } + + /** + * Set the ignoreMissingVnetServiceEndpoint property: Property to specify whether NRP will ignore the check if + * parent subnet has serviceEndpoints configured. + * + * @param ignoreMissingVnetServiceEndpoint the ignoreMissingVnetServiceEndpoint value to set. + * @return the VirtualNetworkRule object itself. + */ + public VirtualNetworkRule withIgnoreMissingVnetServiceEndpoint(Boolean ignoreMissingVnetServiceEndpoint) { + this.ignoreMissingVnetServiceEndpoint = ignoreMissingVnetServiceEndpoint; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property id in model VirtualNetworkRule")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VirtualNetworkRule.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeBooleanField("ignoreMissingVnetServiceEndpoint", this.ignoreMissingVnetServiceEndpoint); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualNetworkRule from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualNetworkRule 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 VirtualNetworkRule. + */ + public static VirtualNetworkRule fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualNetworkRule deserializedVirtualNetworkRule = new VirtualNetworkRule(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedVirtualNetworkRule.id = reader.getString(); + } else if ("ignoreMissingVnetServiceEndpoint".equals(fieldName)) { + deserializedVirtualNetworkRule.ignoreMissingVnetServiceEndpoint + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualNetworkRule; + }); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/package-info.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/package-info.java new file mode 100644 index 000000000000..d68ab46a51b6 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the data models for AzureStorageResourceManagementApi. + * The Azure management API provides a RESTful set of web services that interact with Azure Key Vault. + */ +package com.azure.resourcemanager.keyvault.generated.models; diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/package-info.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/package-info.java new file mode 100644 index 000000000000..6d247c067aeb --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/com/azure/resourcemanager/keyvault/generated/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the classes for AzureStorageResourceManagementApi. + * The Azure management API provides a RESTful set of web services that interact with Azure Key Vault. + */ +package com.azure.resourcemanager.keyvault.generated; diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/module-info.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/module-info.java new file mode 100644 index 000000000000..0d8fff063731 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/java/module-info.java @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.keyvault.generated { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.keyvault.generated; + exports com.azure.resourcemanager.keyvault.generated.fluent; + exports com.azure.resourcemanager.keyvault.generated.fluent.models; + exports com.azure.resourcemanager.keyvault.generated.models; + + opens com.azure.resourcemanager.keyvault.generated.fluent.models to com.azure.core; + opens com.azure.resourcemanager.keyvault.generated.models to com.azure.core; +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-keyvault-generated/proxy-config.json b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-keyvault-generated/proxy-config.json new file mode 100644 index 000000000000..efab88012658 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-keyvault-generated/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.keyvault.generated.implementation.ManagedHsmsClientImpl$ManagedHsmsService"],["com.azure.resourcemanager.keyvault.generated.implementation.MhsmPrivateEndpointConnectionsClientImpl$MhsmPrivateEndpointConnectionsService"],["com.azure.resourcemanager.keyvault.generated.implementation.MhsmPrivateLinkResourcesClientImpl$MhsmPrivateLinkResourcesService"],["com.azure.resourcemanager.keyvault.generated.implementation.MhsmRegionsClientImpl$MhsmRegionsService"],["com.azure.resourcemanager.keyvault.generated.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.keyvault.generated.implementation.PrivateEndpointConnectionsClientImpl$PrivateEndpointConnectionsService"],["com.azure.resourcemanager.keyvault.generated.implementation.PrivateLinkResourcesClientImpl$PrivateLinkResourcesService"],["com.azure.resourcemanager.keyvault.generated.implementation.SecretsClientImpl$SecretsService"],["com.azure.resourcemanager.keyvault.generated.implementation.VaultsClientImpl$VaultsService"]] \ No newline at end of file diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-keyvault-generated/reflect-config.json b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-keyvault-generated/reflect-config.json new file mode 100644 index 000000000000..0637a088a01e --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-keyvault-generated/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/resources/azure-resourcemanager-keyvault-generated.properties b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/resources/azure-resourcemanager-keyvault-generated.properties new file mode 100644 index 000000000000..defbd48204e4 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/main/resources/azure-resourcemanager-keyvault-generated.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/ManagedHsmsCheckMhsmNameAvailabilitySamples.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/ManagedHsmsCheckMhsmNameAvailabilitySamples.java new file mode 100644 index 000000000000..9a7cd9cc3273 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/ManagedHsmsCheckMhsmNameAvailabilitySamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.generated; + +/** + * Samples for ManagedHsms CheckMhsmNameAvailability. + */ +public final class ManagedHsmsCheckMhsmNameAvailabilitySamples { + /* + * x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/ + * ManagedHsm_checkMhsmNameAvailability.json + */ + /** + * Sample code: Validate a managed hsm name. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void validateAManagedHsmName(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.managedHsms().checkMhsmNameAvailabilityWithResponse(null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/ManagedHsmsCreateOrUpdateSamples.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/ManagedHsmsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..41f601596d0d --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/ManagedHsmsCreateOrUpdateSamples.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.keyvault.generated.generated; + +/** + * Samples for ManagedHsms CreateOrUpdate. + */ +public final class ManagedHsmsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/ManagedHsm_CreateOrUpdate. + * json + */ + /** + * Sample code: Create a new managed HSM Pool or update an existing managed HSM Pool. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void createANewManagedHSMPoolOrUpdateAnExistingManagedHSMPool( + com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.managedHsms().define("hsm1").withRegion((String) null).withExistingResourceGroup("hsm-group").create(); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/ManagedHsmsDeleteSamples.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/ManagedHsmsDeleteSamples.java new file mode 100644 index 000000000000..819894df7198 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/ManagedHsmsDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.generated; + +/** + * Samples for ManagedHsms Delete. + */ +public final class ManagedHsmsDeleteSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/ManagedHsm_Delete.json + */ + /** + * Sample code: Delete a managed HSM Pool. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void deleteAManagedHSMPool(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.managedHsms().delete("hsm-group", "hsm1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/ManagedHsmsGetByResourceGroupSamples.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/ManagedHsmsGetByResourceGroupSamples.java new file mode 100644 index 000000000000..0608931d427a --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/ManagedHsmsGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.generated; + +/** + * Samples for ManagedHsms GetByResourceGroup. + */ +public final class ManagedHsmsGetByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/ManagedHsm_Get.json + */ + /** + * Sample code: Retrieve a managed HSM Pool. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void retrieveAManagedHSMPool(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.managedHsms().getByResourceGroupWithResponse("hsm-group", "hsm1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/ManagedHsmsGetDeletedSamples.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/ManagedHsmsGetDeletedSamples.java new file mode 100644 index 000000000000..375fec5c0d52 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/ManagedHsmsGetDeletedSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.generated; + +/** + * Samples for ManagedHsms GetDeleted. + */ +public final class ManagedHsmsGetDeletedSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/DeletedManagedHsm_Get.json + */ + /** + * Sample code: Retrieve a deleted managed HSM. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void + retrieveADeletedManagedHSM(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.managedHsms().getDeletedWithResponse("westus", "hsm1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/ManagedHsmsListByResourceGroupSamples.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/ManagedHsmsListByResourceGroupSamples.java new file mode 100644 index 000000000000..630e84bd6e70 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/ManagedHsmsListByResourceGroupSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.generated; + +/** + * Samples for ManagedHsms ListByResourceGroup. + */ +public final class ManagedHsmsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/ + * ManagedHsm_ListByResourceGroup.json + */ + /** + * Sample code: List managed HSM Pools in a resource group. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void + listManagedHSMPoolsInAResourceGroup(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.managedHsms().listByResourceGroup("hsm-group", null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/ManagedHsmsListBySubscriptionSamples.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/ManagedHsmsListBySubscriptionSamples.java new file mode 100644 index 000000000000..5306632be3f5 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/ManagedHsmsListBySubscriptionSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.generated; + +/** + * Samples for ManagedHsms ListBySubscription. + */ +public final class ManagedHsmsListBySubscriptionSamples { + /* + * x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/ + * ManagedHsm_ListBySubscription.json + */ + /** + * Sample code: List managed HSM Pools in a subscription. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void + listManagedHSMPoolsInASubscription(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.managedHsms().listBySubscription(null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/ManagedHsmsListSamples.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/ManagedHsmsListSamples.java new file mode 100644 index 000000000000..e83509d08d30 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/ManagedHsmsListSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.generated; + +/** + * Samples for ManagedHsms List. + */ +public final class ManagedHsmsListSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/DeletedManagedHsm_List.json + */ + /** + * Sample code: List deleted managed HSMs in the specified subscription. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void listDeletedManagedHSMsInTheSpecifiedSubscription( + com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.managedHsms().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/ManagedHsmsPurgeDeletedSamples.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/ManagedHsmsPurgeDeletedSamples.java new file mode 100644 index 000000000000..f9605f646eb2 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/ManagedHsmsPurgeDeletedSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.generated; + +/** + * Samples for ManagedHsms PurgeDeleted. + */ +public final class ManagedHsmsPurgeDeletedSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/DeletedManagedHsm_Purge. + * json + */ + /** + * Sample code: Purge a managed HSM Pool. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void purgeAManagedHSMPool(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.managedHsms().purgeDeleted("westus", "hsm1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/ManagedHsmsUpdateSamples.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/ManagedHsmsUpdateSamples.java new file mode 100644 index 000000000000..666edf3fecfc --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/ManagedHsmsUpdateSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.generated; + +import com.azure.resourcemanager.keyvault.generated.models.ManagedHsm; + +/** + * Samples for ManagedHsms Update. + */ +public final class ManagedHsmsUpdateSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/ManagedHsm_Update.json + */ + /** + * Sample code: Update an existing managed HSM Pool. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void + updateAnExistingManagedHSMPool(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + ManagedHsm resource = manager.managedHsms() + .getByResourceGroupWithResponse("hsm-group", "hsm1", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().apply(); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/MhsmPrivateEndpointConnectionsDeleteSamples.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/MhsmPrivateEndpointConnectionsDeleteSamples.java new file mode 100644 index 000000000000..d9b813edb031 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/MhsmPrivateEndpointConnectionsDeleteSamples.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.keyvault.generated.generated; + +/** + * Samples for MhsmPrivateEndpointConnections Delete. + */ +public final class MhsmPrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/ + * ManagedHsm_deletePrivateEndpointConnection.json + */ + /** + * Sample code: ManagedHsmDeletePrivateEndpointConnection. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void managedHsmDeletePrivateEndpointConnection( + com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.mhsmPrivateEndpointConnections() + .delete("sample-group", "sample-mhsm", "sample-pec", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/MhsmPrivateEndpointConnectionsGetSamples.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/MhsmPrivateEndpointConnectionsGetSamples.java new file mode 100644 index 000000000000..bf89b2abfb5a --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/MhsmPrivateEndpointConnectionsGetSamples.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.keyvault.generated.generated; + +/** + * Samples for MhsmPrivateEndpointConnections Get. + */ +public final class MhsmPrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/ + * ManagedHsm_getPrivateEndpointConnection.json + */ + /** + * Sample code: ManagedHsmGetPrivateEndpointConnection. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void + managedHsmGetPrivateEndpointConnection(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.mhsmPrivateEndpointConnections() + .getWithResponse("sample-group", "sample-mhsm", "sample-pec", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/MhsmPrivateEndpointConnectionsListByResourceSamples.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/MhsmPrivateEndpointConnectionsListByResourceSamples.java new file mode 100644 index 000000000000..b042bf9d1870 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/MhsmPrivateEndpointConnectionsListByResourceSamples.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.keyvault.generated.generated; + +/** + * Samples for MhsmPrivateEndpointConnections ListByResource. + */ +public final class MhsmPrivateEndpointConnectionsListByResourceSamples { + /* + * x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/ + * ManagedHsm_ListPrivateEndpointConnectionsByResource.json + */ + /** + * Sample code: List managed HSM Pools in a subscription. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void + listManagedHSMPoolsInASubscription(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.mhsmPrivateEndpointConnections() + .listByResource("sample-group", "sample-mhsm", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/MhsmPrivateEndpointConnectionsPutSamples.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/MhsmPrivateEndpointConnectionsPutSamples.java new file mode 100644 index 000000000000..7ed49a52694f --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/MhsmPrivateEndpointConnectionsPutSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.generated; + +/** + * Samples for MhsmPrivateEndpointConnections Put. + */ +public final class MhsmPrivateEndpointConnectionsPutSamples { + /* + * x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/ + * ManagedHsm_putPrivateEndpointConnection.json + */ + /** + * Sample code: ManagedHsmPutPrivateEndpointConnection. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void + managedHsmPutPrivateEndpointConnection(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.mhsmPrivateEndpointConnections() + .define("sample-pec") + .withRegion((String) null) + .withExistingManagedHSM("sample-group", "sample-mhsm") + .create(); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/MhsmPrivateLinkResourcesListByMhsmResourceSamples.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/MhsmPrivateLinkResourcesListByMhsmResourceSamples.java new file mode 100644 index 000000000000..e89b6e597654 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/MhsmPrivateLinkResourcesListByMhsmResourceSamples.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.keyvault.generated.generated; + +/** + * Samples for MhsmPrivateLinkResources ListByMhsmResource. + */ +public final class MhsmPrivateLinkResourcesListByMhsmResourceSamples { + /* + * x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/ + * ManagedHsm_listPrivateLinkResources.json + */ + /** + * Sample code: KeyVaultListPrivateLinkResources. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void + keyVaultListPrivateLinkResources(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.mhsmPrivateLinkResources() + .listByMhsmResourceWithResponse("sample-group", "sample-mhsm", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/MhsmRegionsListByResourceSamples.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/MhsmRegionsListByResourceSamples.java new file mode 100644 index 000000000000..c3de7fa78f76 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/MhsmRegionsListByResourceSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.generated; + +/** + * Samples for MhsmRegions ListByResource. + */ +public final class MhsmRegionsListByResourceSamples { + /* + * x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/ + * ManagedHsm_ListRegionsByResource.json + */ + /** + * Sample code: List managed HSM Pools in a subscription. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void + listManagedHSMPoolsInASubscription(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.mhsmRegions().listByResource("sample-group", "sample-mhsm", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/PrivateEndpointConnectionsDeleteSamples.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/PrivateEndpointConnectionsDeleteSamples.java new file mode 100644 index 000000000000..b37255aeccef --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/PrivateEndpointConnectionsDeleteSamples.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.keyvault.generated.generated; + +/** + * Samples for PrivateEndpointConnections Delete. + */ +public final class PrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/ + * deletePrivateEndpointConnection.json + */ + /** + * Sample code: KeyVaultDeletePrivateEndpointConnection. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void + keyVaultDeletePrivateEndpointConnection(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.privateEndpointConnections() + .delete("sample-group", "sample-vault", "sample-pec", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/PrivateEndpointConnectionsGetSamples.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/PrivateEndpointConnectionsGetSamples.java new file mode 100644 index 000000000000..7bf1086f0a3f --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/PrivateEndpointConnectionsGetSamples.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.keyvault.generated.generated; + +/** + * Samples for PrivateEndpointConnections Get. + */ +public final class PrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/ + * getPrivateEndpointConnection.json + */ + /** + * Sample code: KeyVaultGetPrivateEndpointConnection. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void + keyVaultGetPrivateEndpointConnection(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.privateEndpointConnections() + .getWithResponse("sample-group", "sample-vault", "sample-pec", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/PrivateEndpointConnectionsListByResourceSamples.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/PrivateEndpointConnectionsListByResourceSamples.java new file mode 100644 index 000000000000..c3cbd8f101d3 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/PrivateEndpointConnectionsListByResourceSamples.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.keyvault.generated.generated; + +/** + * Samples for PrivateEndpointConnections ListByResource. + */ +public final class PrivateEndpointConnectionsListByResourceSamples { + /* + * x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/ + * listPrivateEndpointConnection.json + */ + /** + * Sample code: KeyVaultListPrivateEndpointConnection. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void + keyVaultListPrivateEndpointConnection(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.privateEndpointConnections() + .listByResource("sample-group", "sample-vault", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/PrivateEndpointConnectionsPutSamples.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/PrivateEndpointConnectionsPutSamples.java new file mode 100644 index 000000000000..060a2fb9866b --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/PrivateEndpointConnectionsPutSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.generated; + +/** + * Samples for PrivateEndpointConnections Put. + */ +public final class PrivateEndpointConnectionsPutSamples { + /* + * x-ms-original-file: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/ + * putPrivateEndpointConnection.json + */ + /** + * Sample code: KeyVaultPutPrivateEndpointConnection. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void + keyVaultPutPrivateEndpointConnection(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.privateEndpointConnections() + .define("sample-pec") + .withRegion((String) null) + .withExistingVault("sample-group", "sample-vault") + .create(); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/PrivateLinkResourcesListByVaultSamples.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/PrivateLinkResourcesListByVaultSamples.java new file mode 100644 index 000000000000..bdb168d289e5 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/PrivateLinkResourcesListByVaultSamples.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.keyvault.generated.generated; + +/** + * Samples for PrivateLinkResources ListByVault. + */ +public final class PrivateLinkResourcesListByVaultSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/listPrivateLinkResources. + * json + */ + /** + * Sample code: KeyVaultListPrivateLinkResources. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void + keyVaultListPrivateLinkResources(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.privateLinkResources() + .listByVaultWithResponse("sample-group", "sample-vault", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/SecretsCreateOrUpdateSamples.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/SecretsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..75914659d781 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/SecretsCreateOrUpdateSamples.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.keyvault.generated.generated; + +/** + * Samples for Secrets CreateOrUpdate. + */ +public final class SecretsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/createSecret.json + */ + /** + * Sample code: Create a secret. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void createASecret(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.secrets() + .define("secret-name") + .withRegion((String) null) + .withExistingVault("sample-group", "sample-vault") + .create(); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/SecretsGetSamples.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/SecretsGetSamples.java new file mode 100644 index 000000000000..c1bfdfa78deb --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/SecretsGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.generated; + +/** + * Samples for Secrets Get. + */ +public final class SecretsGetSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/getSecret.json + */ + /** + * Sample code: Get a secret. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void getASecret(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.secrets() + .getWithResponse("sample-group", "sample-vault", "secret-name", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/SecretsListSamples.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/SecretsListSamples.java new file mode 100644 index 000000000000..5555436748cb --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/SecretsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.generated; + +/** + * Samples for Secrets List. + */ +public final class SecretsListSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/listSecrets.json + */ + /** + * Sample code: List secrets in the vault. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void listSecretsInTheVault(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.secrets().list("sample-group", "sample-vault", null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/SecretsUpdateSamples.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/SecretsUpdateSamples.java new file mode 100644 index 000000000000..c3cd6f8d06d8 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/SecretsUpdateSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.generated; + +import com.azure.resourcemanager.keyvault.generated.models.Secret; + +/** + * Samples for Secrets Update. + */ +public final class SecretsUpdateSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/updateSecret.json + */ + /** + * Sample code: Update a secret. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void updateASecret(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + Secret resource = manager.secrets() + .getWithResponse("sample-group", "sample-vault", "secret-name", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().apply(); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/VaultsCheckNameAvailabilitySamples.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/VaultsCheckNameAvailabilitySamples.java new file mode 100644 index 000000000000..1f92cf719dd6 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/VaultsCheckNameAvailabilitySamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.generated; + +/** + * Samples for Vaults CheckNameAvailability. + */ +public final class VaultsCheckNameAvailabilitySamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/checkVaultNameAvailability. + * json + */ + /** + * Sample code: Validate a vault name. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void validateAVaultName(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.vaults().checkNameAvailabilityWithResponse(null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/VaultsCreateOrUpdateSamples.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/VaultsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..2857456354c4 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/VaultsCreateOrUpdateSamples.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.generated; + +import com.azure.resourcemanager.keyvault.generated.models.Sku; +import java.util.UUID; + +/** + * Samples for Vaults CreateOrUpdate. + */ +public final class VaultsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/createVaultWithNetworkAcls. + * json + */ + /** + * Sample code: Create or update a vault with network acls. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void + createOrUpdateAVaultWithNetworkAcls(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.vaults() + .define("sample-vault") + .withRegion((String) null) + .withExistingResourceGroup("sample-resource-group") + .withTenantId((UUID) null) + .withSku((Sku) null) + .create(); + } + + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/createVault.json + */ + /** + * Sample code: Create a new vault or update an existing vault. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void + createANewVaultOrUpdateAnExistingVault(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.vaults() + .define("sample-vault") + .withRegion((String) null) + .withExistingResourceGroup("sample-resource-group") + .withTenantId((UUID) null) + .withSku((Sku) null) + .create(); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/VaultsDeleteSamples.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/VaultsDeleteSamples.java new file mode 100644 index 000000000000..69391b2d8e09 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/VaultsDeleteSamples.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.keyvault.generated.generated; + +/** + * Samples for Vaults Delete. + */ +public final class VaultsDeleteSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/deleteVault.json + */ + /** + * Sample code: Delete a vault. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void deleteAVault(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.vaults() + .deleteByResourceGroupWithResponse("sample-resource-group", "sample-vault", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/VaultsGetByResourceGroupSamples.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/VaultsGetByResourceGroupSamples.java new file mode 100644 index 000000000000..56eecfb11e73 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/VaultsGetByResourceGroupSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.generated; + +/** + * Samples for Vaults GetByResourceGroup. + */ +public final class VaultsGetByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/getVault.json + */ + /** + * Sample code: Retrieve a vault. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void retrieveAVault(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.vaults() + .getByResourceGroupWithResponse("sample-resource-group", "sample-vault", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/VaultsGetDeletedSamples.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/VaultsGetDeletedSamples.java new file mode 100644 index 000000000000..4be54fc1ac3d --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/VaultsGetDeletedSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.generated; + +/** + * Samples for Vaults GetDeleted. + */ +public final class VaultsGetDeletedSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/getDeletedVault.json + */ + /** + * Sample code: Retrieve a deleted vault. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void retrieveADeletedVault(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.vaults().getDeletedWithResponse("westus", "sample-vault", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/VaultsListByResourceGroupSamples.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/VaultsListByResourceGroupSamples.java new file mode 100644 index 000000000000..d53bd10f2827 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/VaultsListByResourceGroupSamples.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.keyvault.generated.generated; + +/** + * Samples for Vaults ListByResourceGroup. + */ +public final class VaultsListByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/listVaultByResourceGroup. + * json + */ + /** + * Sample code: List vaults in the specified resource group. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void + listVaultsInTheSpecifiedResourceGroup(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.vaults().listByResourceGroup("sample-group", 1, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/VaultsListBySubscriptionSamples.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/VaultsListBySubscriptionSamples.java new file mode 100644 index 000000000000..71157acbf543 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/VaultsListBySubscriptionSamples.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.keyvault.generated.generated; + +/** + * Samples for Vaults ListBySubscription. + */ +public final class VaultsListBySubscriptionSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/listVaultBySubscription. + * json + */ + /** + * Sample code: List vaults in the specified subscription. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void + listVaultsInTheSpecifiedSubscription(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.vaults().listBySubscription(1, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/VaultsListSamples.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/VaultsListSamples.java new file mode 100644 index 000000000000..4309f4a1d312 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/VaultsListSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.generated; + +/** + * Samples for Vaults List. + */ +public final class VaultsListSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/listDeletedVaults.json + */ + /** + * Sample code: List deleted vaults in the specified subscription. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void listDeletedVaultsInTheSpecifiedSubscription( + com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.vaults().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/VaultsPurgeDeletedSamples.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/VaultsPurgeDeletedSamples.java new file mode 100644 index 000000000000..42ab29e79aa7 --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/VaultsPurgeDeletedSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.generated; + +/** + * Samples for Vaults PurgeDeleted. + */ +public final class VaultsPurgeDeletedSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/purgeDeletedVault.json + */ + /** + * Sample code: Purge a deleted vault. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void purgeADeletedVault(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.vaults().purgeDeleted("westus", "sample-vault", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/VaultsUpdateAccessPolicySamples.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/VaultsUpdateAccessPolicySamples.java new file mode 100644 index 000000000000..4b65d9b041bd --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/VaultsUpdateAccessPolicySamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.generated; + +import com.azure.resourcemanager.keyvault.generated.models.AccessPolicyUpdateKind; + +/** + * Samples for Vaults UpdateAccessPolicy. + */ +public final class VaultsUpdateAccessPolicySamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/updateAccessPoliciesAdd. + * json + */ + /** + * Sample code: Add an access policy, or update an access policy with new permissions. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void addAnAccessPolicyOrUpdateAnAccessPolicyWithNewPermissions( + com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + manager.vaults() + .updateAccessPolicyWithResponse("sample-group", "sample-vault", AccessPolicyUpdateKind.ADD, null, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/VaultsUpdateSamples.java b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/VaultsUpdateSamples.java new file mode 100644 index 000000000000..384cd95f03ee --- /dev/null +++ b/sdk/keyvault/azure-resourcemanager-keyvault-generated/src/samples/java/com/azure/resourcemanager/keyvault/generated/generated/VaultsUpdateSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.keyvault.generated.generated; + +import com.azure.resourcemanager.keyvault.generated.models.Vault; + +/** + * Samples for Vaults Update. + */ +public final class VaultsUpdateSamples { + /* + * x-ms-original-file: + * specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2024-11-01/examples/updateVault.json + */ + /** + * Sample code: Update an existing vault. + * + * @param manager Entry point to KeyvaultManager. + */ + public static void updateAnExistingVault(com.azure.resourcemanager.keyvault.generated.KeyvaultManager manager) { + Vault resource = manager.vaults() + .getByResourceGroupWithResponse("sample-resource-group", "sample-vault", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().apply(); + } +} diff --git a/sdk/keyvault/ci.yml b/sdk/keyvault/ci.yml index 8aa3060f9fa1..675a02d2de33 100644 --- a/sdk/keyvault/ci.yml +++ b/sdk/keyvault/ci.yml @@ -54,33 +54,36 @@ pr: - sdk/keyvault/azure-security-test-keyvault-jca/pom.xml parameters: -- name: release_azuresecuritykeyvaultadministration - displayName: 'azure-security-keyvault-administration' - type: boolean - default: true -- name: release_azuresecuritykeyvaultcertificates - displayName: 'azure-security-keyvault-certificates' - type: boolean - default: true -- name: release_azuresecuritykeyvaultjca - displayName: 'azure-security-keyvault-jca' - type: boolean - default: true -- name: release_azuresecuritykeyvaultkeys - displayName: 'azure-security-keyvault-keys' - type: boolean - default: true -- name: release_azuresecuritykeyvaultsecrets - displayName: 'azure-security-keyvault-secrets' - type: boolean - default: true - + - name: release_azuresecuritykeyvaultadministration + displayName: azure-security-keyvault-administration + type: boolean + default: true + - name: release_azuresecuritykeyvaultcertificates + displayName: azure-security-keyvault-certificates + type: boolean + default: true + - name: release_azuresecuritykeyvaultjca + displayName: azure-security-keyvault-jca + type: boolean + default: true + - name: release_azuresecuritykeyvaultkeys + displayName: azure-security-keyvault-keys + type: boolean + default: true + - name: release_azuresecuritykeyvaultsecrets + displayName: azure-security-keyvault-secrets + type: boolean + default: true + - name: release_azureresourcemanagerkeyvaultgenerated + displayName: azure-resourcemanager-keyvault-generated + type: boolean + default: false extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: ServiceDirectory: keyvault - AdditionalLintingOptions: '-DcreateSourcesJar=false' + AdditionalLintingOptions: -DcreateSourcesJar=false Artifacts: - name: azure-security-keyvault-administration groupId: com.azure @@ -102,9 +105,12 @@ extends: groupId: com.azure safeName: azuresecuritykeyvaultsecrets releaseInBatch: ${{ parameters.release_azuresecuritykeyvaultsecrets }} + - name: azure-resourcemanager-keyvault-generated + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerkeyvaultgenerated + releaseInBatch: ${{ parameters.release_azureresourcemanagerkeyvaultgenerated }} AdditionalModules: - name: azure-security-keyvault-perf groupId: com.azure - # required by the above perf library - name: perf-test-core groupId: com.azure diff --git a/sdk/keyvault/pom.xml b/sdk/keyvault/pom.xml index 49033e1de3ed..06084162bdbb 100644 --- a/sdk/keyvault/pom.xml +++ b/sdk/keyvault/pom.xml @@ -9,12 +9,13 @@ 1.0.0 - azure-security-test-keyvault-jca + azure-resourcemanager-keyvault-generated azure-security-keyvault-administration azure-security-keyvault-certificates azure-security-keyvault-jca azure-security-keyvault-keys - azure-security-keyvault-secrets azure-security-keyvault-perf + azure-security-keyvault-secrets + azure-security-test-keyvault-jca